Skip to content

Commit

Permalink
hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
SeungJL committed Jun 1, 2024
1 parent 4cb83f6 commit 5781e55
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
10 changes: 9 additions & 1 deletion pageTemplates/vote/VoteDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ function VoteDrawer({ studyVoteData, myVote, setMyVote, setActionType }: VoteDra
useEffect(() => {
if (!myVote?.place) {
const items = getSortedMainPlace(studyVoteData, savedPrefer);
console.log(4, items);
setPlaceItems(items);
return;
}
Expand All @@ -73,9 +74,16 @@ function VoteDrawer({ studyVoteData, myVote, setMyVote, setActionType }: VoteDra
}, [myVote?.place, myVote?.subPlace]);

const mainPlace = items?.find((item) => item.place._id === myVote?.place?._id);
const bodyWidth = document.body.clientWidth;
const bodyHeight = document.body.clientHeight;

return (
<BottomDrawerLg setIsModal={() => {}} height={300} isxpadding={false} isOverlay={false}>
<BottomDrawerLg
height={bodyHeight - bodyWidth - 74}
setIsModal={() => {}}
isxpadding={false}
isOverlay={false}
>
{mainPlace ? (
<VoteDrawerMainItem
voteCnt={mainPlace?.voteCnt}
Expand Down
16 changes: 11 additions & 5 deletions pageTemplates/vote/voteDrawer/VoteDrawerQuickVoteItem.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Box, Flex } from "@chakra-ui/react";
import styled from "styled-components";

import { useToast } from "../../../hooks/custom/CustomToast";
import { DispatchType } from "../../../types/hooks/reactTypes";
import { IPlace } from "../../../types/models/studyTypes/studyDetails";
import { IStudyVoteWithPlace } from "../../../types/models/studyTypes/studyInterActions";
Expand All @@ -11,21 +12,26 @@ interface VoteDrawerQuickVoteItemProps {
}

function VoteDrawerQuickVoteItem({ savedPreferPlace, setMyVote }: VoteDrawerQuickVoteItemProps) {
const favoritesCnt = (savedPreferPlace?.place ? 1 : 0) + savedPreferPlace?.subPlace?.length;
const toast = useToast();
const favoritesCnt = (savedPreferPlace?.place ? 1 : 0) + savedPreferPlace?.subPlace?.length || 0;
return (
<Flex
py="8px"
align="center"
pl="16px"
pr="20px"
borderBottom="var(--border-main)"
onClick={() =>
onClick={() => {
if (favoritesCnt === 0) {
toast("warning", "즐겨찾기중인 장소가 없습니다.");
return;
}
setMyVote((old) => ({
...old,
place: savedPreferPlace.place,
subPlace: savedPreferPlace.subPlace,
}))
}
}));
}}
as="button"
w="100%"
>
Expand All @@ -38,7 +44,7 @@ function VoteDrawerQuickVoteItem({ savedPreferPlace, setMyVote }: VoteDrawerQuic
빠른 투표
</Box>
<Box color="var(--gray-600)" fontSize="14px">
<Box as="span">등록된 장소:{favoritesCnt}</Box>
<Box as="span">등록된 장소:{favoritesCnt || 0}</Box>
</Box>
</Flex>
</Flex>
Expand Down
2 changes: 2 additions & 0 deletions pages/vote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export default function StudyVoteMap() {
return (
<>
<Header title="스터디 투표" />

<MapLayout>
<VoteMap
mapOptions={mapOptions}
Expand All @@ -105,6 +106,7 @@ export default function StudyVoteMap() {
setActionType={setActionType}
/>
)}

<VoteTimeDrawer
myVote={
myVote && {
Expand Down

0 comments on commit 5781e55

Please sign in to comment.