Files
box-box/documentations/refactor/claude-phase-8-analytics-visuals-prompt.md

89 lines
2.4 KiB
Markdown
Raw Normal View History

2026-05-25 02:04:16 -04:00
# Prompt For Claude: Phase 8 Analytics Visuals
2026-05-25 02:06:08 -04:00
You are the frontend/UI engineer for Phase 8 of `box-box`. Please keep context
usage low: do not read the whole refactor docs folder. Start with the files
listed below and only open more if you are blocked.
2026-05-25 02:04:16 -04:00
2026-05-25 02:06:08 -04:00
## Goal
2026-05-25 02:04:16 -04:00
2026-05-25 02:06:08 -04:00
Turn the Race Hub Strategy and Position tabs from placeholders into real views
powered by the local-first `/api/v1/race-hub` response.
## Read First
Open only these first:
- `frontend/src/pages/RaceHubPage.tsx`
- `frontend/src/components/StrategyView.tsx`
- `frontend/src/components/PositionEvolutionView.tsx`
- `frontend/src/types.ts`
- `tests/race-hub.spec.ts`
- `scripts/seed-e2e-db/main.go`
Optional, only if you need design guidance:
2026-05-25 02:04:16 -04:00
- `documentations/refactor/16-phase-8-analytics-visuals.md`
- `documentations/refactor/06-visual-design-direction.md`
2026-05-25 02:06:08 -04:00
## Current Backend Contract
`RaceHub` already includes these arrays:
2026-05-25 02:04:16 -04:00
- `stints`
- `pit_stops`
- `positions`
- `race_control`
- `weather`
- `laps`
2026-05-25 02:06:08 -04:00
Dataset availability is still reported under `datasets`.
2026-05-25 02:04:16 -04:00
2026-05-25 02:06:08 -04:00
Seeded e2e sessions:
2026-05-25 02:04:16 -04:00
2026-05-25 02:06:08 -04:00
- `9472`: has core data plus analytics data.
- `9000`: has core data only, so missing-data states must still render.
2026-05-25 02:04:16 -04:00
2026-05-25 02:06:08 -04:00
## Work To Do
2026-05-25 02:04:16 -04:00
2026-05-25 02:06:08 -04:00
1. Update `RaceHubPage.tsx` to pass analytics arrays into the Strategy and
Position components.
2. Replace `"Strategy chart: not yet implemented."` with a real strategy view:
per-driver stint bars, compound labels/colors, lap ranges, and pit context.
3. Replace `"Position evolution chart: not yet implemented."` with a real
position view: per-driver progression from `positions`, plus grid/finish
context when available.
4. Preserve honest missing-data states for sessions without analytics.
5. Update tests so they assert real analytics UI for session `9472`, not
placeholder text.
2026-05-25 02:04:16 -04:00
2026-05-25 02:06:08 -04:00
## Design Constraints
2026-05-25 02:04:16 -04:00
2026-05-25 02:06:08 -04:00
- Keep it dense, technical, and F1-native.
- Use SVG/CSS for this first slice unless a dependency is truly necessary.
- Team color identifies drivers; compound color identifies tyre data.
- Avoid generic dashboard card sludge, decorative gradients, and fake runtime
mock data.
- Keep mobile/iPad usable.
2026-05-25 02:04:16 -04:00
## Verification
Run:
```bash
2026-05-25 02:06:08 -04:00
cd frontend && npm test -- --run
cd frontend && npm run build
npm run test:e2e
2026-05-25 02:04:16 -04:00
```
2026-05-25 02:06:08 -04:00
The root e2e command starts a seeded local database and local web/API servers.
It should not need OpenF1 network access.
2026-05-25 02:04:16 -04:00
2026-05-25 02:06:08 -04:00
## Report Back
2026-05-25 02:04:16 -04:00
2026-05-25 02:06:08 -04:00
Summarize:
2026-05-25 02:04:16 -04:00
- files changed;
2026-05-25 02:06:08 -04:00
- UI behavior added;
2026-05-25 02:04:16 -04:00
- tests run and results;
2026-05-25 02:06:08 -04:00
- follow-up risks or refinements.