4.1 KiB
4.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.seriesandprojection.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/summarydisclosure for Game history and omit it when a Series has no Games. - Extract the new UI from
CompetitionResults.tsxso 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.tsapps/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.tsxapps/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.
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. |
Open Questions
None.