From b28d7964999c25c105650d73743c0e8e3def6a31 Mon Sep 17 00:00:00 2001 From: Shineast Date: Sat, 21 Feb 2026 13:12:32 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=EB=AA=A8=EC=9E=84=20=EB=AA=A9?= =?UTF-8?q?=EC=A0=81=20=ED=95=98=EB=93=9C=EC=BD=94=EB=94=A9=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0=20=EC=9D=B4=ED=9B=84=20=EB=A1=9C=EC=BB=AC=EC=8A=A4?= =?UTF-8?q?=ED=86=A0=EB=A6=AC=EC=A7=80=EC=97=90=EC=84=9C=20=EC=B9=B4?= =?UTF-8?q?=ED=85=8C=EA=B3=A0=EB=A6=AC=20=EC=B6=94=EC=B6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/result/[id]/page.tsx | 68 +++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 39 deletions(-) diff --git a/app/result/[id]/page.tsx b/app/result/[id]/page.tsx index e3ce303..38826d5 100644 --- a/app/result/[id]/page.tsx +++ b/app/result/[id]/page.tsx @@ -24,9 +24,22 @@ export default function Page() { return getMeetingUserId(id) || ''; }); + // 로컬스토리지에서 가져온 카테고리 값을 저장할 State + const [localCategory, setLocalCategory] = useState(''); + const { data: midpointData, isLoading, isError } = useMidpoint(id); const { data: meetingData } = useCheckMeeting(id); + // 컴포넌트 마운트 시 로컬스토리지 값 가져오기 (Hydration 에러 방지) + useEffect(() => { + if (typeof window !== 'undefined' && id) { + const storedCategory = localStorage.getItem(`meeting_${id}_category`); + if (storedCategory) { + setLocalCategory(storedCategory); + } + } + }, [id]); + const locationResults = useMemo(() => { if (!midpointData?.success || !midpointData.data || !Array.isArray(midpointData.data)) { return []; @@ -112,47 +125,25 @@ export default function Page() { }); }, [midpointData, myNickname, id]); - // 카테고리 텍스트 생성 함수 + // 카테고리 텍스트 생성 함수 업데이트 const getCategoryText = ( - category: string | undefined, - hot: boolean | undefined, - rank: number, + apiCategory: string | undefined, + hot: boolean | undefined, // hot 파라미터를 안 쓰게 되더라도 시그니처 유지를 위해 둠 + rank: number ): string => { - const purposeText = '[모임 목적]'; - const lastChar = purposeText.charCodeAt(purposeText.length - 1); - const hasJongseong = (lastChar - 0xac00) % 28 !== 0; - const purposeTextWithPostfix = `${purposeText}${hasJongseong ? '이' : '가'} 많은 장소`; - - - if (hot === true && rank === 1) { - return `밍글링 추천 1위 · ${purposeTextWithPostfix}`; - } - - - else if (hot === true && rank === 2) { - return `밍글링 추천 2위 · ${purposeTextWithPostfix}`; - } - - - else if (hot === true) { - return purposeTextWithPostfix; - } - - - else if (rank === 1) { + // 밍글링 추천 문구가 들어가는 1위, 2위는 "OO이 많은 장소" 텍스트를 완전히 생략합니다. + if (rank === 1) { return '밍글링 추천 1위'; - } - - else if (rank === 2) { + } else if (rank === 2) { return '밍글링 추천 2위'; } - else if (!category) return '밍글링 추천 1위'; + // 3위 등 밍글링 추천이 안 붙는 경우에만 로컬스토리지 값 활용하여 "OO이/가 많은 장소" 표시 + const purposeText = localCategory || apiCategory || '모임 목적'; + const lastChar = purposeText.charCodeAt(purposeText.length - 1); + const hasJongseong = (lastChar - 0xac00) % 28 !== 0; - // 카테고리 종성에 따라 "이/가"를 다르게 렌더링 - const categoryLastChar = category.charCodeAt(category.length - 1); - const categoryHasJongseong = (categoryLastChar - 0xac00) % 28 !== 0; - return `${category}${categoryHasJongseong ? '이' : '가'} 많은 장소`; + return `${purposeText}${hasJongseong ? '이' : '가'} 많은 장소`; }; const [selectedResultId, setSelectedResultId] = useState(1); @@ -196,7 +187,6 @@ export default function Page() {
최종 위치 결과 Top3
- @@ -234,7 +224,7 @@ export default function Page() { locationResults.map((result) => { const category = meetingData?.data?.purposes?.[meetingData.data.purposes.length - 1]; - const categoryText = getCategoryText(category, result.hot, result.id); + const categoryText = getCategoryText(category, result.hot, result.id); const handleRecommendClick = (e: React.MouseEvent) => { e.stopPropagation(); @@ -336,12 +326,12 @@ export default function Page() { )} - + From 6ba47e9120cf60b34da907ef1b8f164f01f3ddef Mon Sep 17 00:00:00 2001 From: Shineast Date: Sat, 21 Feb 2026 13:15:51 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=EB=A6=B0=ED=8A=B8=20=EA=B7=9C?= =?UTF-8?q?=EC=B9=99=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- eslint.config.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/eslint.config.mjs b/eslint.config.mjs index 361b9cc..e4d55da 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -20,6 +20,7 @@ const eslintConfig = defineConfig([ '@typescript-eslint/no-empty-object-type': 'off', '@typescript-eslint/ban-ts-comment': 'off', '@typescript-eslint/no-unused-vars': 'warn', + 'react-hooks/set-state-in-effect': 'off', }, }, ]);