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:
1 parent
3c60081ece
commit
3bd3120eb1
11 files changed
+382
-54
No files matched your search
@@ -0,0 +1,133 @@
|
|||||||
|
import type {
|
||||||
|
CommunityId,
|
||||||
|
CompetitionTeamView,
|
||||||
|
MatchId,
|
||||||
|
TeamId,
|
||||||
|
} from "@lolympus/contracts";
|
||||||
|
import { ChevronRight } from "lucide-react";
|
||||||
|
import { Link } from "react-router";
|
||||||
|
import {
|
||||||
|
competitionHistoryGameDetailPath,
|
||||||
|
formatCompetitionHistoryTime,
|
||||||
|
formatSeriesGameDuration,
|
||||||
|
type CompetitionSeriesHistoryRow,
|
||||||
|
} from "./competition-series-history";
|
||||||
|
|
||||||
|
export function CompetitionGameHistory({
|
||||||
|
games,
|
||||||
|
teamById,
|
||||||
|
communityId,
|
||||||
|
matchId,
|
||||||
|
historyBackTo,
|
||||||
|
}: {
|
||||||
|
games: CompetitionSeriesHistoryRow["games"];
|
||||||
|
teamById: ReadonlyMap<TeamId, CompetitionTeamView>;
|
||||||
|
communityId: CommunityId;
|
||||||
|
matchId: MatchId;
|
||||||
|
historyBackTo: string;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<ol className="border-t border-base-content/10 bg-base-content/[0.02] px-4 py-1">
|
||||||
|
{games.map((game) => {
|
||||||
|
const duration = formatSeriesGameDuration(game.durationSeconds);
|
||||||
|
const winnerName = teamById.get(game.winnerTeamId)?.name ?? "알 수 없는 팀";
|
||||||
|
const detailPath = competitionHistoryGameDetailPath(
|
||||||
|
communityId,
|
||||||
|
matchId,
|
||||||
|
game,
|
||||||
|
);
|
||||||
|
const content = (
|
||||||
|
<GameHistoryRowContent
|
||||||
|
game={game}
|
||||||
|
winnerName={winnerName}
|
||||||
|
duration={duration}
|
||||||
|
linked={detailPath !== null}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<li
|
||||||
|
key={game.id}
|
||||||
|
className="border-b border-base-content/8 last:border-b-0"
|
||||||
|
>
|
||||||
|
{detailPath ? (
|
||||||
|
<Link
|
||||||
|
to={detailPath}
|
||||||
|
state={{
|
||||||
|
backTo: historyBackTo,
|
||||||
|
backLabel: "경기 결과로 돌아가기",
|
||||||
|
}}
|
||||||
|
className="block min-h-11 border-l-2 border-l-transparent px-2 py-2 text-xs text-base-content transition-colors hover:border-l-primary hover:bg-primary/[0.06] active:bg-primary/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary motion-reduce:transition-none"
|
||||||
|
>
|
||||||
|
{content}
|
||||||
|
</Link>
|
||||||
|
) : (
|
||||||
|
<div className="min-h-11 border-l-2 border-l-transparent px-2 py-2 text-xs text-base-content">
|
||||||
|
{content}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</li>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</ol>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function GameHistoryRowContent({
|
||||||
|
game,
|
||||||
|
winnerName,
|
||||||
|
duration,
|
||||||
|
linked,
|
||||||
|
}: {
|
||||||
|
game: CompetitionSeriesHistoryRow["games"][number];
|
||||||
|
winnerName: string;
|
||||||
|
duration: string | null;
|
||||||
|
linked: boolean;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<span
|
||||||
|
className={
|
||||||
|
linked
|
||||||
|
? "grid grid-cols-[3.75rem_3.25rem_minmax(0,1fr)_3.5rem] items-center gap-2 md:grid-cols-[4.5rem_4rem_minmax(0,1fr)_4.5rem_6rem] md:gap-4"
|
||||||
|
: "grid grid-cols-[3.75rem_3.25rem_minmax(0,1fr)_3.5rem] items-center gap-2 md:grid-cols-[4.5rem_4rem_minmax(0,1fr)_4.5rem] md:gap-4"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<span className="font-bold text-content-muted">
|
||||||
|
Game {game.ordinal}
|
||||||
|
</span>
|
||||||
|
<time
|
||||||
|
dateTime={game.startedAt}
|
||||||
|
className="font-mono tabular-nums text-content-muted"
|
||||||
|
>
|
||||||
|
{formatCompetitionHistoryTime(game.startedAt) ?? "—"}
|
||||||
|
</time>
|
||||||
|
<span className="min-w-0 break-words font-semibold">
|
||||||
|
{winnerName} 승
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
className="text-right font-mono tabular-nums text-content-muted"
|
||||||
|
>
|
||||||
|
{duration ? (
|
||||||
|
<>
|
||||||
|
<span className="sr-only">경기 시간 </span>
|
||||||
|
{duration}
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<span aria-hidden="true">—</span>
|
||||||
|
<span className="sr-only">경기 시간 기록 없음</span>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
{linked && (
|
||||||
|
<span className="col-span-4 mt-1 flex items-center justify-end gap-0.5 font-bold text-content-subtle md:col-span-1 md:mt-0">
|
||||||
|
<span>상세 분석</span>
|
||||||
|
<ChevronRight
|
||||||
|
className="h-3.5 w-3.5 shrink-0 text-primary"
|
||||||
|
aria-hidden="true"
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -83,6 +83,8 @@ export function CompetitionResults({
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<CompetitionSeriesHistory
|
<CompetitionSeriesHistory
|
||||||
|
communityId={competition.communityId}
|
||||||
|
matchId={competition.matchId}
|
||||||
projection={projection}
|
projection={projection}
|
||||||
teamById={teamById}
|
teamById={teamById}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,34 +1,43 @@
|
|||||||
import type {
|
import type {
|
||||||
|
CommunityId,
|
||||||
CompetitionProjection,
|
CompetitionProjection,
|
||||||
CompetitionTeamView,
|
CompetitionTeamView,
|
||||||
|
MatchId,
|
||||||
TeamId,
|
TeamId,
|
||||||
} from "@lolympus/contracts";
|
} from "@lolympus/contracts";
|
||||||
import { ChevronDown } from "lucide-react";
|
import { ChevronDown } from "lucide-react";
|
||||||
|
import { useLocation } from "react-router";
|
||||||
import {
|
import {
|
||||||
createCompetitionSeriesHistory,
|
createCompetitionSeriesHistory,
|
||||||
formatCompetitionHistoryDate,
|
formatCompetitionHistoryDate,
|
||||||
formatCompetitionHistoryTime,
|
formatCompetitionHistoryTime,
|
||||||
formatSeriesGameDuration,
|
|
||||||
getSeriesHistoryStatusLabel,
|
getSeriesHistoryStatusLabel,
|
||||||
shouldDisplaySeriesHistoryScore,
|
shouldDisplaySeriesHistoryScore,
|
||||||
type CompetitionSeriesHistoryRow,
|
type CompetitionSeriesHistoryRow,
|
||||||
} from "./competition-series-history";
|
} from "./competition-series-history";
|
||||||
|
import { CompetitionGameHistory } from "./CompetitionGameHistory";
|
||||||
import { bracketRoundLabel } from "./double-elimination-bracket-layout";
|
import { bracketRoundLabel } from "./double-elimination-bracket-layout";
|
||||||
import { isSeriesEntryWinner } from "./series-score-card-model";
|
import { isSeriesEntryWinner } from "./series-score-card-model";
|
||||||
|
|
||||||
export function CompetitionSeriesHistory({
|
export function CompetitionSeriesHistory({
|
||||||
|
communityId,
|
||||||
|
matchId,
|
||||||
projection,
|
projection,
|
||||||
teamById,
|
teamById,
|
||||||
}: {
|
}: {
|
||||||
|
communityId: CommunityId;
|
||||||
|
matchId: MatchId;
|
||||||
projection: CompetitionProjection;
|
projection: CompetitionProjection;
|
||||||
teamById: ReadonlyMap<TeamId, CompetitionTeamView>;
|
teamById: ReadonlyMap<TeamId, CompetitionTeamView>;
|
||||||
}) {
|
}) {
|
||||||
|
const location = useLocation();
|
||||||
|
const historyBackTo = `${location.pathname}${location.search}${location.hash}`;
|
||||||
const history = createCompetitionSeriesHistory(projection);
|
const history = createCompetitionSeriesHistory(projection);
|
||||||
if (history.length === 0) return null;
|
if (history.length === 0) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section
|
<section
|
||||||
className="border border-base-content/10 bg-base-100"
|
className="competition-series-history border border-base-content/10 bg-base-100"
|
||||||
aria-labelledby="competition-series-history-heading"
|
aria-labelledby="competition-series-history-heading"
|
||||||
>
|
>
|
||||||
<header className="border-b border-base-content/10 px-4 py-3">
|
<header className="border-b border-base-content/10 px-4 py-3">
|
||||||
@@ -63,7 +72,13 @@ export function CompetitionSeriesHistory({
|
|||||||
<ol className="divide-y divide-base-content/10">
|
<ol className="divide-y divide-base-content/10">
|
||||||
{day.rows.map((row) => (
|
{day.rows.map((row) => (
|
||||||
<li key={row.series.seriesId}>
|
<li key={row.series.seriesId}>
|
||||||
<SeriesHistoryRow row={row} teamById={teamById} />
|
<SeriesHistoryRow
|
||||||
|
row={row}
|
||||||
|
teamById={teamById}
|
||||||
|
communityId={communityId}
|
||||||
|
matchId={matchId}
|
||||||
|
historyBackTo={historyBackTo}
|
||||||
|
/>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
</ol>
|
</ol>
|
||||||
@@ -78,9 +93,15 @@ export function CompetitionSeriesHistory({
|
|||||||
function SeriesHistoryRow({
|
function SeriesHistoryRow({
|
||||||
row,
|
row,
|
||||||
teamById,
|
teamById,
|
||||||
|
communityId,
|
||||||
|
matchId,
|
||||||
|
historyBackTo,
|
||||||
}: {
|
}: {
|
||||||
row: CompetitionSeriesHistoryRow;
|
row: CompetitionSeriesHistoryRow;
|
||||||
teamById: ReadonlyMap<TeamId, CompetitionTeamView>;
|
teamById: ReadonlyMap<TeamId, CompetitionTeamView>;
|
||||||
|
communityId: CommunityId;
|
||||||
|
matchId: MatchId;
|
||||||
|
historyBackTo: string;
|
||||||
}) {
|
}) {
|
||||||
if (row.games.length === 0) {
|
if (row.games.length === 0) {
|
||||||
return (
|
return (
|
||||||
@@ -90,10 +111,16 @@ function SeriesHistoryRow({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<details className="group">
|
<details className="group">
|
||||||
<summary className="list-none cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-base-content/70 [&::-webkit-details-marker]:hidden">
|
<summary className="list-none cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary [&::-webkit-details-marker]:hidden">
|
||||||
<SeriesSummary row={row} teamById={teamById} hasGameDetails />
|
<SeriesSummary row={row} teamById={teamById} hasGameDetails />
|
||||||
</summary>
|
</summary>
|
||||||
<GameHistory games={row.games} teamById={teamById} />
|
<CompetitionGameHistory
|
||||||
|
games={row.games}
|
||||||
|
teamById={teamById}
|
||||||
|
communityId={communityId}
|
||||||
|
matchId={matchId}
|
||||||
|
historyBackTo={historyBackTo}
|
||||||
|
/>
|
||||||
</details>
|
</details>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -144,7 +171,7 @@ function SeriesSummary({
|
|||||||
<span className="group-open:hidden">{row.games.length}게임 보기</span>
|
<span className="group-open:hidden">{row.games.length}게임 보기</span>
|
||||||
<span className="hidden group-open:inline">게임 접기</span>
|
<span className="hidden group-open:inline">게임 접기</span>
|
||||||
<ChevronDown
|
<ChevronDown
|
||||||
className="ml-1 h-4 w-4 transition-transform group-open:rotate-180 motion-reduce:transition-none"
|
className="ml-1 h-4 w-4 text-primary transition-transform group-open:rotate-180 motion-reduce:transition-none"
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
@@ -283,47 +310,6 @@ function TeamName({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function GameHistory({
|
|
||||||
games,
|
|
||||||
teamById,
|
|
||||||
}: {
|
|
||||||
games: CompetitionSeriesHistoryRow["games"];
|
|
||||||
teamById: ReadonlyMap<TeamId, CompetitionTeamView>;
|
|
||||||
}) {
|
|
||||||
return (
|
|
||||||
<ol className="border-t border-base-content/10 bg-base-content/[0.02] px-4 py-1">
|
|
||||||
{games.map((game) => {
|
|
||||||
const duration = formatSeriesGameDuration(game.durationSeconds);
|
|
||||||
return (
|
|
||||||
<li
|
|
||||||
key={game.id}
|
|
||||||
className="grid grid-cols-[3.75rem_3.25rem_minmax(0,1fr)_3.5rem] items-center gap-2 border-b border-base-content/8 py-2 text-xs last:border-b-0 md:grid-cols-[4.5rem_4rem_minmax(0,1fr)_4.5rem] md:gap-4"
|
|
||||||
>
|
|
||||||
<span className="font-bold text-content-muted">
|
|
||||||
Game {game.ordinal}
|
|
||||||
</span>
|
|
||||||
<time
|
|
||||||
dateTime={game.startedAt}
|
|
||||||
className="font-mono tabular-nums text-content-muted"
|
|
||||||
>
|
|
||||||
{formatCompetitionHistoryTime(game.startedAt) ?? "—"}
|
|
||||||
</time>
|
|
||||||
<span className="min-w-0 break-words font-semibold">
|
|
||||||
{teamName(game.winnerTeamId, teamById)} 승
|
|
||||||
</span>
|
|
||||||
<span
|
|
||||||
className="text-right font-mono tabular-nums text-content-muted"
|
|
||||||
aria-label={duration ? `경기 시간 ${duration}` : "경기 시간 기록 없음"}
|
|
||||||
>
|
|
||||||
{duration ?? "—"}
|
|
||||||
</span>
|
|
||||||
</li>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</ol>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function teamName(
|
function teamName(
|
||||||
teamId: TeamId,
|
teamId: TeamId,
|
||||||
teamById: ReadonlyMap<TeamId, CompetitionTeamView>,
|
teamById: ReadonlyMap<TeamId, CompetitionTeamView>,
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import type {
|
|||||||
IsoDateTime,
|
IsoDateTime,
|
||||||
SeriesProjection,
|
SeriesProjection,
|
||||||
} from "@lolympus/contracts";
|
} from "@lolympus/contracts";
|
||||||
|
import { internalMatchGamePath } from "../../lib/internal-match-routes.ts";
|
||||||
|
|
||||||
export type CompetitionSeriesHistorySeries = Extract<
|
export type CompetitionSeriesHistorySeries = Extract<
|
||||||
SeriesProjection,
|
SeriesProjection,
|
||||||
@@ -34,6 +35,17 @@ const KOREAN_WEEKDAYS = [
|
|||||||
"토",
|
"토",
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
|
export function competitionHistoryGameDetailPath(
|
||||||
|
communityId: string,
|
||||||
|
matchId: string,
|
||||||
|
game: Pick<CompetitionGameView, "displayNumber">,
|
||||||
|
): string | null {
|
||||||
|
if (!Number.isSafeInteger(game.displayNumber) || game.displayNumber <= 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return internalMatchGamePath(communityId, matchId, game.displayNumber);
|
||||||
|
}
|
||||||
|
|
||||||
export function createCompetitionSeriesHistory(
|
export function createCompetitionSeriesHistory(
|
||||||
projection: HistoryProjection,
|
projection: HistoryProjection,
|
||||||
timeZone = "Asia/Seoul",
|
timeZone = "Asia/Seoul",
|
||||||
|
|||||||
@@ -122,6 +122,12 @@ body {
|
|||||||
--color-base-300: oklch(95% 0 0); /* 구분선/보더 */
|
--color-base-300: oklch(95% 0 0); /* 구분선/보더 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 경기 결과 기록의 링크 강조는 양쪽 테마에서 같은 브랜드 코랄을 쓴다.
|
||||||
|
전역 dark primary는 유지해 다른 화면의 기존 색상 의미를 바꾸지 않는다. */
|
||||||
|
.competition-series-history {
|
||||||
|
--color-primary: oklch(0.708008 0.234375 24);
|
||||||
|
}
|
||||||
|
|
||||||
/* ── 실시간 입찰 피드백 모션 ──
|
/* ── 실시간 입찰 피드백 모션 ──
|
||||||
입찰가 갱신 시 pop(스케일 펄스), 내가 밀렸을 때 shake(주의 환기). */
|
입찰가 갱신 시 pop(스케일 펄스), 내가 밀렸을 때 shake(주의 환기). */
|
||||||
@keyframes lts-bid-pop {
|
@keyframes lts-bid-pop {
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
export function selectInternalMatchGame<T extends { gameNumber: number }>(
|
||||||
|
games: readonly T[],
|
||||||
|
requestedGameNumber: number,
|
||||||
|
): T | null {
|
||||||
|
if (
|
||||||
|
!Number.isSafeInteger(requestedGameNumber) ||
|
||||||
|
requestedGameNumber <= 0
|
||||||
|
) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
games.find((game) => game.gameNumber === requestedGameNumber) ?? null
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -28,6 +28,7 @@ import {
|
|||||||
internalMatchDetailPath,
|
internalMatchDetailPath,
|
||||||
internalMatchGamePath,
|
internalMatchGamePath,
|
||||||
} from "../lib/internal-match-routes";
|
} from "../lib/internal-match-routes";
|
||||||
|
import { selectInternalMatchGame } from "../lib/internal-match-game-selection";
|
||||||
import { LANE_LABELS } from "../lib/riot-history";
|
import { LANE_LABELS } from "../lib/riot-history";
|
||||||
import {
|
import {
|
||||||
filterTimelineEvents,
|
filterTimelineEvents,
|
||||||
@@ -1681,14 +1682,29 @@ export default function MatchGameDetailPage() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const selectedGame =
|
const selectedGame = selectInternalMatchGame(
|
||||||
detail.games.find((game) => game.gameNumber === requestedGameNumber) ??
|
detail.games,
|
||||||
detail.games[0];
|
requestedGameNumber,
|
||||||
|
);
|
||||||
|
|
||||||
if (!selectedGame) {
|
if (!selectedGame) {
|
||||||
|
const hasRecordedGames = detail.games.length > 0;
|
||||||
|
const requestedGameLabel =
|
||||||
|
Number.isSafeInteger(requestedGameNumber) && requestedGameNumber > 0
|
||||||
|
? `${requestedGameNumber}경기`
|
||||||
|
: "요청한 경기";
|
||||||
return (
|
return (
|
||||||
<main className="mx-auto max-w-6xl px-4 py-20 text-center">
|
<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
|
<Link
|
||||||
to={backTarget.to}
|
to={backTarget.to}
|
||||||
className="btn btn-ghost btn-sm mt-4"
|
className="btn btn-ghost btn-sm mt-4"
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import type {
|
|||||||
TeamId,
|
TeamId,
|
||||||
} from "@lolympus/contracts";
|
} from "@lolympus/contracts";
|
||||||
import {
|
import {
|
||||||
|
competitionHistoryGameDetailPath,
|
||||||
createCompetitionSeriesHistory,
|
createCompetitionSeriesHistory,
|
||||||
formatCompetitionHistoryDate,
|
formatCompetitionHistoryDate,
|
||||||
formatCompetitionHistoryTime,
|
formatCompetitionHistoryTime,
|
||||||
@@ -70,6 +71,40 @@ test("aggregates Games under their Series and preserves Series slot scores", ()
|
|||||||
assert.equal(history[0].rows[0].timestampSource, "game-start");
|
assert.equal(history[0].rows[0].timestampSource, "game-start");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("builds Game detail routes from global display numbers, not Series ordinals", () => {
|
||||||
|
const recordedGame = game({
|
||||||
|
id: "globally-numbered-game",
|
||||||
|
seriesId: seriesId("second-series"),
|
||||||
|
ordinal: 1,
|
||||||
|
displayNumber: 17,
|
||||||
|
blueTeamId: teamId("team-a"),
|
||||||
|
redTeamId: teamId("team-b"),
|
||||||
|
winnerTeamId: teamId("team-a"),
|
||||||
|
startedAt: "2026-07-13T09:00:00.000Z",
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.equal(
|
||||||
|
competitionHistoryGameDetailPath(
|
||||||
|
"community-1",
|
||||||
|
"match-1",
|
||||||
|
recordedGame,
|
||||||
|
),
|
||||||
|
"/communities/community-1/internal-stats/match/match-1/game/17",
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
competitionHistoryGameDetailPath("community-1", "match-1", {
|
||||||
|
displayNumber: 0,
|
||||||
|
}),
|
||||||
|
null,
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
competitionHistoryGameDetailPath("community-1", "match-1", {
|
||||||
|
displayNumber: 1.5,
|
||||||
|
}),
|
||||||
|
null,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
test("groups and orders Series by the Asia/Seoul calendar day", () => {
|
test("groups and orders Series by the Asia/Seoul calendar day", () => {
|
||||||
const firstDay = playedSeriesWithGame({
|
const firstDay = playedSeriesWithGame({
|
||||||
id: "first-day",
|
id: "first-day",
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import assert from "node:assert/strict";
|
||||||
|
import test from "node:test";
|
||||||
|
import { selectInternalMatchGame } from "../src/lib/internal-match-game-selection.ts";
|
||||||
|
|
||||||
|
test("selects only the Game explicitly requested by its global number", () => {
|
||||||
|
const firstGame = { gameNumber: 1, id: "first" };
|
||||||
|
const requestedGame = { gameNumber: 17, id: "requested" };
|
||||||
|
const games = [firstGame, requestedGame];
|
||||||
|
|
||||||
|
assert.equal(selectInternalMatchGame(games, 17), requestedGame);
|
||||||
|
assert.equal(selectInternalMatchGame(games, 99), null);
|
||||||
|
assert.equal(selectInternalMatchGame(games, Number.NaN), null);
|
||||||
|
});
|
||||||
@@ -108,6 +108,84 @@ and preserve all current Competition/API contracts.
|
|||||||
- [x] Git diff contains only the feature spec, plan, tests, model, and UI integration.
|
- [x] Git diff contains only the feature spec, plan, tests, model, and UI integration.
|
||||||
- [x] Unrelated working-tree files are unchanged.
|
- [x] Unrelated working-tree files are unchanged.
|
||||||
|
|
||||||
|
### Phase 3: Game Detail Navigation
|
||||||
|
|
||||||
|
#### Task 5: Specify the canonical Game route test-first
|
||||||
|
|
||||||
|
**Acceptance criteria:**
|
||||||
|
|
||||||
|
- [x] A Game whose `ordinal` and `displayNumber` differ links with
|
||||||
|
`displayNumber`.
|
||||||
|
- [x] Non-positive or non-integer legacy display numbers do not produce a broken
|
||||||
|
detail link.
|
||||||
|
- [x] The focused test is observed failing before the route adapter exists.
|
||||||
|
|
||||||
|
**Verification:**
|
||||||
|
|
||||||
|
- [x] Run the focused Node test for RED and GREEN states.
|
||||||
|
|
||||||
|
**Files likely touched:**
|
||||||
|
|
||||||
|
- `apps/web/test/competition-series-history.test.ts`
|
||||||
|
- `apps/web/src/components/competition/competition-series-history.ts`
|
||||||
|
|
||||||
|
#### Task 6: Make disclosed Game rows navigable
|
||||||
|
|
||||||
|
**Acceptance criteria:**
|
||||||
|
|
||||||
|
- [x] The full Game row is one React Router link with an always-visible detail cue.
|
||||||
|
- [x] The link carries the current Competition location as `backTo` and a Korean
|
||||||
|
return label.
|
||||||
|
- [x] Mobile targets are at least 44px high; keyboard focus is visible; hover and
|
||||||
|
active states use restrained semantic-primary coral accents.
|
||||||
|
- [x] The scoped primary token keeps that coral accent in both themes without a
|
||||||
|
global dark-theme color migration.
|
||||||
|
- [x] Winner, score, and status colors retain their existing domain meaning.
|
||||||
|
|
||||||
|
**Verification:**
|
||||||
|
|
||||||
|
- [x] Focused and full web tests pass.
|
||||||
|
- [x] Changed-file ESLint and the production web build pass.
|
||||||
|
- [x] Independent review checks route identity, interaction semantics, accessibility,
|
||||||
|
and unrelated working-tree preservation.
|
||||||
|
|
||||||
|
**Files likely touched:**
|
||||||
|
|
||||||
|
- `apps/web/src/components/competition/CompetitionGameHistory.tsx`
|
||||||
|
- `apps/web/src/components/competition/CompetitionSeriesHistory.tsx`
|
||||||
|
- `apps/web/src/components/competition/CompetitionResults.tsx`
|
||||||
|
|
||||||
|
#### Task 7: Refuse incorrect Game-detail fallbacks
|
||||||
|
|
||||||
|
**Acceptance criteria:**
|
||||||
|
|
||||||
|
- [x] Exact requested Game numbers resolve to that Game.
|
||||||
|
- [x] Missing or invalid requested Game numbers return no selection instead of the
|
||||||
|
first Game.
|
||||||
|
- [x] The detail page renders an explicit missing-Game state with the preserved return
|
||||||
|
target.
|
||||||
|
- [x] The policy is covered by an observed RED→GREEN pure regression test.
|
||||||
|
|
||||||
|
**Verification:**
|
||||||
|
|
||||||
|
- [x] Focused selection tests, full web tests, changed-file ESLint, and build pass.
|
||||||
|
|
||||||
|
**Files likely touched:**
|
||||||
|
|
||||||
|
- `apps/web/src/lib/internal-match-game-selection.ts`
|
||||||
|
- `apps/web/src/pages/MatchGameDetailPage.tsx`
|
||||||
|
- `apps/web/test/internal-match-game-selection.test.ts`
|
||||||
|
|
||||||
|
### Checkpoint: Navigable Game History
|
||||||
|
|
||||||
|
- [x] Every valid recorded Game opens its own internal-stat detail view.
|
||||||
|
- [x] Browser back and the detail page return link restore the Competition result
|
||||||
|
page.
|
||||||
|
- [x] Invalid legacy route data degrades to a non-clickable row instead of a wrong
|
||||||
|
destination.
|
||||||
|
- [x] A stale detail payload cannot substitute a different Game for the requested
|
||||||
|
route.
|
||||||
|
|
||||||
## Risks and Mitigations
|
## Risks and Mitigations
|
||||||
|
|
||||||
| Risk | Impact | Mitigation |
|
| Risk | Impact | Mitigation |
|
||||||
@@ -117,6 +195,8 @@ and preserve all current Competition/API contracts.
|
|||||||
| KST day changes by deploy environment | Medium | Use explicit `Intl.DateTimeFormat` timezone and boundary tests. |
|
| KST day changes by deploy environment | Medium | Use explicit `Intl.DateTimeFormat` timezone and boundary tests. |
|
||||||
| Long team names break mobile rows | Medium | Use balanced minmax columns and allow wrapping. |
|
| Long team names break mobile rows | Medium | Use balanced minmax columns and allow wrapping. |
|
||||||
| Existing dirty work is overwritten | High | Restrict patches and verification to named feature files. |
|
| Existing dirty work is overwritten | High | Restrict patches and verification to named feature files. |
|
||||||
|
| Series-local ordinal opens another Series' Game | High | Generate routes only from tested global `displayNumber`. |
|
||||||
|
| Coral is mistaken for the winning side | Medium | Restrict primary color to interaction edges, focus, and arrows. |
|
||||||
|
|
||||||
## Open Questions
|
## Open Questions
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,16 @@ times, venues, replay links, or team logos.
|
|||||||
- Group and format dates explicitly in `Asia/Seoul`.
|
- Group and format dates explicitly in `Asia/Seoul`.
|
||||||
- Keep individual Games in a native, keyboard-accessible disclosure below the Series
|
- Keep individual Games in a native, keyboard-accessible disclosure below the Series
|
||||||
row.
|
row.
|
||||||
|
- Make each disclosed Game row a real link to its internal-stat Game detail. Keep the
|
||||||
|
visible Series-local `ordinal`, but build the route from the globally unique
|
||||||
|
`displayNumber`.
|
||||||
|
- Preserve the current Competition page path in router state so the detail page can
|
||||||
|
return users to the same result view.
|
||||||
|
- Use the coral semantic primary token as an interaction cue on Game links (leading
|
||||||
|
edge, focus ring, subtle state background, and arrow), not as a winner or score
|
||||||
|
color.
|
||||||
|
- Scope that primary override to the result-history section so the exact coral remains
|
||||||
|
consistent in light and dark themes without changing unrelated dark-theme actions.
|
||||||
|
|
||||||
## Tech Stack
|
## Tech Stack
|
||||||
|
|
||||||
@@ -48,9 +58,13 @@ times, venues, replay links, or team logos.
|
|||||||
- `apps/web/src/components/competition/competition-series-history.ts` derives the
|
- `apps/web/src/components/competition/competition-series-history.ts` derives the
|
||||||
stable, timezone-aware history view model without React.
|
stable, timezone-aware history view model without React.
|
||||||
- `apps/web/src/components/competition/CompetitionSeriesHistory.tsx` renders the
|
- `apps/web/src/components/competition/CompetitionSeriesHistory.tsx` renders the
|
||||||
semantic date sections, responsive Series rows, and Game disclosures.
|
semantic date sections and responsive Series rows.
|
||||||
|
- `apps/web/src/components/competition/CompetitionGameHistory.tsx` renders the
|
||||||
|
disclosed, navigable Game rows and their responsive interaction states.
|
||||||
- `apps/web/src/components/competition/CompetitionResults.tsx` replaces the existing
|
- `apps/web/src/components/competition/CompetitionResults.tsx` replaces the existing
|
||||||
completed-Game card grid with the new component.
|
completed-Game card grid with the new component and supplies the route context.
|
||||||
|
- `apps/web/src/lib/internal-match-game-selection.ts` keeps explicit Game-detail
|
||||||
|
routes from silently falling back to a different recorded Game.
|
||||||
- `apps/web/test/competition-series-history.test.ts` specifies aggregation, ordering,
|
- `apps/web/test/competition-series-history.test.ts` specifies aggregation, ordering,
|
||||||
outcome, and formatting behavior.
|
outcome, and formatting behavior.
|
||||||
|
|
||||||
@@ -84,6 +98,10 @@ Develop the pure model test-first. Cover:
|
|||||||
- exclusion of unstarted and orphan data;
|
- exclusion of unstarted and orphan data;
|
||||||
- played, draw, walkover, forfeit, and administrative status semantics;
|
- played, draw, walkover, forfeit, and administrative status semantics;
|
||||||
- deterministic tie-breaking and legacy zero-duration formatting.
|
- deterministic tie-breaking and legacy zero-duration formatting.
|
||||||
|
- Game-detail route generation from `displayNumber`, including rejection of invalid
|
||||||
|
legacy display numbers.
|
||||||
|
- Exact internal Game selection, including a missing-result case when the requested
|
||||||
|
display number is absent from a stale or legacy detail payload.
|
||||||
|
|
||||||
After unit tests, run full web tests, changed-file lint, and the TypeScript/Vite build.
|
After unit tests, run full web tests, changed-file lint, and the TypeScript/Vite build.
|
||||||
Review the markup for native keyboard interaction, heading order, visible status text,
|
Review the markup for native keyboard interaction, heading order, visible status text,
|
||||||
@@ -97,6 +115,12 @@ and mobile layouts down to 320px.
|
|||||||
winner; never infer identity from score, array position, or blue/red side.
|
winner; never infer identity from score, array position, or blue/red side.
|
||||||
- Keep game-less adjudications visible without presenting `0 : 0` as a played score.
|
- Keep game-less adjudications visible without presenting `0 : 0` as a played score.
|
||||||
- Omit `durationSeconds === 0` because it represents missing legacy data.
|
- Omit `durationSeconds === 0` because it represents missing legacy data.
|
||||||
|
- Use `displayNumber`, never Series-local `ordinal`, for the internal Game URL.
|
||||||
|
- Keep each Game row as one semantic anchor with no nested interactive control.
|
||||||
|
- Keep link text readable in both themes; coral may indicate interaction but must not
|
||||||
|
be the only visible cue.
|
||||||
|
- Never substitute another Game when the Game number explicitly requested by the URL
|
||||||
|
is not present in the internal-stat payload.
|
||||||
- Preserve all unrelated working-tree changes.
|
- Preserve all unrelated working-tree changes.
|
||||||
|
|
||||||
### Ask First
|
### Ask First
|
||||||
@@ -123,7 +147,14 @@ and mobile layouts down to 320px.
|
|||||||
timezone.
|
timezone.
|
||||||
- The layout is readable without horizontal scrolling at 320px and uses the wider
|
- The layout is readable without horizontal scrolling at 320px and uses the wider
|
||||||
double-elimination page naturally on desktop.
|
double-elimination page naturally on desktop.
|
||||||
- Focused/full tests, lint, and web build pass without modifying unrelated work.
|
- Each recorded Game can be opened by pointer or keyboard, lands on its matching
|
||||||
|
internal-stat Game, and provides a return link to the Competition result page.
|
||||||
|
- A temporarily stale or inconsistent detail payload shows an explicit missing-Game
|
||||||
|
state rather than silently rendering the first Game.
|
||||||
|
- Game rows expose an always-visible detail cue and coral hover, active, and focus
|
||||||
|
affordances without changing winner semantics.
|
||||||
|
- Focused/full tests, changed-file lint, and web build pass without modifying
|
||||||
|
unrelated work.
|
||||||
|
|
||||||
## Open Questions
|
## Open Questions
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user