Skip to content

Split activity-charts.tsx into per-chart component files - #913

Merged
selfcontained merged 1 commit into
mainfrom
agt_784fb88d8a6f/job-componentizer-9d5fc479
Aug 9, 2026
Merged

Split activity-charts.tsx into per-chart component files#913
selfcontained merged 1 commit into
mainfrom
agt_784fb88d8a6f/job-componentizer-9d5fc479

Conversation

@selfcontained

Copy link
Copy Markdown
Owner

What

apps/web/src/components/app/activity-charts.tsx was a 493-line compound-component file: four independently-exported components, two chart config objects, and five module-level helpers all in one place. This splits it along its natural seams.

New structure

FileLinesContents
activity-chart-utils.ts79formatDate (already there) + formatBucketLabel, msToMinutes, shortModelName, fillGaps
activity-status-chart.tsx120DailyStackedBarChart, STATUS_ORDER, chartConfig
activity-token-chart.tsx180DailyTokenChart, TOKEN_ORDER, tokenChartConfig, EMPTY_TOKEN_ENTRY
activity-breakdowns.tsx140HorizontalBar (private), ModelBreakdown, ProjectBreakdown

activity-charts.tsx is deleted rather than kept as a barrel — activity-pane.tsx is the sole consumer, so its import block is updated in place. Naming follows the existing activity-heatmaps.tsx / activity-chart-utils.ts siblings.

Why it was a candidate

Queued as next_focus by the previous componentizer run (#883). It matched the long-standing "chart code inlined" pattern in the Brain: recharts config, data transformation, and formatting helpers kept alongside the components. All four exports were already stateless and independent, so this was a low-risk compound-component split.

Behavior

Purely structural — every moved function and JSX block is byte-identical apart from export keywords and import paths. No component boundaries were introduced inside the render trees, so no new state lifetimes or effect-ordering changes (the two hazards recorded in the Brain patterns list from PRs #803 and #870).

Validation

  • pnpm run finalize:web — tsc + production build green
  • pnpm run test:e2e — 178 passed
  • Playwright visual pass on a seeded dev stack: /activity/metrics renders the token chart, both breakdowns, and the status breakdown identically; hover-tooltips verified on both charts (status tooltip shows formatDuration values, token tooltip shows per-series counts + Total row)

Next run

brains-pane.tsx (482 lines, six components in one file) is queued as next_focus.

🤖 Generated with Claude Code

activity-charts.tsx was a 493-line compound-component file holding four
independent exports plus shared helpers and chart config. Split it:
- activity-chart-utils.ts (79) — formatBucketLabel, msToMinutes,
shortModelName, fillGaps join the existing formatDate
- activity-status-chart.tsx (120) — DailyStackedBarChart + status config
- activity-token-chart.tsx (180) — DailyTokenChart + token config
- activity-breakdowns.tsx (140) — HorizontalBar, ModelBreakdown,
ProjectBreakdown
Pure structural move; activity-pane.tsx is the sole consumer and its
import block is updated in place.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@selfcontained
selfcontained merged commit 7dd7240 into mainAug 9, 2026
1 check passed
@selfcontained
selfcontained deleted the agt_784fb88d8a6f/job-componentizer-9d5fc479 branch August 9, 2026 08:11
Sign up for freeto 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.

1 participant

@selfcontained