From 034fba4ab62c85229ce46726fe1027cb451c5bc7 Mon Sep 17 00:00:00 2001 From: GulSam00 Date: Tue, 27 Jan 2026 01:11:58 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix=20:=20=EB=AF=B8=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=9D=B8=20=EC=8B=9C=20=EC=B6=9C=EC=84=9D=20=EC=B2=B4=ED=81=AC?= =?UTF-8?q?,=20=EC=B6=94=EC=B2=9C=20=ED=8E=98=EC=9D=B4=EC=A7=80=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98=20=EC=9D=B4=EC=8A=88=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/src/Header.tsx | 15 +++- apps/web/src/app/search/SearchResultCard.tsx | 31 ++++++-- apps/web/src/components/CheckInModal.tsx | 78 ++++++++++++-------- apps/web/src/components/ThumbUpModal.tsx | 10 ++- apps/web/src/hooks/useSearchSong.ts | 1 - apps/web/src/queries/userQuery.ts | 1 + apps/web/src/query.tsx | 2 +- 7 files changed, 91 insertions(+), 47 deletions(-) diff --git a/apps/web/src/Header.tsx b/apps/web/src/Header.tsx index 9c495b7..e5ce0fb 100644 --- a/apps/web/src/Header.tsx +++ b/apps/web/src/Header.tsx @@ -16,7 +16,7 @@ export default function Header() { const router = useRouter(); - const { data: user, isLoading: isLoadingUser } = useUserQuery(); + const { data: user, isLoading, error } = useUserQuery(); const lastCheckIn = user?.last_check_in ?? new Date(); @@ -25,6 +25,11 @@ export default function Header() { window.open(contactUrl, '_blank'); }; + const handleNavigateLogin = () => { + router.push('/login'); + setOpen(false); + }; + return (
- - + diff --git a/apps/web/src/app/search/SearchResultCard.tsx b/apps/web/src/app/search/SearchResultCard.tsx index 46aeb4f..f3260cb 100644 --- a/apps/web/src/app/search/SearchResultCard.tsx +++ b/apps/web/src/app/search/SearchResultCard.tsx @@ -1,9 +1,12 @@ import { Heart, ListPlus, ListRestart, MinusCircle, PlusCircle, ThumbsUp } from 'lucide-react'; +import { useState } from 'react'; +import { toast } from 'sonner'; import ThumbUpModal from '@/components/ThumbUpModal'; import { Button } from '@/components/ui/button'; import { Card } from '@/components/ui/card'; import { Dialog, DialogContent, DialogTrigger } from '@/components/ui/dialog'; +import useAuthStore from '@/stores/useAuthStore'; import { SearchSong } from '@/types/song'; interface IProps { @@ -20,6 +23,17 @@ export default function SearchResultCard({ onClickSave, }: IProps) { const { id, title, artist, num_tj, num_ky, isToSing, isLike, isSave } = song; + const { isAuthenticated } = useAuthStore(); + + const [open, setOpen] = useState(false); + + const handleClickThumbsUp = () => { + if (!isAuthenticated) { + toast.error('로그인이 필요해요.'); + return; + } + setOpen(true); + }; return ( @@ -34,15 +48,18 @@ export default function SearchResultCard({

{artist}

- - - - + + - + setOpen(false)} /> diff --git a/apps/web/src/components/CheckInModal.tsx b/apps/web/src/components/CheckInModal.tsx index 194edd7..bc62f38 100644 --- a/apps/web/src/components/CheckInModal.tsx +++ b/apps/web/src/components/CheckInModal.tsx @@ -8,15 +8,21 @@ import SplitText from '@/components/reactBits/SplitText'; import { Button } from '@/components/ui/button'; import { DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog'; import { useCheckInTimer } from '@/hooks/useCheckInTimer'; -import { usePatchUserCheckInMutation, useUserQuery } from '@/queries/userQuery'; +import { usePatchUserCheckInMutation } from '@/queries/userQuery'; import ActionAnimationFlow from './ActionAnimationFlow'; interface CheckInModalProps { lastCheckIn: Date; + isLogin: boolean; + handleNavigateLogin: () => void; } -export default function CheckInModal({ lastCheckIn }: CheckInModalProps) { +export default function CheckInModal({ + lastCheckIn, + isLogin, + handleNavigateLogin, +}: CheckInModalProps) { const timeRemaining = useCheckInTimer(lastCheckIn); const { mutate: patchUserCheckIn } = usePatchUserCheckInMutation(); @@ -38,36 +44,46 @@ export default function CheckInModal({ lastCheckIn }: CheckInModalProps) {
- = today ? 'DONE' : 'IDLE'} - // 1. 대기 화면 (trigger 함수를 받아서 버튼에 연결) - idleView={trigger => ( -
-

오늘 출석하시겠어요?

- -
- )} - // 2. 결과 화면 - doneView={ -
-

다음 출석까지 남은 시간

-
- - {timeRemaining || '00:00:00'} + {isLogin ? ( + = today ? 'DONE' : 'IDLE'} + // 1. 대기 화면 (trigger 함수를 받아서 버튼에 연결) + idleView={trigger => ( +
+

오늘 출석하시겠어요?

+
- -
- } - /> + )} + // 2. 결과 화면 + doneView={ +
+

다음 출석까지 남은 시간

+
+ + {timeRemaining || '00:00:00'} +
+ +
+ } + /> + ) : ( +
+ + + +
+ )}
); diff --git a/apps/web/src/components/ThumbUpModal.tsx b/apps/web/src/components/ThumbUpModal.tsx index 7f5dde7..8849cbb 100644 --- a/apps/web/src/components/ThumbUpModal.tsx +++ b/apps/web/src/components/ThumbUpModal.tsx @@ -16,22 +16,24 @@ import FallingIcons from './FallingIcons'; interface ThumbUpModalProps { songId: string; + handleClose: () => void; } -export default function ThumbUpModal({ songId }: ThumbUpModalProps) { +export default function ThumbUpModal({ songId, handleClose }: ThumbUpModalProps) { const [value, setValue] = useState([0]); const { data: user } = useUserQuery(); + const point = user?.point ?? 0; + const { mutate: patchSongThumb, isPending: isPendingSongThumb } = useSongThumbMutation(); const { mutate: patchSetPoint, isPending: isPendingSetPoint } = usePatchSetPointMutation(); - const point = user?.point ?? 0; - const handleClickThumb = () => { patchSongThumb({ songId, point: value[0] }); patchSetPoint({ point: point - value[0] }); - setValue([0]); + + handleClose(); }; const isPending = isPendingSongThumb || isPendingSetPoint; diff --git a/apps/web/src/hooks/useSearchSong.ts b/apps/web/src/hooks/useSearchSong.ts index dbaf762..07bb2be 100644 --- a/apps/web/src/hooks/useSearchSong.ts +++ b/apps/web/src/hooks/useSearchSong.ts @@ -26,7 +26,6 @@ export default function useSearchSong() { const [searchType, setSearchType] = useState('all'); const [saveModalType, setSaveModalType] = useState(''); const [selectedSaveSong, setSelectedSaveSong] = useState(null); - // const { data: searchResults, isLoading } = useSearchSongQuery(query, searchType, isAuthenticated); const { mutate: toggleToSing, isPending: isToggleToSingPending } = useToggleToSingMutation( query, searchType, diff --git a/apps/web/src/queries/userQuery.ts b/apps/web/src/queries/userQuery.ts index 2bbc3b1..a1cae1c 100644 --- a/apps/web/src/queries/userQuery.ts +++ b/apps/web/src/queries/userQuery.ts @@ -13,6 +13,7 @@ export const useUserQuery = () => { } return response.data; }, + staleTime: 1000 * 60, }); }; diff --git a/apps/web/src/query.tsx b/apps/web/src/query.tsx index 6037566..c6d8b5b 100644 --- a/apps/web/src/query.tsx +++ b/apps/web/src/query.tsx @@ -11,7 +11,7 @@ export default function QueryProvider({ children }: { children: React.ReactNode queries: { refetchOnWindowFocus: false, retry: 1, - throwOnError: true, + // throwOnError: true, staleTime: 1000 * 60 * 5, gcTime: 1000 * 60 * 5, }, From 8b2a1d0987d43ff01edf3741aa76afc4a753b435 Mon Sep 17 00:00:00 2001 From: GulSam00 Date: Tue, 27 Jan 2026 01:19:25 +0900 Subject: [PATCH 2/2] =?UTF-8?q?chore=20:=20=EB=AF=B8=EC=82=AC=EC=9A=A9=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/src/stores/useLoadingStore.ts | 32 -------------------------- 1 file changed, 32 deletions(-) delete mode 100644 apps/web/src/stores/useLoadingStore.ts diff --git a/apps/web/src/stores/useLoadingStore.ts b/apps/web/src/stores/useLoadingStore.ts deleted file mode 100644 index e4cca29..0000000 --- a/apps/web/src/stores/useLoadingStore.ts +++ /dev/null @@ -1,32 +0,0 @@ -// import { create } from 'zustand'; - -// interface LoadingState { -// count: number; -// isLoading: boolean; -// isInitialLoading: boolean; -// startLoading: () => void; -// stopLoading: () => void; -// initialLoading: () => void; -// } - -// const useLoadingStore = create((set, get) => ({ -// count: 0, -// isLoading: false, -// isInitialLoading: true, -// startLoading: () => { -// const newCount = get().count + 1; -// set({ count: newCount, isLoading: true }); -// }, -// stopLoading: () => { -// const newCount = Math.max(0, get().count - 1); -// set({ -// count: newCount, -// isLoading: newCount > 0, -// }); -// }, -// initialLoading: () => { -// set({ isInitialLoading: false }); -// }, -// })); - -// export default useLoadingStore;