refactor(ui): migrate hand-rolled tile headers onto TileHeader

Nine insights/cycle cards hand-rolled their icon+title rows at drifting
sizes and colours: the sleep trio (debt, chronotype, average) and the
glucose clinical panel led with h-4 accent icons, the cycle module
(predictions, BBT chart, symptom patterns) coloured its header icons
text-primary against both header contracts, and the hypnogram,
correlation card, and mood correlation cards carried bespoke title rows.
All of them now compose TileHeader.

TileHeader grows the two documented gaps instead of a fourth header
language: an optional icon (text-only tile titles) and the ONE sanctioned
compact variant size="sm" (icon h-4 w-4, title text-sm) used by the dense
correlation tiles. The sleep-rhythm guard test now pins the tile-header
slot instead of the retired accent icon colour.
This commit is contained in:
Marc-André Bombeck committed 2026-07-05 17:42:54 +02:00
1 parent 9a35cfb3e9
commit 8d36e69f75
12 files changed
+149 -129

No files matched your search

+3 -5
View File
@@ -35,7 +35,8 @@ import {
YAxis,
} from "recharts";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Card, CardContent, CardHeader } from "@/components/ui/card";
import { TileHeader } from "@/components/insights/tile-header";
import { useTranslations, useFormatters } from "@/lib/i18n/context";
import { prefersReducedMotion } from "@/lib/charts/reduced-motion";
import { cn } from "@/lib/utils";
@@ -150,10 +151,7 @@ export function BbtChart({
return (
<Card data-slot="cycle-bbt-chart">
<CardHeader>
<CardTitle className="flex items-center gap-2 text-base">
<Thermometer className="text-primary h-4 w-4" aria-hidden="true" />
{t("cycle.bbt.title")}
</CardTitle>
<TileHeader icon={Thermometer} title={t("cycle.bbt.title")} />
</CardHeader>
<CardContent>
{!hasCurve ? (
@@ -3,7 +3,8 @@
import { useMemo } from "react";
import { Activity } from "lucide-react";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Card, CardContent, CardHeader } from "@/components/ui/card";
import { TileHeader } from "@/components/insights/tile-header";
import { useTranslations } from "@/lib/i18n/context";
import { CYCLE_SYMPTOM_CATALOG } from "./symptom-catalog";
import { PHASE_HUE } from "./phase-tokens";
@@ -56,10 +57,10 @@ export function CycleSymptomPatterns({ rows }: CycleSymptomPatternsProps) {
return (
<Card data-slot="cycle-symptom-patterns">
<CardHeader>
<CardTitle className="flex items-center gap-2 text-base">
<Activity className="text-primary h-4 w-4" aria-hidden="true" />
{t("cycle.insights.symptomPatternsTitle")}
</CardTitle>
<TileHeader
icon={Activity}
title={t("cycle.insights.symptomPatternsTitle")}
/>
</CardHeader>
<CardContent>
{rows.length === 0 ? (
+2 -4
View File
@@ -10,6 +10,7 @@ import {
CardTitle,
} from "@/components/ui/card";
import { Badge } from "@/components/ui/badge";
import { TileHeader } from "@/components/insights/tile-header";
import { useTranslations } from "@/lib/i18n/context";
import { FERTILE_HUE, FLOW_HUE, OVULATION_HUE } from "./phase-tokens";
import type { CyclePrediction, CycleHistoryResponse } from "./types";
@@ -64,10 +65,7 @@ export function PredictionsPanel({
<div className="space-y-4">
<Card>
<CardHeader>
<CardTitle className="flex items-center gap-2 text-base">
<Sparkles className="text-primary h-4 w-4" aria-hidden="true" />
{t("cycle.predictions.title")}
</CardTitle>
<TileHeader icon={Sparkles} title={t("cycle.predictions.title")} />
</CardHeader>
<CardContent className="space-y-4">
{rawChartMode ? (