From cd5a82aa93a4e318b9f4eb6a40bcfb096248003b Mon Sep 17 00:00:00 2001 From: dahyeon Date: Mon, 8 Jun 2026 05:39:22 -0700 Subject: [PATCH] fix(web): refine mobile history cards --- apps/web/src/pages/HomePage.tsx | 116 ++++++++++++++++++++++++++++++-- 1 file changed, 109 insertions(+), 7 deletions(-) diff --git a/apps/web/src/pages/HomePage.tsx b/apps/web/src/pages/HomePage.tsx index cd7fd43d..0c1aafe6 100644 --- a/apps/web/src/pages/HomePage.tsx +++ b/apps/web/src/pages/HomePage.tsx @@ -85,7 +85,7 @@ function HomePageSkeleton() {
-
+
@@ -125,6 +125,23 @@ function HomePageSkeleton() {
+
+ {historySkeletons.map((_, index) => ( +
+
+
+ + +
+ +
+ +
+ ))} +
); @@ -140,7 +157,7 @@ function StatusBadge({ status }: { status: string }) { return ( {status} @@ -149,7 +166,7 @@ function StatusBadge({ status }: { status: string }) { function MapBadge({ map }: { map: string }) { return ( - + {map} ); @@ -170,6 +187,43 @@ function getStatusLabel(status: string) { } } +function formatCompactDateTime(dateLike: string) { + const date = new Date(dateLike); + if (Number.isNaN(date.getTime())) return ''; + + const weekday = new Intl.DateTimeFormat('ko-KR', { + weekday: 'short', + }).format(date); + const hours = String(date.getHours()).padStart(2, '0'); + const minutes = String(date.getMinutes()).padStart(2, '0'); + + return `${date.getMonth() + 1}/${date.getDate()} (${weekday}) ${hours}:${minutes}`; +} + +function HistoryMetaText({ + map, + participants, + result, +}: { + map: string; + participants: number; + result?: string; +}) { + return ( +
+ {map} + · + {participants}명 + {result && ( + <> + · + {result} + + )} +
+ ); +} + interface HistoryPaginationProps { page: number; pageCount: number; @@ -268,7 +322,10 @@ export default function HomePage() { const upcomingMatches = upcomingMatchesQuery.data?.map(mapApiMatchToMatchDetail) ?? []; const historyMatches = - historyMatchesQuery.data?.matches.map(mapApiMatchToMatchDetail) ?? []; + historyMatchesQuery.data?.matches.map((match) => ({ + ...mapApiMatchToMatchDetail(match), + compactDateTime: formatCompactDateTime(match.scheduledAt), + })) ?? []; const historyTotal = historyMatchesQuery.data?.total ?? 0; const historyLimit = historyMatchesQuery.data?.limit ?? HISTORY_MATCH_PAGE_SIZE; @@ -398,7 +455,8 @@ export default function HomePage() {

지난 내전 기록

-
+ {/* 데스크톱: 테이블 */} +
@@ -434,10 +492,10 @@ export default function HomePage() { - - @@ -455,6 +513,50 @@ export default function HomePage() {
+ {match.participants.length}명 + {match.result?.winner ? `${match.result.winner} 승리` : '-'}
+ + {/* 모바일: 카드 리스트 */} +
+ {historyMatches.length > 0 ? ( + historyMatches.map((match) => { + const resultLabel = match.result?.winner + ? `${match.result.winner} 승리` + : undefined; + + return ( + +
+
+
+ {match.compactDateTime || `${match.date} ${match.time}`} +
+
+ {match.title} +
+
+
+ +
+
+
+ +
+ + ); + }) + ) : ( +
+ 아직 내전 기록이 없습니다. +
+ )} +
{historyTotal > 0 && (