Skip to content

Commit

Permalink
feat(mypage.jsx): implement test today display for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
junglesub committed Aug 4, 2024
1 parent cc12ed3 commit ac96749
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/components/Mypage/PersonalViewMain.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@ import styled from "styled-components";
import { convertMlToL, removeNonNumeric } from "src/tools/tool";
import TheButton from "src/styles/TheButton";
import { HoverImageSpan } from "../../styles/stylePresets";
import { useSetRecoilState } from "recoil";
import { userDetailAtom } from "../../recoil/userAtoms";

function PersonalViewMain() {
const fetchBe = useFetchBe();

const setUserData = useSetRecoilState(userDetailAtom);

const [loading, setLoading] = useState({
bottle: false,
cup: false,
Expand Down Expand Up @@ -54,6 +58,9 @@ function PersonalViewMain() {
alert("Error while adding water");
return;
}
fetchBe("/userDetail/get").then((json) => {
setUserData(json);
});
setTimeout(
setLoading((prev) => ({
...prev,
Expand Down
30 changes: 29 additions & 1 deletion src/pages/Mypage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import PersonalViewMain from "../components/Mypage/PersonalViewMain";
import { HoverImageSpan } from "../styles/stylePresets";
import GroupViewExploreMain from "../components/Mypage/GroupViewExploreMain";
import GroupViewExploreTop from "../components/Mypage/GroupViewExploreTop";
import { convertMlToL } from "../tools/tool";

function Mypage() {
const resetAuth = useResetRecoilState(authJwtAtom);
Expand Down Expand Up @@ -109,7 +110,17 @@ function Mypage() {
</TopBlock.right>
</TopBlock.wrapper>
<MainAreaWrapper>
{groupMode === 0 && <PersonalViewMain />}
{groupMode === 0 && (
<>
<PersonalViewMain />
<TempText>
<div>
Today <br />
{convertMlToL(userData.todayTotal)}L
</div>
</TempText>
</>
)}
{groupMode === 1 && <GroupViewExploreMain />}
</MainAreaWrapper>
</div>
Expand Down Expand Up @@ -212,4 +223,21 @@ const VeryTopWrapper = styled.div`
const MainAreaWrapper = styled.div`
width: 100%;
min-height: 535px;
position: relative;
`;

const TempText = styled.div`
position: absolute;
top: 0;
left: 0;
right: 0;
display: flex;
div {
display: inline-block;
margin: auto;
font-size: 64px;
font-weight: bold;
text-align: center;
background-color: lightgray;
}
`;

0 comments on commit ac96749

Please sign in to comment.