fix(medications): split the card next/last dose lines into label-left, value-right rows

The next-intake and last-intake lines on the medication cards ran the
label and the time together on one run of text, reading as crammed. Lay
each line out as a two-column row — bold label pinned left, value flush
right — so the two rows read as distinct, aligned columns. The label
truncates first on a narrow viewport; the time never truncates.

The GLP-1 card routes through the same shared slot and now overrides only
the left-column label with its appointment-phrased wording, so the value
column carries the time and the optional rotation nudge. Its value strings
drop the now-redundant leading label.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Marc-André BombeckandClaude Opus 4.8 committed 2026-06-05 15:34:44 +02:00
1 parent c59290ddc6
commit 83cf4eff2e
10 files changed
+114 -75

No files matched your search

@@ -320,13 +320,13 @@ describe("<Glp1MedicationCard> — GLP-1 variant rendering", () => {
client,
);
// The with-site copy reads "Last: <label> · <site>"; both halves
// must show up in the SSR string.
// The last-line renders the "Last:" label in its own left column and
// the value (label · site) flush right; both halves show in the SSR.
expect(html).toContain("Last:");
expect(html).toContain("Abdomen, lower left");
// The next-injection helper produces one of three strings — today,
// tomorrow, or "in N days". All three contain the localised "Next:"
// prefix from `glp1NextInjection*` keys.
// The next-line carries the "Next:" label in its left column,
// independent of which of the three value variants (today / tomorrow /
// "in N days") the helper produced.
expect(html).toMatch(/Next:/);
});
@@ -448,11 +448,19 @@ describe("medication card symmetry — Ramipril vs Mounjaro", () => {
expect(html).not.toContain("text-foreground/85");
// No literal em-dash placeholder for an absent next-injection.
expect(html).not.toContain(">—<");
// Both lines present (next + last), so two muted <p> in the slot.
// Both lines present (next + last). Each line is a two-column
// label-left / value-right row (`flex … justify-between`) so the
// label and the time read as distinct columns rather than crammed
// onto one run of text. Two such rows in the slot.
const slotStart = html.indexOf("min-h-[2.75rem]");
const slot = html.slice(slotStart, slotStart + 800);
const lines = slot.match(/<p class="text-muted-foreground">/g) ?? [];
expect(lines.length).toBe(2);
const slot = html.slice(slotStart, slotStart + 1200);
const rows =
slot.match(
/<div class="text-muted-foreground flex items-baseline justify-between gap-3">/g,
) ?? [];
expect(rows.length).toBe(2);
// The value is pinned flush-right in its own column.
expect(slot).toContain('<span class="text-right">');
}
});