fix(insights): leave mood out of the trends row when its module is off

The tab strip already hides the Mood pill when the mood module is off, but
the trends row still charted mood, both from a briefing finding and in its
blood pressure / weight / mood fallback. selectTrendCharts now takes the
metrics to leave out, and the overview passes mood when the module is off.

Refs #975
This commit is contained in:
Marc-André Bombeck committed 2026-09-16 12:56:09 +02:00
1 parent c7f7a2925f
commit 2b512501db
4 files changed
+46 -3

No files matched your search

+8 -1
View File
@@ -13,6 +13,7 @@ import {
selectTrendCharts,
type TrendAnnotationKey,
type TrendChartConfig,
type SelectTrendChartsOptions,
} from "@/lib/insights/trend-chart-select";
import {
TrendAnnotation,
@@ -65,6 +66,11 @@ const MoodChart = dynamic(
);
interface TrendsRowProps {
/**
* Metrics to leave out because their module is switched off (for
* example `mood`). Passed straight to `selectTrendCharts`.
*/
hiddenMetrics?: SelectTrendChartsOptions["hiddenMetrics"];
/**
* Daily briefing payload. Drives the chart set: the row charts the
* metrics the briefing flags, in order, deduped + capped. `null` /
@@ -132,13 +138,14 @@ export function TrendsRow({
annotations,
confidence,
loading = false,
hiddenMetrics,
}: TrendsRowProps) {
const { t } = useTranslations();
// v1.8.5 — derive the chart set from the briefing. No new fetch: the
// briefing payload is already on the page (advisor cache), so this is
// a pure read that respects the v1.8.3 anti-freeze contract.
const charts = selectTrendCharts(briefing);
const charts = selectTrendCharts(briefing, { hiddenMetrics });
// v1.4.36 W2 T3 — derive the tri-state status per metric from the
// advisor's loading flag + the annotation presence. Pending wins