feat(medications): show per-slot units on both med cards

Surface the per-schedule units-per-dose beside the per-slot dose the
card already prints, identically on the standard and the GLP-1 card,
so a split plan reads at a glance which time takes a half. Muted
addendum, no width movement.
This commit is contained in:
Marc-André Bombeck committed 2026-08-10 07:58:48 +02:00
1 parent 64093d2124
commit 80958ab307
2 files changed
+25

No files matched your search

@@ -23,6 +23,7 @@ import { apiGet, apiPost } from "@/lib/api/api-fetch";
import { formatDateTime, formatTime } from "@/lib/format";
import { getMedicationCategoryLabel } from "@/lib/medications/category-label";
import { formatDose } from "@/lib/medications/format-dose";
import { formatUnitsPerDose } from "@/components/medications/units-per-dose";
import { getDayOfWeekInTz } from "@/lib/tz/local-day";
import { type InjectionSiteKey } from "@/lib/medications/injection-sites";
import { LogInjectionSiteDialog } from "@/components/medications/log-injection-site-dialog";
@@ -72,6 +73,8 @@ interface ScheduleLite {
/** Cadence fields the supply-runway estimate reads (v1.16.11). */
rrule?: string | null;
rollingIntervalDays?: number | null;
/** #219 — per-schedule units consumed per dose. NULL inherits the med level. */
unitsPerDose?: number | null;
}
interface DoseChangeLite {
@@ -483,6 +486,16 @@ export function Glp1MedicationCard({
— {formatDose(schedule.dose, t)}
</span>
)}
{typeof schedule?.unitsPerDose === "number" &&
schedule.unitsPerDose > 0 && (
<span className="text-muted-foreground hidden sm:inline">
{" "}
·{" "}
{t("medications.perSlotUnits", {
units: formatUnitsPerDose(schedule.unitsPerDose),
})}
</span>
)}
</>
)
) : null;
@@ -13,6 +13,7 @@ import { formatDateTime, formatTime } from "@/lib/format";
import { getDateTimeFormat } from "@/lib/intl/formatter-cache";
import { getMedicationCategoryLabel } from "@/lib/medications/category-label";
import { formatDose } from "@/lib/medications/format-dose";
import { formatUnitsPerDose } from "@/components/medications/units-per-dose";
import { reduceCurrentWindowStatus } from "@/lib/medications/window-status";
import { resolveNextDueDayLabel } from "@/lib/medications/next-due-day-label";
import { resolveDisplayedSlotInstant } from "@/components/medications/card-parts/displayed-slot-instant";
@@ -52,6 +53,8 @@ interface Schedule {
/** Cadence fields the supply-runway estimate reads (v1.16.11). */
rrule?: string | null;
rollingIntervalDays?: number | null;
/** #219 — per-schedule units consumed per dose. NULL inherits the med level. */
unitsPerDose?: number | null;
}
interface Medication {
@@ -448,6 +451,15 @@ export function MedicationCard({
— {formatDose(s.dose, t)}
</span>
)}
{typeof s.unitsPerDose === "number" && s.unitsPerDose > 0 && (
<span className="text-muted-foreground hidden sm:inline">
{" "}
·{" "}
{t("medications.perSlotUnits", {
units: formatUnitsPerDose(s.unitsPerDose),
})}
</span>
)}
</>
);
})()