Files
lolympus-tournament-support/docs/plans/86-series-result-history-ui.md
T
dahyeon 3bd3120eb1 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.
2026-07-13 10:41:44 +00:00

7.1 KiB

Implementation Plan: Series Result History UI

Overview

Replace the existing completed-Game mini-card grid with a tested chronological Series result history. Keep data derivation pure, render responsive semantic rows, and preserve all current Competition/API contracts.

Architecture Decisions

  • Derive a local view model from projection.series and projection.games; no API or persistence change is required.
  • Anchor a played Series to its earliest accepted Game start. Anchor a game-less completed decision to its decision time only for grouping and sorting.
  • Keep the original narrowed Series and Game objects in each row so the UI does not duplicate domain state or collapse outcome semantics.
  • Use a native details/summary disclosure for Game history and omit it when a Series has no Games.
  • Extract the new UI from CompetitionResults.tsx so the format selector remains focused.

Task List

Phase 1: Result-History Contract

Task 1: Specify aggregation and chronology test-first

Acceptance criteria:

  • Tests cover Series aggregation, ordinal Game order, KST date boundaries, chronological order, outcome variants, and deterministic fallbacks.
  • The focused test fails because the model module does not yet exist.

Verification:

  • Run the focused Node test and record the expected RED failure.

Files likely touched:

  • apps/web/test/competition-series-history.test.ts

Task 2: Implement the pure history model

Acceptance criteria:

  • Only recorded in-progress and completed Series are returned.
  • Date grouping and format helpers are explicitly KST-aware.
  • Decision outcomes and missing legacy durations remain distinguishable.

Verification:

  • Focused history tests pass.
  • Existing web tests still pass.

Files likely touched:

  • apps/web/src/components/competition/competition-series-history.ts
  • apps/web/test/competition-series-history.test.ts

Checkpoint: Model

  • Pure tests pass without a React or browser dependency.

Phase 2: Responsive Result UI

Task 3: Render date sections and Series rows

Acceptance criteria:

  • Desktop uses a flat schedule-like row; mobile stacks metadata and matchup without horizontal scrolling.
  • Status and official winner are communicated with visible text and typography, not color alone.
  • Game-less decisions do not show fake start times or 0 : 0.

Verification:

  • Changed component files pass ESLint.
  • Web build succeeds.

Files likely touched:

  • apps/web/src/components/competition/CompetitionSeriesHistory.tsx

Task 4: Integrate accessible Game disclosures

Acceptance criteria:

  • Each Series with Games exposes a native keyboard-operable disclosure.
  • Games use Series-local ordinal, team-ID winner lookup, and omit unknown zero-duration values.
  • The old completed-Game mini-card block is removed.

Verification:

  • Full web tests, changed-file lint, and build pass. Repository-wide lint remains blocked by pre-existing errors outside this change.
  • Source review checks heading order, disclosure semantics, and 320px layout.

Files likely touched:

  • apps/web/src/components/competition/CompetitionSeriesHistory.tsx
  • apps/web/src/components/competition/CompetitionResults.tsx

Checkpoint: Complete

  • All specification success criteria are met.
  • Git diff contains only the feature spec, plan, tests, model, and UI integration.
  • Unrelated working-tree files are unchanged.

Phase 3: Game Detail Navigation

Task 5: Specify the canonical Game route test-first

Acceptance criteria:

  • A Game whose ordinal and displayNumber differ links with displayNumber.
  • Non-positive or non-integer legacy display numbers do not produce a broken detail link.
  • The focused test is observed failing before the route adapter exists.

Verification:

  • 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:

  • The full Game row is one React Router link with an always-visible detail cue.
  • The link carries the current Competition location as backTo and a Korean return label.
  • Mobile targets are at least 44px high; keyboard focus is visible; hover and active states use restrained semantic-primary coral accents.
  • The scoped primary token keeps that coral accent in both themes without a global dark-theme color migration.
  • Winner, score, and status colors retain their existing domain meaning.

Verification:

  • Focused and full web tests pass.
  • Changed-file ESLint and the production web build pass.
  • 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:

  • Exact requested Game numbers resolve to that Game.
  • Missing or invalid requested Game numbers return no selection instead of the first Game.
  • The detail page renders an explicit missing-Game state with the preserved return target.
  • The policy is covered by an observed RED→GREEN pure regression test.

Verification:

  • 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

  • Every valid recorded Game opens its own internal-stat detail view.
  • Browser back and the detail page return link restore the Competition result page.
  • Invalid legacy route data degrades to a non-clickable row instead of a wrong destination.
  • A stale detail payload cannot substitute a different Game for the requested route.

Risks and Mitigations

Risk Impact Mitigation
Game sides are mistaken for Series slots High Use Series A/B entries and outcome team IDs; test side swaps.
Completion time is shown as start time Medium Track timestamp source and render a blank time for decisions.
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.
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

None.