feat: connect tournament views to APIs and recover archived stats

Remove development previews and complete hall of fame, match history, official results, and multi-kill API integration.

Fix active match pagination and team-ready controls, preserve basic scoreboards, and recover statistics when Riot archives arrive.

Use bounded in-process cache invalidation retries and add the Riot match lookup index migration with regression coverage.
This commit is contained in:
dahyeon committed 2026-11-11 02:00:35 +09:00
1 parent 20e1e6ec04
commit 0d7617e2d2
70 files changed
+3739 -1793

No files matched your search

+78 -30
View File
@@ -1,4 +1,4 @@
import { useEffect, useState, type CSSProperties } from 'react';
import { useEffect, useState, type CSSProperties, type ReactNode } from 'react';
import type {
MatchDetailResponse,
MatchEventType,
@@ -24,6 +24,7 @@ import {
Button,
EmptyNote,
ErrorNote,
LoadingNote,
Panel,
PanelHeader,
Pill,
@@ -36,11 +37,11 @@ import {
getHomeMatchEnrollment,
getHomeMatchSchedule,
getNextMatchBanner,
HOME_MATCH_STATUS,
getMatchStageLabel,
} from './home-match-presentation';
const UPCOMING_MATCH_LIST_LIMIT = 4;
const HISTORY_MATCH_PAGE_SIZE = 10;
const MATCH_ARCHIVE_PAGE_SIZE = 10;
const HOME_HISTORY_LIMIT = 4;
const HOME_RANKING_LIMIT = 5;
const DEFAULT_MAP_ID = 11;
@@ -127,9 +128,11 @@ function NextMatch({ match }: { match: MatchDetailResponse }) {
function UpcomingMatches({
matches,
title = '이어지는 내전',
footer,
}: {
matches: MatchDetailResponse[];
title?: string;
footer?: ReactNode;
}) {
return (
<Panel>
@@ -156,7 +159,7 @@ function UpcomingMatches({
<p className="tabular col-start-1 mt-1 text-[13px] text-content-muted sm:col-start-3 sm:row-start-1 sm:mt-0">
{match.status === 'recruiting'
? label
: HOME_MATCH_STATUS[match.status]}{' '}
: getMatchStageLabel(match)}{' '}
· {capacity}
</p>
<ChevronRight
@@ -168,6 +171,10 @@ function UpcomingMatches({
);
})}
</ul>
{matches.length === 0 && (
<EmptyNote size="sm" title="이 페이지에 표시할 일정이 없습니다." />
)}
{footer}
</Panel>
);
}
@@ -238,13 +245,13 @@ function HistoryResult({ match }: { match: MatchSummaryResponse }) {
tone={match.status === 'in-progress' ? 'live' : 'neutral'}
dot={match.status === 'in-progress'}
>
{HOME_MATCH_STATUS[match.status]}
{getMatchStageLabel(match)}
</Pill>
);
}
return (
<span className="text-content-muted">
{HOME_MATCH_STATUS[match.status]}
{getMatchStageLabel(match)}
</span>
);
}
@@ -764,7 +771,7 @@ function RankingPreview({ statsPath }: { statsPath: string }) {
);
}
interface HistoryPaginationProps {
interface MatchPaginationProps {
page: number;
pageCount: number;
total: number;
@@ -773,14 +780,14 @@ interface HistoryPaginationProps {
onNext: () => void;
}
function HistoryPagination({
function MatchPagination({
page,
pageCount,
total,
isFetching,
onPrevious,
onNext,
}: HistoryPaginationProps) {
}: MatchPaginationProps) {
return (
<div className="flex flex-wrap items-center justify-between gap-x-3 gap-y-1 border-t border-line px-4 py-2.5 sm:px-5">
<span className="tabular text-xs text-content-muted">
@@ -814,32 +821,43 @@ export default function HomePage({ eventType }: { eventType?: MatchEventType })
const eventLabel = MATCH_EVENT_LABEL[selectedEventType];
const [timelineNow] = useState(() => new Date().toISOString());
const [searchParams, setSearchParams] = useSearchParams();
const requestedPage = Number(searchParams.get('page'));
const historyPage =
showArchive && Number.isSafeInteger(requestedPage) && requestedPage > 0
? requestedPage
: 1;
const historyLimit = showArchive
? HISTORY_MATCH_PAGE_SIZE
: HOME_HISTORY_LIMIT;
function setHistoryPage(page: number) {
const params = new URLSearchParams(searchParams);
if (page > 1) params.set('page', String(page));
else params.delete('page');
setSearchParams(params, { preventScrollReset: true });
function getPage(key: 'page' | 'activePage') {
const page = Number(searchParams.get(key));
return showArchive && Number.isSafeInteger(page) && page > 0 ? page : 1;
}
const historyPage = getPage('page');
const activePage = getPage('activePage');
const historyLimit = showArchive ? MATCH_ARCHIVE_PAGE_SIZE : HOME_HISTORY_LIMIT;
const activeLimit = showArchive ? MATCH_ARCHIVE_PAGE_SIZE : UPCOMING_MATCH_LIST_LIMIT;
function setPage(key: 'page' | 'activePage', page: number) {
setSearchParams((previous) => {
const params = new URLSearchParams(previous);
if (page > 1) params.set(key, String(page));
else params.delete(key);
return params;
}, { preventScrollReset: true });
}
const upcomingMatchesQuery = useMatches({
eventType: selectedEventType,
view: 'upcoming',
asOf: timelineNow,
limit: UPCOMING_MATCH_LIST_LIMIT,
scheduledFrom: timelineNow,
sort: 'asc',
});
const activeMatchesQuery = useMatchesPage({
eventType: selectedEventType,
view: 'active',
asOf: timelineNow,
limit: activeLimit,
page: activePage,
sort: 'desc',
});
const historyMatchesQuery = useMatchesPage({
eventType: selectedEventType,
view: 'history',
asOf: timelineNow,
limit: historyLimit,
page: historyPage,
status: showArchive ? undefined : 'finished',
scheduledTo: showArchive ? timelineNow : undefined,
sort: 'desc',
includeResults: true,
});
@@ -860,6 +878,11 @@ export default function HomePage({ eventType }: { eventType?: MatchEventType })
const bannerMatch = showArchive ? undefined : nextMatch;
const visibleUpcomingMatches = showArchive ? allUpcomingMatches : upcomingMatches;
const historyTotal = historyMatchesQuery.data?.total ?? 0;
const activeTotal = activeMatchesQuery.data?.total ?? 0;
const activePageCount = Math.max(
1,
Math.ceil(activeTotal / (activeMatchesQuery.data?.limit ?? activeLimit)),
);
const historyPageCount = Math.max(
1,
Math.ceil(historyTotal / (historyMatchesQuery.data?.limit ?? historyLimit)),
@@ -882,6 +905,31 @@ export default function HomePage({ eventType }: { eventType?: MatchEventType })
<h1 className="text-2xl font-bold">{eventLabel} 일정</h1>
</header>
)}
{activeMatchesQuery.isError && !activeMatchesQuery.data ? (
<ErrorNote title="진행 중인 일정을 불러오지 못했습니다"
action={<Button size="sm" label="다시 시도" onClick={() => void activeMatchesQuery.refetch()} />} />
) : activeMatchesQuery.isPlaceholderData ? (
<Panel aria-busy="true">
<PanelHeader title="진행 중인 일정" />
<LoadingNote label="일정을 불러오는 중" />
</Panel>
) : activeMatchesQuery.data &&
(activeMatchesQuery.data.matches.length > 0 || activePage > 1) ? (
<UpcomingMatches
matches={activeMatchesQuery.data.matches}
title="진행 중인 일정"
footer={showArchive && (activePageCount > 1 || activePage > 1) && (
<MatchPagination
page={activePage}
pageCount={activePageCount}
total={activeTotal}
isFetching={activeMatchesQuery.isFetching}
onPrevious={() => setPage('activePage', Math.min(activePage - 1, activePageCount))}
onNext={() => setPage('activePage', activePage + 1)}
/>
)}
/>
) : null}
{upcomingMatchesQuery.isLoading ? (
<UpcomingStatusHeading className="text-sm text-content-muted" aria-busy="true">
{eventLabel} 일정을 불러오는 중
@@ -921,7 +969,7 @@ export default function HomePage({ eventType }: { eventType?: MatchEventType })
>
<HistorySection aria-busy={isHistoryPageLoading} aria-live="polite">
<PanelHeader
title={showArchive ? '지난 일정과 결과' : '최근 내전 결과'}
title={showArchive ? '종료된 일정과 결과' : '최근 내전 결과'}
variant={showArchive ? 'panel' : 'section'}
actions={
<Link
@@ -961,14 +1009,14 @@ export default function HomePage({ eventType }: { eventType?: MatchEventType })
) : (
<RecentMatchResults matches={historyMatchesQuery.data?.matches ?? []} />
)}
{showArchive && !hasHistoryError && historyTotal > 0 && (
<HistoryPagination
{showArchive && !hasHistoryError && (historyTotal > 0 || historyPage > 1) && (
<MatchPagination
page={historyPage}
pageCount={historyPageCount}
total={historyTotal}
isFetching={historyMatchesQuery.isFetching}
onPrevious={() => setHistoryPage(Math.max(1, historyPage - 1))}
onNext={() => setHistoryPage(historyPage + 1)}
onPrevious={() => setPage('page', Math.min(historyPage - 1, historyPageCount))}
onNext={() => setPage('page', historyPage + 1)}
/>
)}
</HistorySection>