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:
1 parent
20e1e6ec04
commit
0d7617e2d2
70 files changed
+3739
-1793
No files matched your search
@@ -13,7 +13,7 @@ import {
|
||||
XAxis,
|
||||
YAxis,
|
||||
} from "recharts";
|
||||
import { useCompetition, useDdragonManifest, useInternalMatchDetail } from "../api/hooks";
|
||||
import { useDdragonManifest, useInternalMatchDetail } from "../api/hooks";
|
||||
import type { ApiInternalMatchDetailResponse, TeamSide } from "../api/types";
|
||||
import { DEFAULT_COMMUNITY_ID } from "../config";
|
||||
import {
|
||||
@@ -30,7 +30,10 @@ import {
|
||||
internalMatchGamePath,
|
||||
} from "../lib/internal-match-routes";
|
||||
import { selectInternalMatchGame } from "../lib/internal-match-game-selection";
|
||||
import { ApiError } from "../lib/api";
|
||||
import { BasicGameScoreboard } from "../components/BasicGameScoreboard";
|
||||
import { groupRecordedSets, type RecordedSeries } from "../lib/internal-match-series";
|
||||
import { riotMatchIdForDisplay } from "../lib/internal-game-evidence";
|
||||
import { getSeriesHistoryResultLabel, shouldDisplaySeriesHistoryScore } from "../components/competition/competition-series-history";
|
||||
import { LANE_LABELS } from "../lib/riot-history";
|
||||
import {
|
||||
@@ -58,6 +61,7 @@ import {
|
||||
import {
|
||||
Btn,
|
||||
EmptyNote,
|
||||
ErrorNote,
|
||||
LoadingNote,
|
||||
MetaDot,
|
||||
PageBody,
|
||||
@@ -1626,15 +1630,16 @@ function MatchScoreHero({
|
||||
}) {
|
||||
const selectedSeries = group.series;
|
||||
const officialGame = group.sets.find(({ game }) => game === selectedGame)?.official;
|
||||
const riotMatchId = riotMatchIdForDisplay(selectedGame, officialGame);
|
||||
const setLabel = officialGame ? `${officialGame.ordinal}세트` : `전체 ${selectedGame.gameNumber}세트`;
|
||||
const [leftTeam, rightTeam] = selectedGame.teams;
|
||||
const getScore = (side: TeamSide) => selectedSeries?.entries.find(
|
||||
(entry) => entry.teamId === officialGame?.teams[side].teamId,
|
||||
)?.gameWins;
|
||||
const leftScore = leftTeam && getScore(leftTeam.side);
|
||||
const rightScore = rightTeam && getScore(rightTeam.side);
|
||||
const showSeriesScore = selectedSeries && shouldDisplaySeriesHistoryScore(selectedSeries) && leftScore !== undefined && rightScore !== undefined;
|
||||
const decision = selectedSeries?.status === "completed" ? getSeriesHistoryResultLabel(selectedSeries) : null;
|
||||
const teamName = (teamId: string | null) =>
|
||||
detail.competition?.teams.find((team) => team.teamId === teamId)?.name ?? "팀 미확인";
|
||||
const seriesSummary = selectedSeries && shouldDisplaySeriesHistoryScore(selectedSeries)
|
||||
? `${selectedSeries.status === "in-progress" ? "시리즈 현재" : "시리즈 최종"} · ${selectedSeries.entries.map(
|
||||
({ teamId, gameWins }) => `${teamName(teamId)} ${gameWins}`,
|
||||
).join(" : ")}`
|
||||
: selectedSeries?.status === "completed" ? getSeriesHistoryResultLabel(selectedSeries) : null;
|
||||
const sideTone = (side: TeamSide) =>
|
||||
side === "blue" ? "text-win" : "text-loss";
|
||||
|
||||
@@ -1666,8 +1671,18 @@ function MatchScoreHero({
|
||||
<span className="tabular">
|
||||
{formatDuration(selectedGame.gameDuration)}
|
||||
</span>
|
||||
<MetaDot />
|
||||
<span className="font-mono text-xs">{selectedGame.riotMatchId}</span>
|
||||
{riotMatchId && (
|
||||
<>
|
||||
<MetaDot />
|
||||
<span className="font-mono text-xs">{riotMatchId}</span>
|
||||
</>
|
||||
)}
|
||||
{seriesSummary && (
|
||||
<>
|
||||
<MetaDot />
|
||||
<span>{seriesSummary}</span>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
}
|
||||
actions={
|
||||
@@ -1687,16 +1702,7 @@ function MatchScoreHero({
|
||||
</div>
|
||||
</div>
|
||||
<div className="text-center">
|
||||
{showSeriesScore ? (
|
||||
<>
|
||||
<div className="tabular text-4xl font-extrabold">{leftScore} : {rightScore}</div>
|
||||
<div className="mt-0.5 text-xs font-semibold text-on-ink-muted">
|
||||
{selectedSeries.status === "in-progress" ? "시리즈 진행 스코어" : "시리즈 스코어"}
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<div className="text-sm font-semibold text-on-ink-muted">{decision ?? "세트 결과"}</div>
|
||||
)}
|
||||
<div className="text-sm font-semibold text-on-ink-muted">세트 결과</div>
|
||||
</div>
|
||||
<div className="min-w-0">
|
||||
<div
|
||||
@@ -1727,10 +1733,11 @@ export default function MatchGameDetailPage() {
|
||||
const resolvedMatchId = matchId ?? id;
|
||||
const requestedGameNumber = Number(gameNumber);
|
||||
const detailQuery = useInternalMatchDetail(resolvedMatchId, communityId);
|
||||
const competition = useCompetition(resolvedMatchId, communityId);
|
||||
const { data: ddragon } = useDdragonManifest();
|
||||
const detail = detailQuery.data;
|
||||
const fallbackBackTo = resolvedMatchId
|
||||
const fallbackBackTo = id
|
||||
? `/match/${id}?tab=games`
|
||||
: resolvedMatchId
|
||||
? internalMatchDetailPath(communityId, resolvedMatchId)
|
||||
: `/communities/${communityId}/internal-stats`;
|
||||
const backTarget = resolveBackTarget(location.state, fallbackBackTo);
|
||||
@@ -1744,7 +1751,15 @@ export default function MatchGameDetailPage() {
|
||||
);
|
||||
}
|
||||
|
||||
if (detailQuery.error || !detail) {
|
||||
if (detailQuery.isError && !(detailQuery.error instanceof ApiError && detailQuery.error.status === 404)) {
|
||||
return (
|
||||
<PlainPage>
|
||||
<ErrorNote title="세트 기록을 불러오지 못했습니다"
|
||||
action={<Btn onClick={() => void detailQuery.refetch()}>다시 시도</Btn>} />
|
||||
</PlainPage>
|
||||
);
|
||||
}
|
||||
if (!detail) {
|
||||
return (
|
||||
<PlainPage>
|
||||
<EmptyNote
|
||||
@@ -1760,9 +1775,24 @@ export default function MatchGameDetailPage() {
|
||||
requestedGameNumber,
|
||||
);
|
||||
|
||||
const groups = groupRecordedSets(detail, competition.data);
|
||||
const groups = groupRecordedSets(detail);
|
||||
const group = groups.find(({ sets }) => sets.some(({ game }) => game === selectedGame));
|
||||
if (!selectedGame || !group) {
|
||||
const officialGame = detail.competition?.projection.games.find(
|
||||
(game) => game.displayNumber === requestedGameNumber,
|
||||
);
|
||||
if (officialGame) {
|
||||
const winner = detail.competition?.teams.find((team) => team.teamId === officialGame.winnerTeamId);
|
||||
return (
|
||||
<PlainPage>
|
||||
<EmptyNote
|
||||
title={officialGame.evidence.type === "legacy" ? "Riot 원본이 없는 과거 기록" : "상세 분석 준비 중"}
|
||||
description={`${officialGame.ordinal}세트 · ${winner?.name ?? "팀 미확인"} 승리`}
|
||||
action={<Btn to={backTarget.to}>{backTarget.label}</Btn>}
|
||||
/>
|
||||
</PlainPage>
|
||||
);
|
||||
}
|
||||
const hasRecordedGames = detail.games.length > 0;
|
||||
const requestedGameLabel =
|
||||
Number.isSafeInteger(requestedGameNumber) && requestedGameNumber > 0
|
||||
@@ -1805,38 +1835,39 @@ export default function MatchGameDetailPage() {
|
||||
navigationState={navigationState}
|
||||
/>
|
||||
|
||||
<PostgameBreakdown
|
||||
selectedGame={selectedGame}
|
||||
detail={detail}
|
||||
manifest={ddragon}
|
||||
/>
|
||||
|
||||
<TimelineGraph
|
||||
key={selectedGame.riotMatchId}
|
||||
selectedGame={selectedGame}
|
||||
detail={detail}
|
||||
manifest={ddragon}
|
||||
/>
|
||||
|
||||
<div className="mt-5 space-y-4">
|
||||
<InternalGameDetailTabBar
|
||||
activeTab={activeTab}
|
||||
onChange={setActiveTab}
|
||||
/>
|
||||
<InternalGameAnalysisPanel
|
||||
activeTab={activeTab}
|
||||
selectedGame={selectedGame}
|
||||
detail={detail}
|
||||
manifest={ddragon}
|
||||
scoreboard={
|
||||
<ScoreboardTables
|
||||
{!selectedGame.analysisAvailability || selectedGame.analysisAvailability === "available" ? (
|
||||
<>
|
||||
<PostgameBreakdown
|
||||
selectedGame={selectedGame}
|
||||
detail={detail}
|
||||
manifest={ddragon}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<TimelineGraph
|
||||
key={selectedGame.riotMatchId}
|
||||
selectedGame={selectedGame}
|
||||
detail={detail}
|
||||
manifest={ddragon}
|
||||
/>
|
||||
<div className="mt-5 space-y-4">
|
||||
<InternalGameDetailTabBar activeTab={activeTab} onChange={setActiveTab} />
|
||||
<InternalGameAnalysisPanel
|
||||
activeTab={activeTab}
|
||||
selectedGame={selectedGame}
|
||||
detail={detail}
|
||||
manifest={ddragon}
|
||||
scoreboard={
|
||||
<ScoreboardTables
|
||||
selectedGame={selectedGame}
|
||||
detail={detail}
|
||||
manifest={ddragon}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<BasicGameScoreboard game={selectedGame} teams={detail.match.teams} manifest={ddragon} />
|
||||
)}
|
||||
</PageBody>
|
||||
</>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user