Public: anyone can read this; the crew can change it.
A KPI row's sparkline draws a base utility or §5's look, and .kpi-spark leaves the markup #4285
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/4270-a-kpi-row-s-sparkline-draws-a-base-utili → main 3 commits fork 2 threads · 2 unresolved
3 files
changed +3
−0
src/web/studio/kpi_row.ts +1
| @@ -42,6 +42,7 @@ function spark(series: readonly number[], label: string): Html { | ||
| 42 | 42 | * the one shared scale, a run of one day is a dot, and no number at all is no |
| 43 | 43 | * sparkline. Non-finite values count as missing. |
| 44 | 44 | */ |
| 45 | /** Outside a stat tile the caller wraps it in `<div class="bar muted">`: a flex row makes the svg a block (no baseline gap) and `.muted` colours it. */ | |
Merge this into the block above as a last sentence. Two consecutive JSDoc blocks is untidy, and only this one is attached to |
||
| 45 | 46 | export function daySpark(days: readonly (number | null)[], label: string): Html | null { |
| 46 | 47 | const known = days.filter((v): v is number => v !== null && Number.isFinite(v)); |
| 47 | 48 | if (known.length === 0) return null; |
test/app-vitals-days.test.ts +1
| @@ -44,6 +44,7 @@ test("the settings card breaks the line at the silent day", () => { | ||
| 44 | 44 | expect(out).toContain("p75 load each day over the last 30 days"); |
| 45 | 45 | expect(out.match(/<polyline|<circle/g)).toHaveLength(2); |
| 46 | 46 | expect(out).toContain('<div class="bar muted"><svg viewBox'); |
| 47 | expect(out).not.toContain("kpi-spark"); | |
| 47 | 48 | expect(out).not.toContain("No load reports"); |
| 48 | 49 | }); |
| 49 | 50 |
test/kpi-spark.test.ts +1
| @@ -39,6 +39,7 @@ describe("daySpark", () => { | ||
| 39 | 39 | const out = daySpark([0, null, 5], "Days")!.toString(); |
| 40 | 40 | expect(out).toStartWith('<svg viewBox="0 0 96 24" width="96" height="24" role="img" aria-label="Days">'); |
| 41 | 41 | expect(out).not.toContain("style="); |
| 42 | expect(out).not.toContain("class="); | |
| 42 | 43 | expect(out).not.toMatch(/#[0-9a-f]{3,8}\b|rgb|hsl/i); |
| 43 | 44 | }); |
| 44 | 45 |
new above
offline
Merge this into the docblock above (lines 40-44) rather than stacking a second /** */ on top of it.