fix(insights): ask the empty-state Coach question in the reader's language

A metric page without data offers to ask the Coach about the metric.
44 of the 49 pages passed that question as an English literal, so a
German, French or Korean reader got an English first message; only 5
read it from the catalog. 31 of the 44 were one sentence with the
metric's name swapped in.

`HealthKitMetricPage` now asks that sentence once, translated, around
the page's own title, and the 31 pages drop the prop. The 13 pages
with a question of their own (steps, HRV, sleep, mood, workouts, blood
pressure and others) read it from the catalog like the 5 did, in all
ten languages.
This commit is contained in:
Marc-André Bombeck committed 2026-11-11 22:09:23 +01:00
1 parent b970ea7468
commit eec52534d5
57 files changed
+395 -189

No files matched your search

+3 -1
View File
@@ -3,6 +3,7 @@
import { Flame } from "lucide-react";
import { HealthKitMetricPage } from "@/components/insights/healthkit-metric-page";
import { useTranslations } from "@/lib/i18n/context";
/**
* v1.4.32 — `/insights/active-energy`.
@@ -14,6 +15,7 @@ import { HealthKitMetricPage } from "@/components/insights/healthkit-metric-page
* imports collapse cleanly via the v1.4.30 drain script.
*/
export default function InsightsActiveEnergyPage() {
const { t } = useTranslations();
return (
<HealthKitMetricPage
measurementType="ACTIVE_ENERGY_BURNED"
@@ -27,7 +29,7 @@ export default function InsightsActiveEnergyPage() {
yAxisUnit="kcal"
emptyStateIcon={<Flame className="size-6" />}
emptyStateCtaType={null}
coachPrefill="I haven't logged any active energy yet. What's a reasonable daily target, and how does it compare to total calories?"
coachPrefill={t("insights.activeEnergy.coachPrefill")}
/>
);
}
-1
View File
@@ -26,7 +26,6 @@ export default function InsightsLaermereignissePage() {
yAxisUnit=""
emptyStateIcon={<Volume2 className="size-6" />}
emptyStateCtaType={null}
coachPrefill="I haven't logged any loud-environment events yet. What does this metric tell me about my health, and how do I improve it?"
/>
);
}
-1
View File
@@ -60,7 +60,6 @@ export default function InsightsBlutzuckerPage() {
captureType="BLOOD_GLUCOSE"
targetSummarySlug="blood-glucose"
afterChart={<GlucoseClinicalPanel />}
coachPrefill="I haven't logged any blood glucose yet. What does this metric tell me about my health, and how do I improve it?"
/>
);
}
+1 -1
View File
@@ -87,7 +87,7 @@ export default function InsightsBlutdruckPage() {
</Link>
</Button>
}
coachPrefill="I haven't recorded any blood pressure yet. Why does it matter, and what should I know before I start?"
coachPrefill={t("insights.emptyState.bloodPressure.coachPrefill")}
/>
</SubPageShell>
);
+1 -1
View File
@@ -90,7 +90,7 @@ export default function InsightsBmiPage() {
</Link>
</Button>
}
coachPrefill="I haven't recorded any weight yet. Why does BMI matter for me, and what should I know before I start tracking it?"
coachPrefill={t("insights.emptyState.bmi.coachPrefill")}
/>
</SubPageShell>
);
+3 -1
View File
@@ -3,6 +3,7 @@
import { Thermometer } from "lucide-react";
import { HealthKitMetricPage } from "@/components/insights/healthkit-metric-page";
import { useTranslations } from "@/lib/i18n/context";
/**
* v1.4.32 — `/insights/body-temperature`.
@@ -13,6 +14,7 @@ import { HealthKitMetricPage } from "@/components/insights/healthkit-metric-page
* them on separate enum values per the v1.4.30 categorisation overlay.
*/
export default function InsightsBodyTemperaturePage() {
const { t } = useTranslations();
return (
<HealthKitMetricPage
measurementType="BODY_TEMPERATURE"
@@ -24,7 +26,7 @@ export default function InsightsBodyTemperaturePage() {
color="var(--chart-3)"
emptyStateIcon={<Thermometer className="size-6" />}
emptyStateCtaType="BODY_TEMPERATURE"
coachPrefill="I haven't logged any body temperature yet. What's the healthy range, and what should I do if it drifts?"
coachPrefill={t("insights.bodyTemperature.coachPrefill")}
/>
);
}
-1
View File
@@ -25,7 +25,6 @@ export default function InsightsKoerperwasserPage() {
emptyStateIcon={<Droplet className="size-6" />}
emptyStateCtaType={null}
captureType="TOTAL_BODY_WATER"
coachPrefill="I haven't logged any total body water yet. What does this metric tell me about my health, and how do I improve it?"
/>
);
}
-1
View File
@@ -25,7 +25,6 @@ export default function InsightsKnochenmassePage() {
emptyStateIcon={<Bone className="size-6" />}
emptyStateCtaType={null}
captureType="BONE_MASS"
coachPrefill="I haven't logged any bone mass yet. What does this metric tell me about my health, and how do I improve it?"
/>
);
}
@@ -24,7 +24,6 @@ export default function InsightsBreathingDisturbancesPage() {
unitKey="insights.units.breathingEvents"
emptyStateIcon={<Wind className="size-6" />}
emptyStateCtaType={null}
coachPrefill="I haven't logged any sleep-breathing-disturbance data yet. What does this metric tell me about my health, and how do I improve it?"
/>
);
}
-1
View File
@@ -27,7 +27,6 @@ export default function InsightsCardioFitnessPage() {
statIcon={Gauge}
emptyStateIcon={<Gauge className="size-6" />}
emptyStateCtaType={null}
coachPrefill="I haven't logged any cardio-fitness (VO₂ max) data yet. What does this metric tell me about my health, and how do I improve it?"
/>
);
}
@@ -26,7 +26,6 @@ export default function InsightsCardioRecoveryPage() {
yAxisUnit="bpm"
emptyStateIcon={<HeartPulse className="size-6" />}
emptyStateCtaType={null}
coachPrefill="I haven't logged any cardio-recovery data yet. What does this metric tell me about my health, and how do I improve it?"
/>
);
}
-1
View File
@@ -26,7 +26,6 @@ export default function InsightsTageslichtPage() {
yAxisUnit="min"
emptyStateIcon={<Sun className="size-6" />}
emptyStateCtaType={null}
coachPrefill="I haven't logged any time spent in daylight yet. What does this metric tell me about my health, and how do I improve it?"
/>
);
}
@@ -26,7 +26,6 @@ export default function InsightsDoppelstandphasePage() {
yAxisUnit="%"
emptyStateIcon={<Footprints className="size-6" />}
emptyStateCtaType={null}
coachPrefill="I haven't logged any double support time yet. What does this metric tell me about my health, and how do I improve it?"
/>
);
}
@@ -26,7 +26,6 @@ export default function InsightsLaermbelastungPage() {
yAxisUnit="dBA"
emptyStateIcon={<Volume2 className="size-6" />}
emptyStateCtaType={null}
coachPrefill="I haven't logged any environmental sound exposure yet. What does this metric tell me about my health, and how do I improve it?"
/>
);
}
+3 -1
View File
@@ -3,6 +3,7 @@
import { PersonStanding } from "lucide-react";
import { HealthKitMetricPage } from "@/components/insights/healthkit-metric-page";
import { useTranslations } from "@/lib/i18n/context";
/**
* v1.10.0 — `/insights/falls`.
@@ -11,6 +12,7 @@ import { HealthKitMetricPage } from "@/components/insights/healthkit-metric-page
* better. The series arrives from Apple Health sync — no manual-entry CTA.
*/
export default function InsightsFallsPage() {
const { t } = useTranslations();
return (
<HealthKitMetricPage
measurementType="FALL_COUNT"
@@ -23,7 +25,7 @@ export default function InsightsFallsPage() {
unitKey="insights.units.falls"
emptyStateIcon={<PersonStanding className="size-6" />}
emptyStateCtaType={null}
coachPrefill="I haven't logged any fall data yet. What does this metric tell me about my health, and how do I lower my fall risk?"
coachPrefill={t("insights.falls.coachPrefill")}
/>
);
}
-1
View File
@@ -24,7 +24,6 @@ export default function InsightsFettfreieMassePage() {
color="var(--chart-1)"
emptyStateIcon={<Scale className="size-6" />}
emptyStateCtaType={null}
coachPrefill="I haven't logged any fat-free mass yet. What does this metric tell me about my health, and how do I improve it?"
/>
);
}
-1
View File
@@ -24,7 +24,6 @@ export default function InsightsFettmassePage() {
color="var(--chart-5)"
emptyStateIcon={<Droplets className="size-6" />}
emptyStateCtaType={null}
coachPrefill="I haven't logged any fat mass yet. What does this metric tell me about my health, and how do I improve it?"
/>
);
}
@@ -25,7 +25,6 @@ export default function InsightsStockwerkePage() {
unitKey="insights.units.flights"
emptyStateIcon={<TrendingUp className="size-6" />}
emptyStateCtaType={null}
coachPrefill="I haven't logged any flights climbed yet. What does this metric tell me about my health, and how do I improve it?"
/>
);
}
@@ -26,7 +26,6 @@ export default function InsightsKopfhoererpegelPage() {
yAxisUnit="dBA"
emptyStateIcon={<Headphones className="size-6" />}
emptyStateCtaType={null}
coachPrefill="I haven't logged any headphone audio exposure yet. What does this metric tell me about my health, and how do I improve it?"
/>
);
}
+3 -1
View File
@@ -3,6 +3,7 @@
import { Activity } from "lucide-react";
import { HealthKitMetricPage } from "@/components/insights/healthkit-metric-page";
import { useTranslations } from "@/lib/i18n/context";
import { EcgCrossLink } from "@/components/insights/ecg-cross-link";
/**
@@ -20,6 +21,7 @@ import { EcgCrossLink } from "@/components/insights/ecg-cross-link";
* own, labelled, because the two are not one measure.
*/
export default function InsightsHrvPage() {
const { t } = useTranslations();
return (
<HealthKitMetricPage
measurementType="HEART_RATE_VARIABILITY"
@@ -37,7 +39,7 @@ export default function InsightsHrvPage() {
yAxisUnit="ms"
emptyStateIcon={<Activity className="size-6" />}
emptyStateCtaType={null}
coachPrefill="I haven't logged any HRV data yet. What does heart-rate variability tell me, and how do I capture it?"
coachPrefill={t("insights.hrv.coachPrefill")}
// S10 / H1 — device-attributed pointer into the ECG viewer, in the
// HRV / heart context. Self-gates to nothing without recordings.
afterAssessment={<EcgCrossLink />}
-1
View File
@@ -24,7 +24,6 @@ export default function InsightsMagermassePage() {
color="var(--chart-1)"
emptyStateIcon={<Scale className="size-6" />}
emptyStateCtaType={null}
coachPrefill="I haven't logged any lean body mass yet. What does this metric tell me about my health, and how do I improve it?"
/>
);
}
+1 -1
View File
@@ -132,7 +132,7 @@ export default function InsightsMoodPageClient() {
<Link href="/mood">{t("insights.emptyState.mood.cta")}</Link>
</Button>
}
coachPrefill="I haven't logged any mood entries yet. Why does mood tracking matter, and how should I start?"
coachPrefill={t("insights.emptyState.mood.coachPrefill")}
/>
</SubPageShell>
);
-1
View File
@@ -24,7 +24,6 @@ export default function InsightsMuskelmassePage() {
color="var(--chart-1)"
emptyStateIcon={<Dumbbell className="size-6" />}
emptyStateCtaType={null}
coachPrefill="I haven't logged any muscle mass yet. What does this metric tell me about my health, and how do I improve it?"
/>
);
}
@@ -13,6 +13,7 @@ import { describe, expect, it, vi } from "vitest";
import { renderToStaticMarkup } from "react-dom/server";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { I18nProvider } from "@/lib/i18n/context";
import { queryKeys } from "@/lib/query-keys";
import type { ValueBand } from "@/lib/analytics/value-bands";
@@ -37,7 +38,9 @@ function bandsRendered(thresholds: unknown): ValueBand[] {
}
const html = renderToStaticMarkup(
<QueryClientProvider client={client}>
<InsightsOxygenSaturationPage />
<I18nProvider initialLocale="en">
<InsightsOxygenSaturationPage />
</I18nProvider>
</QueryClientProvider>,
);
const match = /<pre[^>]*>([^<]*)<\/pre>/.exec(html);
+3 -1
View File
@@ -3,6 +3,7 @@
import { Wind } from "lucide-react";
import { HealthKitMetricPage } from "@/components/insights/healthkit-metric-page";
import { useTranslations } from "@/lib/i18n/context";
import { buildOxygenSaturationBands } from "@/lib/analytics/value-bands";
import { useOwnTargetRange } from "@/lib/queries/use-own-target-range";
@@ -20,6 +21,7 @@ import { useOwnTargetRange } from "@/lib/queries/use-own-target-range";
* `/targets`, and the clinical bands otherwise.
*/
export default function InsightsOxygenSaturationPage() {
const { t } = useTranslations();
const ownRange = useOwnTargetRange("OXYGEN_SATURATION");
return (
<HealthKitMetricPage
@@ -38,7 +40,7 @@ export default function InsightsOxygenSaturationPage() {
emptyStateIcon={<Wind className="size-6" />}
emptyStateCtaType={null}
captureType="OXYGEN_SATURATION"
coachPrefill="I haven't logged any oxygen-saturation data yet. What does SpO₂ tell me, and what range should I aim for?"
coachPrefill={t("insights.oxygenSaturation.coachPrefill")}
/>
);
}
@@ -26,7 +26,6 @@ export default function InsightsPulswellengeschwindigkeitPage() {
yAxisUnit="m/s"
emptyStateIcon={<Activity className="size-6" />}
emptyStateCtaType={null}
coachPrefill="I haven't logged any pulse wave velocity yet. What does this metric tell me about my health, and how do I improve it?"
/>
);
}
+1 -1
View File
@@ -115,7 +115,7 @@ export default function InsightsPulsPage() {
</Link>
</Button>
}
coachPrefill="I haven't recorded any resting pulse yet. Why does it matter, and what should I know before I start?"
coachPrefill={t("insights.emptyState.pulse.coachPrefill")}
/>
</SubPageShell>
);
@@ -25,7 +25,6 @@ export default function InsightsAtemfrequenzPage() {
unitKey="insights.units.respiratoryRate"
emptyStateIcon={<Wind className="size-6" />}
emptyStateCtaType={null}
coachPrefill="I haven't logged any respiratory rate yet. What does this metric tell me about my health, and how do I improve it?"
/>
);
}
@@ -25,7 +25,6 @@ export default function InsightsSixMinuteWalkPage() {
yAxisUnit="m"
emptyStateIcon={<Footprints className="size-6" />}
emptyStateCtaType={null}
coachPrefill="I haven't logged any six-minute-walk data yet. What does this metric tell me about my health, and how do I improve it?"
/>
);
}
@@ -32,7 +32,6 @@ export default function InsightsHauttemperaturPage() {
color="var(--chart-5)"
emptyStateIcon={<Thermometer className="size-6" />}
emptyStateCtaType={null}
coachPrefill="I haven't logged any skin temperature yet. What does this metric tell me about my health, and how do I improve it?"
afterChart={
<ConnectedDeviceScoreTile
type="BODY_TEMPERATURE_DEVIATION"
+1 -1
View File
@@ -70,7 +70,7 @@ export default function InsightsSchlafPage() {
</Link>
</Button>
}
coachPrefill="I don't have any sleep data yet. Why does sleep tracking matter, and what should I know before I connect a source?"
coachPrefill={t("insights.emptyState.sleep.coachPrefill")}
/>
</SubPageShell>
);
@@ -25,7 +25,6 @@ export default function InsightsStairAscentSpeedPage() {
yAxisUnit="m/s"
emptyStateIcon={<Gauge className="size-6" />}
emptyStateCtaType={null}
coachPrefill="I haven't logged any stair-ascent-speed data yet. What does this metric tell me about my health, and how do I improve it?"
/>
);
}
@@ -25,7 +25,6 @@ export default function InsightsStairDescentSpeedPage() {
yAxisUnit="m/s"
emptyStateIcon={<Gauge className="size-6" />}
emptyStateCtaType={null}
coachPrefill="I haven't logged any stair-descent-speed data yet. What does this metric tell me about my health, and how do I improve it?"
/>
);
}
-1
View File
@@ -26,7 +26,6 @@ export default function InsightsSchrittlaengePage() {
yAxisUnit="m"
emptyStateIcon={<Footprints className="size-6" />}
emptyStateCtaType={null}
coachPrefill="I haven't logged any walking step length yet. What does this metric tell me about my health, and how do I improve it?"
/>
);
}
+1 -1
View File
@@ -40,7 +40,7 @@ export default function InsightsStepsPage() {
emptyStateIcon={<Footprints className="size-6" />}
emptyStateCtaType={null}
captureType="ACTIVITY_STEPS"
coachPrefill="I haven't logged any steps yet. What's a reasonable daily step target, and how does walking more help my health?"
coachPrefill={t("insights.steps.coachPrefill")}
afterChart={
calendarVisible ? (
<CrossLinkCard
-1
View File
@@ -25,7 +25,6 @@ export default function InsightsGefaessalterPage() {
unitKey="insights.units.years"
emptyStateIcon={<HeartPulse className="size-6" />}
emptyStateCtaType={null}
coachPrefill="I haven't logged any vascular age yet. What does this metric tell me about my health, and how do I improve it?"
/>
);
}
-1
View File
@@ -26,7 +26,6 @@ export default function InsightsViszeralfettPage() {
yAxisUnit=""
emptyStateIcon={<Droplets className="size-6" />}
emptyStateCtaType={null}
coachPrefill="I haven't logged any visceral fat yet. What does this metric tell me about my health, and how do I improve it?"
/>
);
}
@@ -26,7 +26,6 @@ export default function InsightsGangasymmetriePage() {
yAxisUnit="%"
emptyStateIcon={<Footprints className="size-6" />}
emptyStateCtaType={null}
coachPrefill="I haven't logged any walking asymmetry yet. What does this metric tell me about my health, and how do I improve it?"
/>
);
}
@@ -24,7 +24,6 @@ export default function InsightsGehstreckePage() {
color="var(--chart-2)"
emptyStateIcon={<Footprints className="size-6" />}
emptyStateCtaType={null}
coachPrefill="I haven't logged any walking and running distance yet. What does this metric tell me about my health, and how do I improve it?"
/>
);
}
@@ -26,7 +26,6 @@ export default function InsightsGehpulsPage() {
yAxisUnit="bpm"
emptyStateIcon={<HeartPulse className="size-6" />}
emptyStateCtaType={null}
coachPrefill="I haven't logged any walking heart rate average yet. What does this metric tell me about my health, and how do I improve it?"
/>
);
}
-1
View File
@@ -24,7 +24,6 @@ export default function InsightsGehgeschwindigkeitPage() {
color="var(--chart-2)"
emptyStateIcon={<Gauge className="size-6" />}
emptyStateCtaType={null}
coachPrefill="I haven't logged any walking speed yet. What does this metric tell me about my health, and how do I improve it?"
/>
);
}
@@ -26,7 +26,6 @@ export default function InsightsGangstabilitaetPage() {
yAxisUnit="%"
emptyStateIcon={<Gauge className="size-6" />}
emptyStateCtaType={null}
coachPrefill="I haven't logged any walking steadiness yet. What does this metric tell me about my health, and how do I improve it?"
/>
);
}
+1 -1
View File
@@ -122,7 +122,7 @@ export default function InsightsGewichtPage() {
</Link>
</Button>
}
coachPrefill="I haven't recorded any weight yet. Why does it matter, and what should I know before I start tracking?"
coachPrefill={t("insights.emptyState.weight.coachPrefill")}
/>
</SubPageShell>
);
+1 -1
View File
@@ -142,7 +142,7 @@ export default function InsightsWorkoutsPageClient() {
</Button>
) : null
}
coachPrefill="I haven't logged any workouts yet. Why does tracking them matter, and what should I focus on first?"
coachPrefill={t("insights.workouts.emptyState.coachPrefill")}
/>
) : (
<>
@@ -24,7 +24,6 @@ export default function InsightsWristTemperaturePage() {
color="var(--chart-5)"
emptyStateIcon={<Thermometer className="size-6" />}
emptyStateCtaType={null}
coachPrefill="I haven't logged any wrist-temperature data yet. What does this metric tell me about my health, and how do I improve it?"
/>
);
}