feat(app): add shared ChartCard component and migrate ChartBox usages - #2829
feat(app): add shared ChartCard component and migrate ChartBox usages#2829elizabetdev wants to merge 5 commits into
Conversation
Introduce ChartCard (components/charts/), which gives standalone charts the same card treatment as custom dashboard tiles (bordered surface + full-bleed header divider) by reusing ChartContainerCardHeaderProvider and DASHBOARD_TILE_PADDING_INLINE. Migrate the Service Dashboards (HTTP, Database, Errors, endpoint and DB-query side panels) and the ClickHouse page off the old ChartBox wrapper so chart surfaces look consistent across the app. Add a Storybook story and document usage in agent_docs/code_style.md. Co-authored-by: Cursor <cursoragent@cursor.com>
🦋 Changeset detectedLatest commit: 1c25b9b The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryIntroduces a shared
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| packages/app/src/components/charts/ChartCard.tsx | Defines the shared card chrome and card-header context; the previously reported headerless-spacing path is no longer used by current production callers. |
| packages/app/src/components/ServiceDashboardSlowestEventsTile.tsx | Replaces the custom bare heading with a titled ChartContainer so the card receives header spacing and a divider. |
| packages/app/src/ClickhousePage.tsx | Migrates ClickHouse charts to ChartCard and gives the Slowest Queries table a standard ChartContainer header. |
| packages/app/src/components/charts/ChartCard.stories.tsx | Demonstrates titled chart, toolbar, multi-card, and table-card layouts without retaining the problematic headerless example. |
| packages/app/src/components/charts/tests/ChartCard.test.tsx | Covers card-mode header activation, standalone behavior, style merging, and pinned divider padding. |
Reviews (5): Last reviewed commit: "Merge branch 'main' into elizabet/chart-..." | Re-trigger Greptile
| // Match the dashboard tile: no top padding (the card header supplies its | ||
| // own), slim bottom padding, and horizontal padding pinned to the tile | ||
| // inset so the header divider bleeds to the card edges. | ||
| paddingTop: 0, |
There was a problem hiding this comment.
Headerless cards lose top spacing
paddingTop: 0 assumes a ChartContainer header will supply the top inset, but SlowestEventsTile renders a custom header and the documented NoHeader variant renders no header. Their content therefore sits flush against the top border instead of retaining the previous vertical spacing, making these cards inconsistent with titled chart cards.
Knowledge Base Used: App Components and Charts
|
<!-- deep-review --> Deep Review✅ No critical issues found. This is a presentational extraction with no data, query, or auth surface touched — the migrated call sites pass their 🟡 P2 — recommended
🔵 P3 nitpicks (4)
Reviewers (0 of 6 returned): correctness, adversarial, kieran-typescript, testing, maintainability, project-standards were dispatched but had not returned results at report time — every finding above was verified directly by the orchestrator against the file contents, not merged from reviewer output. Environment caveat: Testing gaps:
|
🟡 Tier 3 — StandardIntroduces new logic, modifies core functionality, or touches areas with non-trivial risk. Why this tier:
Review process: Full human review — logic, architecture, edge cases. Stats
|
E2E Test Results✅ All tests passed • 277 passed • 1 skipped • 973s
Tests ran across 4 shards in parallel. |
Deep Review✅ No critical issues found. This is a clean, scope-contained visual refactor: a shared 🟡 P2 -- recommended
🔵 P3 nitpicks (4)
Reviewers (8): correctness, testing, maintainability, project-standards, kieran-typescript, adversarial, agent-native, learnings-researcher. Testing gaps:
|
Route the "Slowest Queries" (ClickHouse page) and Slowest Events tile titles through a titled ChartContainer instead of a bare Text, so they get the same full-bleed card header divider as sibling chart cards and their tables are properly bounded by the reactive container. Remove the headerless ChartCard prop (padding-only patch) in favor of this approach, keep the ChartCardProps interface, narrowed style type, and enforced paddingInline divider invariant, and add ChartCard tests. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@copilot resolve the merge conflicts in this pull request |
…yle.md conflict) Co-authored-by: elizabetdev <2750668+elizabetdev@users.noreply.github.com>
Merged |
Summary
ChartCard(packages/app/src/components/charts/ChartCard.tsx), a reusable card wrapper that gives standalone charts the same treatment as a custom dashboard tile — a bordered surface with a full-bleed header divider under the title. It's built on the exact primitives dashboard tiles already use (ChartContainerCardHeaderProvider+DASHBOARD_TILE_PADDING_INLINE), so the look stays in sync automatically.ChartBoxwrapper toChartCard, and deleteChartBox.Charts/ChartCard) with Default, WithToolbar, RedRow, and NoHeader variants (dependency-free fake chart, no ClickHouse needed).agent_docs/code_style.md(when to use it, props, ✅/❌ examples, the height/flex requirement).Why
ChartBoxwas a minimal bordered box with no header treatment, so charts on the Service Dashboards / ClickHouse page looked noticeably different from custom-dashboard tiles.ChartCardunifies these surfaces on one shared component with the preferred dashboard-tile look. It intentionally ships the visual chrome only — the tile-level controls (fullscreen, display switcher, kebab) stay on the dashboardTile, which remains the grid-cell superset and is deliberately left untouched.Test plan
Charts/ChartCardrenders all four variants correctly (divider, toolbar action, 3-up RED row, no-header degrade).Notes:
tsc --noEmitand ESLint pass clean. Changeset included (@hyperdx/apppatch).TraceRedMetricsChart(search-page RED charts) is intentionally excluded — it lives on the unmergedalex/red-metrics-trace-searchbranch and will adoptChartCardthere.Made with Cursor