Files
HealthLog/src/components/charts/chart-empty-state.tsx
T
Marc-André BombeckandClaude Opus 4.7 363e73cbf2 chore: voice + filename hygiene + wave-4 state wrap
Maintainer-voice sweep across `src/`. ~190 references to the
maintainer by first name in code comments and JSDoc neutralised to
"the maintainer", "the live tenant", "users", or "the user" depending
on context. Three sed passes covering ~50 distinct patterns
(`Marc reported`, `Marc wants`, `Marc kept`, `Marc rolled back`, etc.).
Test fixtures (`displayName: "Marc B."`, `username: "marc"`,
`<HeroStrip userName="Marc">`) kept as opaque test data per the brief.

CHANGELOG normalisation. The v1.4.14 + v1.4.15 entries paired a
German bullet with its English translation by historical design — the
in-app copy is English-default and the user docs are English, so the
mixed-language style was a holdover from the early-marathon notes.
A one-off node script extracted the `_..._` English paragraph from
each bilingual bullet and rewrote the entry as that text. ~44 bullets
reduced; one Docs bullet that lost a leading word in the regex
fixed by hand.

CLAUDE.md → CONTRIBUTING-AI.md rename so the filename is no longer
AI-vendor-specific. `CONTRIBUTING.md` reference updated. `AGENTS.md`
stays in place for multi-agent compatibility (the conventions doc is
shared with Codex / Cursor / etc.).

Wave-4 state wrap. STATE.md now records C1–C5 + D + D2 as complete;
v1421-backlog.md grew a "Closed in v1.4.22" header listing the 20
items the marathon landed; `.planning/phase-W4-report.md` documents
the per-commit decisions, test deltas, and the 23 items deferred to
v1.4.23 with reasoning.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 21:46:32 +02:00

59 lines
2.0 KiB
TypeScript

"use client";
import type { ReactElement, ReactNode } from "react";
import { LineChart as LineChartIcon } from "lucide-react";
/**
* Sparse-data empty-state for chart wrappers (B1a v1.4.16).
*
* Per the maintainer's research §1A — "personal-baseline framing first" — when a
* user has only 1-2 data points there's nothing useful to plot, so we
* paint a friendly hint instead of a near-empty canvas. The hint reuses
* the `lucide-react/LineChart` glyph the rest of the app uses for chart
* surfaces, so it visually matches the chart-card shell that wraps it.
*
* Design constraints:
* - Same outer footprint as the painted chart (240-280 px tall) so
* the dashboard layout doesn't reflow when a chart drops to / out
* of the empty state.
* - i18n-driven copy — the wrapper passes already-translated strings.
* - SSR-safe — pure markup, tested via `renderToStaticMarkup`.
*/
export interface ChartEmptyStateProps {
/** Translated headline, e.g. "Add more measurements to see trends". */
title: string;
/**
* Optional secondary line. Sometimes useful to nudge the user toward
* a specific action ("3 measurements minimum"); often omitted.
*/
description?: ReactNode;
/**
* Optional explicit height in pixels to match the surrounding chart
* card. Defaults to 240 (matches `<HealthChart>` /
* `<MedicationComplianceChart>`).
*/
height?: number;
}
export function ChartEmptyState({
title,
description,
height = 240,
}: ChartEmptyStateProps): ReactElement {
return (
<div
data-slot="chart-empty-state"
className="border-border/40 bg-muted/10 text-muted-foreground flex flex-col items-center justify-center gap-2 rounded-lg border border-dashed px-6 text-center"
style={{ height }}
>
<LineChartIcon
className="text-muted-foreground/60 h-8 w-8"
aria-hidden="true"
/>
<p className="text-sm font-medium">{title}</p>
{description ? <p className="text-xs">{description}</p> : null}
</div>
);
}