Skip to content

Frontend Chart Refactor#130

Merged
bamarler merged 6 commits intomainfrom
124-use-lucide-info-card-instead-of-custom-svg
Apr 4, 2026
Merged

Frontend Chart Refactor#130
bamarler merged 6 commits intomainfrom
124-use-lucide-info-card-instead-of-custom-svg

Conversation

@bamarler
Copy link
Copy Markdown
Collaborator

@bamarler bamarler commented Apr 4, 2026

Summary

Closes #124

What changed:
Refactored the frontend chart system so every chart and KPI component is fully self-contained.

Why:
Charts were externally wrapped with card divs, titles, and info tooltips by parent pages, leading to inconsistent presentation and tight coupling. Hook return names were generic (data, isLoading) instead of descriptive. File organization was flat and hard to navigate.

Technical decisions worth noting:

  • Created ChartCard wrapper with optional headerRight slot for inline KPIs (e.g. Mean GCT badge next to chart title).
  • VisualizationConfig simplified from { title, description, component } to just ComponentType<ChartProps> since charts own their metadata.
  • Bar chart Y-axis domains use computed padding (20% below min, 10% above max) instead of domain={["auto", "auto"]} so minimum bars are visible and maximums don't clip.
  • Hook return names follow {noun} / {noun}IsLoading / {noun}Error / {noun}Refetch pattern matching the existing athlete hooks.
  • useLROverlayData is called in both GroundContactTimeChart and LROverlayLineChart — TanStack Query deduplicates the request via shared query key.
  • Merged useCreateAthlete into useAthletes.hooks.ts. Renamed hook files for .hooks.ts consistency.
  • GraphInfoCard uses lucide Info icon with click-outside-to-close for mobile support.

AI disclosure: All changes were AI-assisted (Claude Code). Architecture decisions and corrections were user-directed.


Screenshot

image image image

Notes

  • File moves: shared chart utilities → charts/shared/, universal charts → charts/universal/, history charts → charts/history/, reaction_time/reaction-time/, QueryError/QueryLoadingui/
  • Mean GCT/FT/RSI KPIs migrated from VisualizationsPage into their respective chart components
  • VisualizationsPage simplified — no more double-wrapping or external mean computation

@bamarler bamarler linked an issue Apr 4, 2026 that may be closed by this pull request
@bamarler bamarler merged commit 2643f75 into main Apr 4, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use Lucide info card instead of custom SVG

1 participant