feat: link competition games to detail analysis

Route each result-history Game by its global display number and preserve the Competition return target. Refuse stale detail fallbacks so a missing requested Game cannot silently show another Game.
This commit is contained in:
dahyeon committed 2026-07-13 10:41:44 +00:00
1 parent 3c60081ece
commit 3bd3120eb1
11 files changed
+382 -54

No files matched your search

+20 -4
View File
@@ -28,6 +28,7 @@ import {
internalMatchDetailPath,
internalMatchGamePath,
} from "../lib/internal-match-routes";
import { selectInternalMatchGame } from "../lib/internal-match-game-selection";
import { LANE_LABELS } from "../lib/riot-history";
import {
filterTimelineEvents,
@@ -1681,14 +1682,29 @@ export default function MatchGameDetailPage() {
);
}
const selectedGame =
detail.games.find((game) => game.gameNumber === requestedGameNumber) ??
detail.games[0];
const selectedGame = selectInternalMatchGame(
detail.games,
requestedGameNumber,
);
if (!selectedGame) {
const hasRecordedGames = detail.games.length > 0;
const requestedGameLabel =
Number.isSafeInteger(requestedGameNumber) && requestedGameNumber > 0
? `${requestedGameNumber}경기`
: "요청한 경기";
return (
<main className="mx-auto max-w-6xl px-4 py-20 text-center">
<h1 className="text-lg font-bold">수집된 세트 기록이 없습니다</h1>
<h1 className="text-lg font-bold">
{hasRecordedGames
? "해당 경기 기록을 찾을 수 없습니다"
: "수집된 세트 기록이 없습니다"}
</h1>
{hasRecordedGames && (
<p className="mt-2 text-sm text-content-muted">
{requestedGameLabel}가 현재 상세 기록에 없습니다.
</p>
)}
<Link
to={backTarget.to}
className="btn btn-ghost btn-sm mt-4"