From 8dced001881fb11b47edb7e82b33888e49cb07ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Mon, 1 Jun 2026 17:26:38 +0200 Subject: [PATCH] feat(medications): label each intake history row with its logging origin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The intake history surfaced the coarse IntakeSource enum directly, so a dose logged from the iOS app showed nothing meaningful. Map the enum to the practical client it represents — WEB to Web, API to iOS App, REMINDER to Reminder, IMPORT to Import — and render it as a muted "via {origin}" caption on each intake row next to the status. No schema or API change; the source value already rides the existing intake response. Tighten the en/de labels that read "External API" and "Telegram / Reminder" into the same origin vocabulary across all six locales. --- messages/de.json | 9 +++++---- messages/en.json | 9 +++++---- messages/es.json | 3 ++- messages/fr.json | 3 ++- messages/it.json | 3 ++- messages/pl.json | 3 ++- .../__tests__/intake-history-list-v2.test.tsx | 4 ++-- .../medications/intake-history-list-v2.tsx | 16 ++++++++++++---- 8 files changed, 32 insertions(+), 18 deletions(-) diff --git a/messages/de.json b/messages/de.json index bf1251f77..c55754cd6 100644 --- a/messages/de.json +++ b/messages/de.json @@ -1006,10 +1006,11 @@ "phaseResetDefaults": "Auf Defaults zurücksetzen", "phaseSaved": "Erinnerungsphasen gespeichert", "phaseReset": "Auf Defaults zurückgesetzt", - "sourceWeb": "Webseite", - "sourceApi": "Externe API", - "sourceReminder": "Telegram / Erinnerung", - "sourceImport": "CSV-Import", + "sourceWeb": "Web", + "sourceApi": "iOS-App", + "sourceReminder": "Erinnerung", + "sourceImport": "Import", + "intakeSourceVia": "über {origin}", "intakeHistoryEmptyTitle": "Noch keine Einnahmen erfasst", "intakeHistoryEmptyDescription": "Trage eine Einnahme auf der Tagesübersicht ein, um den Verlauf aufzubauen.", "intakeHistoryEmptyAction": "Zur Tagesübersicht", diff --git a/messages/en.json b/messages/en.json index d9a1c06b9..2a3a1109a 100644 --- a/messages/en.json +++ b/messages/en.json @@ -1006,10 +1006,11 @@ "phaseResetDefaults": "Reset to defaults", "phaseSaved": "Reminder phases saved", "phaseReset": "Reset to defaults", - "sourceWeb": "Website", - "sourceApi": "External API", - "sourceReminder": "Telegram / Reminder", - "sourceImport": "CSV Import", + "sourceWeb": "Web", + "sourceApi": "iOS App", + "sourceReminder": "Reminder", + "sourceImport": "Import", + "intakeSourceVia": "via {origin}", "intakeHistoryEmptyTitle": "No intakes recorded yet", "intakeHistoryEmptyDescription": "Log a dose on the daily intake page to start building the history.", "intakeHistoryEmptyAction": "Open daily intake", diff --git a/messages/es.json b/messages/es.json index 870556bce..646426611 100644 --- a/messages/es.json +++ b/messages/es.json @@ -1007,9 +1007,10 @@ "phaseSaved": "Fases de recordatorio guardadas", "phaseReset": "Restablecidas a valores por defecto", "sourceWeb": "Web", - "sourceApi": "API", + "sourceApi": "App de iOS", "sourceReminder": "Recordatorio", "sourceImport": "Importación", + "intakeSourceVia": "vía {origin}", "intakeHistoryEmptyTitle": "Aún no hay tomas", "intakeHistoryEmptyDescription": "En cuanto registres una toma, aparecerá aquí con la hora y la fuente.", "intakeHistoryEmptyAction": "Registrar toma", diff --git a/messages/fr.json b/messages/fr.json index 857daa932..27f3d555d 100644 --- a/messages/fr.json +++ b/messages/fr.json @@ -1007,9 +1007,10 @@ "phaseSaved": "Phases de rappel enregistrées", "phaseReset": "Réinitialisées par défaut", "sourceWeb": "Web", - "sourceApi": "API", + "sourceApi": "App iOS", "sourceReminder": "Rappel", "sourceImport": "Import", + "intakeSourceVia": "via {origin}", "intakeHistoryEmptyTitle": "Aucune prise pour l’instant", "intakeHistoryEmptyDescription": "Dès que tu enregistreras une prise, elle apparaîtra ici avec l’heure et la source.", "intakeHistoryEmptyAction": "Enregistrer une prise", diff --git a/messages/it.json b/messages/it.json index a3f58daa8..4b4417156 100644 --- a/messages/it.json +++ b/messages/it.json @@ -1007,9 +1007,10 @@ "phaseSaved": "Fasi di promemoria salvate", "phaseReset": "Ripristinate ai valori predefiniti", "sourceWeb": "Web", - "sourceApi": "API", + "sourceApi": "App iOS", "sourceReminder": "Promemoria", "sourceImport": "Importazione", + "intakeSourceVia": "tramite {origin}", "intakeHistoryEmptyTitle": "Ancora nessuna assunzione", "intakeHistoryEmptyDescription": "Appena registrerai un’assunzione, comparirà qui con orario e sorgente.", "intakeHistoryEmptyAction": "Registra un’assunzione", diff --git a/messages/pl.json b/messages/pl.json index 265b3f967..87e160988 100644 --- a/messages/pl.json +++ b/messages/pl.json @@ -1007,9 +1007,10 @@ "phaseSaved": "Fazy przypomnień zapisane", "phaseReset": "Przywrócono wartości domyślne", "sourceWeb": "Web", - "sourceApi": "API", + "sourceApi": "Aplikacja iOS", "sourceReminder": "Przypomnienie", "sourceImport": "Import", + "intakeSourceVia": "przez {origin}", "intakeHistoryEmptyTitle": "Brak przyjęć", "intakeHistoryEmptyDescription": "Gdy tylko zarejestrujesz przyjęcie, pojawi się tu wraz z godziną i źródłem.", "intakeHistoryEmptyAction": "Zarejestruj przyjęcie", diff --git a/src/components/medications/__tests__/intake-history-list-v2.test.tsx b/src/components/medications/__tests__/intake-history-list-v2.test.tsx index f42ebc513..1b1352f71 100644 --- a/src/components/medications/__tests__/intake-history-list-v2.test.tsx +++ b/src/components/medications/__tests__/intake-history-list-v2.test.tsx @@ -143,8 +143,8 @@ describe(" — populated rows", () => { const html = render(, client); expect(html).toContain("Taken"); expect(html).toContain("Skipped"); - expect(html).toContain("Website"); - expect(html).toContain("Telegram / Reminder"); + expect(html).toContain("via Web"); + expect(html).toContain("via Reminder"); }); it("renders the taken row with a green Check chip and the skipped row with an outline SkipForward chip", () => { diff --git a/src/components/medications/intake-history-list-v2.tsx b/src/components/medications/intake-history-list-v2.tsx index 1053285cf..27cdb3432 100644 --- a/src/components/medications/intake-history-list-v2.tsx +++ b/src/components/medications/intake-history-list-v2.tsx @@ -65,8 +65,11 @@ import { * - Status chip: green Check + "Eingenommen" for taken rows, * outline SkipForward + "Übersprungen" for skipped rows. The * component never labels a row both at once. - * - Source badge surfaces WEB / API / REMINDER / IMPORT using the - * existing `medications.source*` keys. + * - Source badge surfaces where the intake was logged — WEB → "Web", + * API → "iOS App", REMINDER → "Reminder", IMPORT → "Import" — wrapped + * in a muted "via {origin}" caption next to the status. The labels map + * the coarse `IntakeSource` enum to the practical client per the + * existing `medications.source*` keys; there is no finer client field. * - Empty state copy + CTA back to the daily intake page. * - No edit-in-row, no delete buttons. */ @@ -377,8 +380,13 @@ export function IntakeHistoryListV2({ ) : null} - - {sourceLabels[event.source] ?? event.source} + + {t("medications.intakeSourceVia", { + origin: sourceLabels[event.source] ?? event.source, + })} {showRowActions && (