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

+80
View File
@@ -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] 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
| 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. |
| 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
+34 -3
View File
@@ -27,6 +27,16 @@ times, venues, replay links, or team logos.
- Group and format dates explicitly in `Asia/Seoul`.
- Keep individual Games in a native, keyboard-accessible disclosure below the Series
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
@@ -48,9 +58,13 @@ times, venues, replay links, or team logos.
- `apps/web/src/components/competition/competition-series-history.ts` derives the
stable, timezone-aware history view model without React.
- `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
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,
outcome, and formatting behavior.
@@ -84,6 +98,10 @@ Develop the pure model test-first. Cover:
- exclusion of unstarted and orphan data;
- played, draw, walkover, forfeit, and administrative status semantics;
- 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.
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.
- Keep game-less adjudications visible without presenting `0 : 0` as a played score.
- 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.
### Ask First
@@ -123,7 +147,14 @@ and mobile layouts down to 320px.
timezone.
- The layout is readable without horizontal scrolling at 320px and uses the wider
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