Skip to content

Commit

Permalink
fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
SeungJL committed Sep 26, 2024
1 parent 02b5680 commit 6d987a7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
9 changes: 6 additions & 3 deletions components/molecules/cards/PostThumbnailCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,12 @@ export function PostThumbnailCard({
</Flex>
</Flex>
<Flex direction="column" justifyContent="space-between" align="flex-end">
<Box>
{badge && <OutlineBadge size="sm" text={badge.text} colorScheme={badge.colorScheme} />}
</Box>
{badge ? (
<OutlineBadge size="sm" text={badge.text} colorScheme={badge.colorScheme} />
) : (
<Box />
)}

{participants && (
<Flex
mb="-2px"
Expand Down
2 changes: 1 addition & 1 deletion pageTemplates/home/HomeRecommendationSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function HomeRecommendationSection() {
enabled: !!userLocation || !!session?.user.location,
},
);

console.log(32, studyVoteData);
useEffect(() => {
if (studyVoteData) {
setStudyPairArr(studyVoteData);
Expand Down
10 changes: 9 additions & 1 deletion pageTemplates/home/study/HomeStudyCol.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ThemeTypings } from "@chakra-ui/react";
import dayjs from "dayjs";
import { useSession } from "next-auth/react";
import { useSearchParams } from "next/navigation";
import { useSession } from "next-auth/react";
import { useEffect, useState } from "react";
import { useRecoilValue } from "recoil";

Expand All @@ -17,6 +17,8 @@ import {
STUDY_DATE_START_HOUR,
STUDY_RESULT_HOUR,
} from "../../../constants/serviceConstants/studyConstants/studyTimeConstant";
import { useStudyResultDecideMutation } from "../../../hooks/study/mutations";
import { getStudyConfimCondition } from "../../../libs/study/getStudyConfimCondition";
import StudyOpenCheckModal from "../../../modals/study/StudyOpenCheckModal";
import { studyDateStatusState } from "../../../recoils/studyRecoils";
import { IParticipation, StudyStatus } from "../../../types/models/studyTypes/studyDetails";
Expand Down Expand Up @@ -48,6 +50,8 @@ function HomeStudyCol({ studyVoteData, isLoading, date, isShort }: HomeStudyColP
const [studyCardColData, setStudyCardColData] = useState<IPostThumbnailCard[]>();
const [dismissedStudy, setDismissedStudy] = useState<IParticipation>();

const { mutate: decideStudyResult } = useStudyResultDecideMutation(date);

useEffect(() => {
if (!studyVoteData || !studyVoteData.length || !session?.user || !studyDateStatus) {
setStudyCardColData(null);
Expand Down Expand Up @@ -97,6 +101,10 @@ function HomeStudyCol({ studyVoteData, isLoading, date, isShort }: HomeStudyColP

localStorage.setItem(STUDY_VOTING_TABLE, JSON.stringify(updatedTable));
}

if (getStudyConfimCondition(studyDateStatus, studyVoteData[1].status)) {
decideStudyResult();
}
}, [studyDateStatus, studyVoteData]);

return (
Expand Down

0 comments on commit 6d987a7

Please sign in to comment.