From ed6930d8e4d57d86725df63479f670050b92ddff Mon Sep 17 00:00:00 2001 From: seongminn Date: Wed, 1 Apr 2026 23:34:25 +0900 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=EA=B2=BD=EA=B8=B0=20=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=20=EC=88=9C=EC=84=9C=20=EC=A1=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/spectator/src/app/(home)/_components/tab.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/spectator/src/app/(home)/_components/tab.tsx b/apps/spectator/src/app/(home)/_components/tab.tsx index a2790ec3..3a33f7a3 100644 --- a/apps/spectator/src/app/(home)/_components/tab.tsx +++ b/apps/spectator/src/app/(home)/_components/tab.tsx @@ -24,9 +24,16 @@ export const RecentTab = () => { const hasPlayingGames = displayedGame.games.some((game) => game.gameState === 'PLAYING'); const buttonLabel = hasPlayingGames ? '응원하러 가기' : '지난 경기 보러가기'; - const sortedGames = [...displayedGame.games].sort( - (a, b) => new Date(b.startTime).getTime() - new Date(a.startTime).getTime(), - ); + // gameState가 PLAYING인 경기, SCHEDULED인 경기, FINISHED인 경기 순으로 정렬 + // 각 경기 상태 내에서는 시작 시간이 빠른 순으로 정렬 + const sortedGames = [...displayedGame.games].sort((a, b) => { + const gameStateOrder = { PLAYING: 0, SCHEDULED: 1, FINISHED: 2 }; + const aOrder = gameStateOrder[a.gameState]; + const bOrder = gameStateOrder[b.gameState]; + + if (aOrder !== bOrder) return aOrder - bOrder; + return new Date(a.startTime).getTime() - new Date(b.startTime).getTime(); + }); const { data: cheerCount } = useSuspenseLeagueCheerCount( { leagueId: displayedGame?.leagueId }, From 3ba9c370a23c754388bf7cf583fcbd2f7be2b046 Mon Sep 17 00:00:00 2001 From: seongminn Date: Sat, 4 Apr 2026 19:35:41 +0900 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20=EB=AC=B8=EA=B5=AC=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/spectator/src/app/(home)/_components/tab.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/spectator/src/app/(home)/_components/tab.tsx b/apps/spectator/src/app/(home)/_components/tab.tsx index 3a33f7a3..2e5aa50e 100644 --- a/apps/spectator/src/app/(home)/_components/tab.tsx +++ b/apps/spectator/src/app/(home)/_components/tab.tsx @@ -21,12 +21,14 @@ export const RecentTab = () => { if (!displayedGame) return null; - const hasPlayingGames = displayedGame.games.some((game) => game.gameState === 'PLAYING'); + const { games, leagueId, leagueName } = displayedGame; + + const hasPlayingGames = !games.every(({ gameState }) => gameState === 'FINISHED'); const buttonLabel = hasPlayingGames ? '응원하러 가기' : '지난 경기 보러가기'; // gameState가 PLAYING인 경기, SCHEDULED인 경기, FINISHED인 경기 순으로 정렬 // 각 경기 상태 내에서는 시작 시간이 빠른 순으로 정렬 - const sortedGames = [...displayedGame.games].sort((a, b) => { + const sortedGames = [...games].sort((a, b) => { const gameStateOrder = { PLAYING: 0, SCHEDULED: 1, FINISHED: 2 }; const aOrder = gameStateOrder[a.gameState]; const bOrder = gameStateOrder[b.gameState]; @@ -44,8 +46,8 @@ export const RecentTab = () => {
From ff5936938bdaed99f23d2222a2177f39f7572e56 Mon Sep 17 00:00:00 2001 From: seongminn Date: Sat, 4 Apr 2026 19:45:59 +0900 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=EA=B2=BD=EA=B8=B0=20=EC=A0=95?= =?UTF-8?q?=EB=A0=AC=20=EC=88=9C=EC=84=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/spectator/src/app/(home)/_components/tab.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/spectator/src/app/(home)/_components/tab.tsx b/apps/spectator/src/app/(home)/_components/tab.tsx index 2e5aa50e..1b0ab6c6 100644 --- a/apps/spectator/src/app/(home)/_components/tab.tsx +++ b/apps/spectator/src/app/(home)/_components/tab.tsx @@ -27,14 +27,14 @@ export const RecentTab = () => { const buttonLabel = hasPlayingGames ? '응원하러 가기' : '지난 경기 보러가기'; // gameState가 PLAYING인 경기, SCHEDULED인 경기, FINISHED인 경기 순으로 정렬 - // 각 경기 상태 내에서는 시작 시간이 빠른 순으로 정렬 + // 각 경기 상태 내에서는 시작 시간이 느린 순으로 정렬 const sortedGames = [...games].sort((a, b) => { const gameStateOrder = { PLAYING: 0, SCHEDULED: 1, FINISHED: 2 }; const aOrder = gameStateOrder[a.gameState]; const bOrder = gameStateOrder[b.gameState]; if (aOrder !== bOrder) return aOrder - bOrder; - return new Date(a.startTime).getTime() - new Date(b.startTime).getTime(); + return new Date(b.startTime).getTime() - new Date(a.startTime).getTime(); }); const { data: cheerCount } = useSuspenseLeagueCheerCount(