fix(insights): let the lab-comparison card age out, and give its delta the row's tier

Two things about the card that shows what changed since the last panel.

The comparison had no expiry. Someone whose newest panel is years old was
still reading "since your last panel" about a draw from another year — not
stale UI state but a stale sentence, and one the app kept repeating on the
overview every day.

The window is a year, applied to the data rather than to a per-user
dismissal. A year because routine panels are commonly drawn annually, so a
shorter window would hide a comparison that is genuinely the newest thing
somebody has for months out of every year, while past a year the wording
cannot be defended at all. Doing it on the data means nothing to
acknowledge, nothing to persist, no housekeeping asked of anyone, and one
answer for every client through the existing absent contract — the card
already un-mounts on it, and so does anything else reading that route.
Verified in both directions over the real endpoint.

The delta on the right was muted at the smaller size, the same typography
as the meta line under the analyte, so it optically hung off that lower
line and the row read as bottom-aligned even though it measures centred to
the pixel at every width. A delta is the number the row exists to report,
so it takes the content tier, and the cell states its own centring rather
than inheriting it.

The existing cases pinned their clock at the same time: fixed fixture days
against a relative window is a test that passes until a date in the future
and then fails for reasons unrelated to the code.
This commit is contained in:
Marc-André Bombeck committed 2026-08-07 16:52:24 +02:00
1 parent 41faf165ee
commit 190941944c
4 files changed
+140 -21

No files matched your search

@@ -97,8 +97,16 @@ export function LabsChangesCard({
{labelKey ? ` · ${t(labelKey)}` : ""}
</p>
</div>
{/* The delta is CONTENT — the number the row exists to report —
so it takes the analyte's tier, not the meta tier of the
line under it (UI-STANDARDS §3). At `text-xs` muted it wore
the sub-line's typography and optically attached itself to
that lower line, which is what made a row centred to the
pixel read as bottom-aligned. `self-center` states the row's
alignment on the cell itself so it survives a future change
to the row's own `items-*`. */}
<p
className="text-muted-foreground shrink-0 text-xs tabular-nums"
className="text-foreground shrink-0 self-center text-sm tabular-nums"
data-slot="labs-change-delta"
>
{signedDelta}