feat(apollo-vertex): dashboard card renderers — InsightCardBody and typed card content components#823
feat(apollo-vertex): dashboard card renderers — InsightCardBody and typed card content components#823frankkluijtmans wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Dependency License Review
License distribution
Excluded packages
|
…yped card content components Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
9df6c10 to
97a7d33
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new client-side renderer layer for Apollo Vertex dashboard insight cards. InsightCardBody selects a content renderer (KPI, horizontal bars, donut, sparkline, stacked bar, or area) based on the card config and view mode, bridging dashboard data to card visuals.
Changes:
- Introduces
InsightCardBodyand multiple chart/KPI content renderers in a single module. - Adds compact/expanded rendering variants for horizontal bars and stacked bars.
- Adds a
TruncatedTexthelper that conditionally shows a tooltip when text is clamped.
| if (content.type === "kpi") { | ||
| return <KpiContent cardData={cardData} viewMode={viewMode} />; | ||
| } |
- Wire donut, sparkline, and area renderers to dataset values (donutPercent/donutLabel/points) with sample fallbacks - Guard percentage math against divide-by-zero and empty data so legends and bar heights never render NaN% - Key stacked-bar totals and segments by category index instead of CSS color, which repeats once there are more than 5 categories - Make the TruncatedText tooltip trigger keyboard-focusable when clamped Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Addressed the Copilot review in a follow-up commit ( Two items I intentionally did not change, for the record:
Note: |
- Clamp donut fraction to [0,1] so out-of-range data can't produce a negative/oversized arc or a wrong label. - Normalize expanded horizontal-bar percentages to value/total so they match the compact view (bar values are raw counts, not percentages). - Return null from InsightCardBody when cardIndex is out of range instead of silently rendering insightCards[0]. - Replace the chart renderer if-chain with an exhaustive switch and a never guard so a new ChartType fails to compile rather than defaulting to Area. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Summary
Adds the rendering logic that turns raw data into card content.
InsightCardBodydecides whether a card should show a KPI number, a horizontal bar chart, a donut, a sparkline, or an area chart based on the card'stypeandchartTypefields. This is the layer between the data model and the visual cards.Rebased onto
main— the dashboard foundation and config layer it was previously stacked on have since merged, so this now contains only the new renderer logic (insight-card-renderers.tsx).Supersedes #732, which could not be reopened after its head branch was rebased/force-pushed.
Test plan
insight-card-renderers.tsxtypeandchartTypecombinations are handled🤖 Generated with Claude Code