feat(medications): label each intake history row with its logging origin

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.
This commit is contained in:
Marc-André Bombeck committed 2026-06-01 17:31:02 +02:00
1 parent c2808a9c70
commit 8dced00188
8 files changed
+32 -18

No files matched your search

@@ -143,8 +143,8 @@ describe("<IntakeHistoryListV2> — populated rows", () => {
const html = render(<IntakeHistoryListV2 medicationId="med-1" />, 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", () => {
@@ -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}
</TableCell>
<TableCell>
<Badge variant="outline" className="text-xs">
{sourceLabels[event.source] ?? event.source}
<Badge
variant="outline"
className="text-muted-foreground text-xs font-normal"
>
{t("medications.intakeSourceVia", {
origin: sourceLabels[event.source] ?? event.source,
})}
</Badge>
</TableCell>
{showRowActions && (