fix(fairway): stats cockpit readability — stretch, tone, consolidate, slim - #934
fix(fairway): stats cockpit readability — stretch, tone, consolidate, slim#934njrini99-code wants to merge 1 commit into
Conversation
… slim Fixes #921. Four findings on FairwayStatsCockpit.tsx and its card primitives: 1. DetailGrid didn't stretch in grid rows, causing uneven card bottoms. DetailGridShell now applies h-full + flex-1 on the bordered Surface so cards in the same row equalize. The Approach tab's "By lie" 2-row vs 8-row Efficiency pair gets an internal max-height + scroll instead of blowing the row out. 2. Values rendered colorless. Added a tone system (good/warn/neutral, text-fw-success/text-fw-warning, never red) to DetailRow, DetailGrid, TeeMissByClub, and GirByDistanceBoard. Tone is derived from a real PGA Tour baseline (via the already-fetched player standing rows) wherever the v3 metric registry has a matching metric — scrambling by lie, putt make% bands, putt miss bias — and falls back to an honest relative read across a board's own values (GIR by distance) or a self-referential symmetry threshold (tee miss L/R) where no external baseline exists. Never fabricated; stays neutral when no comparison is available. 3. Consolidated triplicated primitives: RoundsReadout/FairwaysReadout/ GirReadout/PuttsReadout folded into the existing HeadlineReadout (now accepts an optional delta). TeeMissByClub and GirByDistanceBoard's hand-rolled title+Surface wrappers folded into a shared DetailGridShell alongside DetailGrid itself. 4. The Analysis tab's "Full shot detail" disclosure re-rendered ~17 DetailGrids the metric tabs already substantially owned. Exact duplicates (GIR by hole type/distance, putting headline/make-bands) were dropped; grids with no other home moved onto their owning tab (GIR-by-lie + approach proximity onto Approach, miss-direction + by-break overview onto Putting, scoring detail onto the Scoring tab). What remains in Analysis is a genuine summary (personal bests, 30-day trend) plus quick-nav buttons to the tabs that now own the rest. Gates: tsc --noEmit clean, eslint clean, vitest (24 files / 352 tests in src/components/fairway/pages/coachhelm/) all green. Added FairwayStatsCockpit.test.ts covering the three new tone helpers (toneVsBenchmark, relativeTones, skewTone). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MMdviLDsAg2YYJ8adsM6fg
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Warning Review limit reached
Next review available in: 33 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
🤖 Mission Control — PR summary What it changes: Readability pass on Area: GolfHelm / Fairway stats. Risk / reviewers watch:
CI: 4 required gates green. CodeRabbit advisory + |
Problem
Four readability findings on
FairwayStatsCockpit.tsxand its card primitives (#921):DetailGrid(used 25+ times) didn't stretch inside its grid row, so bordered cards in the same row trailed off at different heights. The Approach tab's "By lie" pairing was especially bad: a 2-row grid next to an 8-row Efficiency grid.RoundsReadout/FairwaysReadout/GirReadout/PuttsReadoutwere four near-identical hand-rolledInstrumentPanel+Readoutwrappers;TeeMissByClubandGirByDistanceBoardeach hand-rolled DetailGrid's own title+Surface chrome instead of reusing it.docs/fairway-stats-redesign-plan.md(the approved design spec for this surface) is silent on all four — it's scoped to engine fields and premium visuals — so each fix below documents the fallback taken.Fix
1. Stretch/equalize. Extracted a shared
DetailGridShell(title/hint header + borderedSurface) that appliesh-fullon the wrapper andflex-1on the Surface, so every DetailGrid-family card now stretches to fill its grid row and bottoms align. For the Approach tab's "By lie" 2-row vs 8-row Efficiency pair specifically (doc silent → internal max-height+scroll per the task's fallback),DetailGridgained an opt-inscrollableprop that caps the taller grid at a fixed height with its own scroll instead of blowing the row out.2. Tone system.
DetailRowgained an optionaltone?: 'good' | 'warn' | 'neutral', rendered viatext-fw-success/text-fw-warning(never red — mirrors StandingStrip's existing "ONE behind-benchmark hue" rule) tinting only the value text. Tone is derived two ways, always from real data, never fabricated:toneVsBenchmark(value, benchmark, direction)— compares a value against a genuine PGA-Tour standard pulled from the already-fetched player standing rows (v3 metric registry), wired wherever a DetailGrid row's quantity has an exact registry counterpart: scrambling-by-lie, putt make-% bands (3-5/5-10/10-15/15-25/25+ft — the engine's finer 9-way split reuses the matching coarser registry band), and putt miss-bias (left/right/high/low).relativeTones(values)— a self-referential "biggest gain / biggest leak" read across a board's own values (same idea the SG tab already uses across categories), applied toGirByDistanceBoardsince no per-band GIR baseline exists anywhere in the fetched data.skewTone(sharePct)— a fixed 50%-symmetry threshold forTeeMissByClub's L/R split, since no external benchmark exists for which way a miss "should" lean. Never reads'good'— a missed fairway is never a positive outcome.3. Consolidation (behavior-preserving).
RoundsReadout/FairwaysReadout/GirReadout/PuttsReadoutfolded into the existingHeadlineReadout(extended with an optionaldeltaprop); the Vitals JSX now callsHeadlineReadoutdirectly with locals computed once.TeeMissByClubandGirByDistanceBoardnow mount into the sharedDetailGridShellinstead of hand-rolling their own title+Surface wrapper.4. Slim Analysis tab. Of the ~17 DetailGrids in the old disclosure: exact duplicates (GIR by hole type/distance, putting headline/make-bands) were dropped; grids with no other home moved onto their owning tab — GIR-by-lie + full approach proximity breakdown onto Approach, overall miss-direction + by-break overview onto Putting, round/career/streak detail onto Scoring (a tab literally named Scoring that previously had none). What's left in Analysis is a genuine summary — personal bests, 30-day trend — plus quick-nav buttons (
handleTabChange) to the tabs that now own the rest.Gates
npx tsc --noEmit -p tsconfig.json— cleannpx eslint src/components/fairway/pages/coachhelm/FairwayStatsCockpit.tsx src/components/fairway/pages/coachhelm/FairwayStatsCockpit.test.ts— cleannpx vitest run src/components/fairway/pages/coachhelm/— 24 files / 352 tests, all green (newFairwayStatsCockpit.test.tscoverstoneVsBenchmark/relativeTones/skewTone)npm run build/ browser automation per repo policy (verified via tsc/eslint/vitest only)Files changed
src/components/fairway/pages/coachhelm/FairwayStatsCockpit.tsxsrc/components/fairway/pages/coachhelm/FairwayStatsCockpit.test.ts(new)Fixes #921
🤖 Generated with Claude Code
https://claude.ai/code/session_01MMdviLDsAg2YYJ8adsM6fg