From 1a4703f4fee16f9f5156144ef65e1bb7541e57ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Wed, 4 Nov 2026 00:17:00 +0100 Subject: [PATCH] feat(insights): name the part of the day on the blood pressure stats while narrowed The stat strip reads the chart's visible window, so with the chart narrowed to the morning its figures were morning figures under a plain Systolic label. The column label now says so. Russian texts for the time-of-day card. --- messages/de.json | 6 ++++ messages/en.json | 6 ++++ messages/es.json | 6 ++++ messages/fr.json | 6 ++++ messages/it.json | 6 ++++ messages/ko.json | 6 ++++ messages/nl.json | 6 ++++ messages/pl.json | 6 ++++ messages/pt-BR.json | 6 ++++ messages/ru.json | 34 +++++++++++++++++++ src/app/insights/blood-pressure/page.tsx | 4 +-- .../use-bp-time-of-day-state.ts | 18 ++++++++++ 12 files changed, 108 insertions(+), 2 deletions(-) diff --git a/messages/de.json b/messages/de.json index 9d2ed8e39..bbc6301ec 100644 --- a/messages/de.json +++ b/messages/de.json @@ -4999,6 +4999,12 @@ "morning": "Blutdruck morgens", "midday": "Blutdruck mittags", "evening": "Blutdruck abends" + }, + "statsLabel": "{series}, {part}", + "statsPart": { + "morning": "morgens", + "midday": "mittags", + "evening": "abends" } } }, diff --git a/messages/en.json b/messages/en.json index 1779f56a7..94db54003 100644 --- a/messages/en.json +++ b/messages/en.json @@ -4999,6 +4999,12 @@ "morning": "Blood pressure in the morning", "midday": "Blood pressure at midday", "evening": "Blood pressure in the evening" + }, + "statsLabel": "{series}, {part}", + "statsPart": { + "morning": "morning", + "midday": "midday", + "evening": "evening" } } }, diff --git a/messages/es.json b/messages/es.json index b94778317..859f592ad 100644 --- a/messages/es.json +++ b/messages/es.json @@ -4999,6 +4999,12 @@ "morning": "Tensión arterial por la mañana", "midday": "Tensión arterial a mediodía", "evening": "Tensión arterial por la noche" + }, + "statsLabel": "{series}, {part}", + "statsPart": { + "morning": "por la mañana", + "midday": "al mediodía", + "evening": "por la noche" } } }, diff --git a/messages/fr.json b/messages/fr.json index b66f7a052..87a920617 100644 --- a/messages/fr.json +++ b/messages/fr.json @@ -4999,6 +4999,12 @@ "morning": "Tension artérielle le matin", "midday": "Tension artérielle à midi", "evening": "Tension artérielle le soir" + }, + "statsLabel": "{series}, {part}", + "statsPart": { + "morning": "le matin", + "midday": "à midi", + "evening": "le soir" } } }, diff --git a/messages/it.json b/messages/it.json index 79d09fc5c..06623f5f4 100644 --- a/messages/it.json +++ b/messages/it.json @@ -4999,6 +4999,12 @@ "morning": "Pressione arteriosa al mattino", "midday": "Pressione arteriosa a mezzogiorno", "evening": "Pressione arteriosa alla sera" + }, + "statsLabel": "{series}, {part}", + "statsPart": { + "morning": "al mattino", + "midday": "a mezzogiorno", + "evening": "alla sera" } } }, diff --git a/messages/ko.json b/messages/ko.json index 5ebe59583..cd07355df 100644 --- a/messages/ko.json +++ b/messages/ko.json @@ -4999,6 +4999,12 @@ "morning": "아침 혈압", "midday": "낮 혈압", "evening": "저녁 혈압" + }, + "statsLabel": "{series}, {part}", + "statsPart": { + "morning": "아침", + "midday": "낮", + "evening": "저녁" } } }, diff --git a/messages/nl.json b/messages/nl.json index 2b071a4ec..8e9596274 100644 --- a/messages/nl.json +++ b/messages/nl.json @@ -4999,6 +4999,12 @@ "morning": "Bloeddruk 's ochtends", "midday": "Bloeddruk 's middags", "evening": "Bloeddruk 's avonds" + }, + "statsLabel": "{series}, {part}", + "statsPart": { + "morning": "'s ochtends", + "midday": "'s middags", + "evening": "'s avonds" } } }, diff --git a/messages/pl.json b/messages/pl.json index d56781be3..cffa8cb9b 100644 --- a/messages/pl.json +++ b/messages/pl.json @@ -4999,6 +4999,12 @@ "morning": "Ciśnienie tętnicze rano", "midday": "Ciśnienie tętnicze w południe", "evening": "Ciśnienie tętnicze wieczorem" + }, + "statsLabel": "{series}, {part}", + "statsPart": { + "morning": "rano", + "midday": "w południe", + "evening": "wieczorem" } } }, diff --git a/messages/pt-BR.json b/messages/pt-BR.json index 8f9577e76..4dee685c2 100644 --- a/messages/pt-BR.json +++ b/messages/pt-BR.json @@ -4999,6 +4999,12 @@ "morning": "Pressão arterial pela manhã", "midday": "Pressão arterial à tarde", "evening": "Pressão arterial à noite" + }, + "statsLabel": "{series}, {part}", + "statsPart": { + "morning": "pela manhã", + "midday": "ao meio-dia", + "evening": "à noite" } } }, diff --git a/messages/ru.json b/messages/ru.json index dfe0c8707..6e99a119e 100644 --- a/messages/ru.json +++ b/messages/ru.json @@ -4972,6 +4972,40 @@ "emptyDescription": "В этом диапазоне пока не записано ни одного балла.", "usualRange": "Заштриховано: ваш обычный диапазон, {lo}–{hi}.", "seam": "Линия прерывается там, где изменилось то, что учитывается в балле." + }, + "bpTimeOfDay": { + "title": "По времени суток", + "description": "Ваше среднее давление в каждой части дня за период графика.", + "part": { + "morning": "Утро", + "midday": "День", + "evening": "Вечер" + }, + "filterAll": "Весь день", + "filterLabel": "Показать на графике", + "readingsOne": "{count} измерение", + "readingsFew": "{count} измерения", + "readingsOther": "{count} измерений", + "notEnough": "Слишком мало измерений", + "pulse": "Пульс {value} уд/мин", + "difference": "Утро минус вечер: {systolic}/{diastolic} мм рт. ст.", + "differencePending": "Утро и вечер сравниваются, когда в каждом есть не меньше {min} измерений.", + "hours": "Утро {morning}, день {midday}, вечер {evening}, в вашем часовом поясе.", + "hourRange": "{start}–{end}", + "emptyTitle": "За этот период нет полных измерений", + "emptyDescription": "Здесь появляются измерения, в которых есть и систолическое, и диастолическое значение.", + "error": "Не удалось загрузить средние значения по времени суток.", + "chartTitle": { + "morning": "Давление утром", + "midday": "Давление днём", + "evening": "Давление вечером" + }, + "statsLabel": "{series}, {part}", + "statsPart": { + "morning": "утром", + "midday": "днём", + "evening": "вечером" + } } }, "thresholds": { diff --git a/src/app/insights/blood-pressure/page.tsx b/src/app/insights/blood-pressure/page.tsx index c04281f3a..6cfcd1a45 100644 --- a/src/app/insights/blood-pressure/page.tsx +++ b/src/app/insights/blood-pressure/page.tsx @@ -145,7 +145,7 @@ export default function InsightsBlutdruckPage() { summary: sysSummary, unit: "mmHg", fractionDigits: 0, - seriesLabel: t("charts.systolic"), + seriesLabel: timeOfDay.statsLabel(t("charts.systolic")), icon: ArrowUpRight, windowStats: statsByType?.BLOOD_PRESSURE_SYS ?? null, windowPending: !statsSettled, @@ -155,7 +155,7 @@ export default function InsightsBlutdruckPage() { summary: diaSummary, unit: "mmHg", fractionDigits: 0, - seriesLabel: t("charts.diastolic"), + seriesLabel: timeOfDay.statsLabel(t("charts.diastolic")), icon: ArrowDownRight, windowStats: statsByType?.BLOOD_PRESSURE_DIA ?? null, windowPending: !statsSettled, diff --git a/src/components/insights/blood-pressure/use-bp-time-of-day-state.ts b/src/components/insights/blood-pressure/use-bp-time-of-day-state.ts index b098db687..f8172fe68 100644 --- a/src/components/insights/blood-pressure/use-bp-time-of-day-state.ts +++ b/src/components/insights/blood-pressure/use-bp-time-of-day-state.ts @@ -11,6 +11,7 @@ import { BP_PARTS_OF_DAY, type BpPartOfDay, } from "@/lib/analytics/bp-time-of-day"; +import { useTranslations } from "@/lib/i18n/context"; import { useUrlSearch, writeUrlState } from "@/lib/url-state"; /** The chart's part of the day, or the whole day. */ @@ -24,6 +25,13 @@ export function parseBpChartPart( return BP_PARTS_OF_DAY.find((part) => part === raw); } +/** The stat strip's part-of-day word, so its figures say which readings they are. */ +const STATS_PART_KEYS: Record = { + morning: "insights.bpTimeOfDay.statsPart.morning", + midday: "insights.bpTimeOfDay.statsPart.midday", + evening: "insights.bpTimeOfDay.statsPart.evening", +}; + const CHART_TITLE_KEYS: Record = { morning: "insights.bpTimeOfDay.chartTitle.morning", midday: "insights.bpTimeOfDay.chartTitle.midday", @@ -45,8 +53,11 @@ export function useBpTimeOfDayState(): { /** The chart title's message key while narrowed; undefined for the whole day. */ chartTitleKey: string | undefined; setChartPart: (next: BpChartPart) => void; + /** A stat column's label, naming the part of the day while narrowed. */ + statsLabel: (series: string) => string; days: number; } { + const { t } = useTranslations(); const partOfDay = parseBpChartPart(useUrlSearch()); const setChartPart = useCallback((next: BpChartPart) => { writeUrlState( @@ -63,6 +74,13 @@ export function useBpTimeOfDayState(): { partOfDay, chartTitleKey: partOfDay ? CHART_TITLE_KEYS[partOfDay] : undefined, setChartPart, + statsLabel: (series) => + partOfDay + ? t("insights.bpTimeOfDay.statsLabel", { + series, + part: t(STATS_PART_KEYS[partOfDay]), + }) + : series, days: rangeWindowDays(range), }; }