fix(release): harden Today arrival rendering

This commit is contained in:
Marc-André Bombeck committed 2026-07-19 19:55:40 +02:00
1 parent d40da09558
commit c97ad3ed55
7 files changed
+81 -38

No files matched your search

@@ -76,6 +76,23 @@ describe("TodayHero — the just-in chip", () => {
expect(html).toContain("Just in");
});
it("renders for a bare account when the arrival has no generated line", () => {
const html = render(
<TodayHero
digest={digest({
score: null,
briefingLead: null,
worthALook: [],
reactionLine: null,
justIn: { kind: "sleep_night", at: ARRIVED_AT },
})}
/>,
);
expect(html).toContain('data-slot="today-hero"');
expect(html).toContain('data-slot="today-hero-just-in"');
});
it("emits NO formatted time and no raw ISO instant on the server pass", () => {
const html = render(
<TodayHero
+14 -9
View File
@@ -126,15 +126,20 @@ export function TodayHero({ digest }: { digest: DailyDigest }) {
const justInTime = digest.justIn ? formatJustInTime(digest.justIn.at) : null;
// Calm degrade (plan §3): a genuinely empty account — no score, no rail
// items, and no cached briefing lead — surfaces nothing here. The tile
// strip below carries its own "add your first reading" empty state, so a
// second alarming empty card on the hero would be noise. The all-clear
// state (score present, nothing needs attention) is handled inline below.
// A freshly-generated reaction line counts as content in its own right: an
// otherwise-bare account whose first reading just landed has something
// honest to say, and swallowing it here would hide the one moment this
// surface exists for.
if (!hasScore && !hasItems && !digest.briefingLead && !digest.reactionLine) {
// items, no cached briefing lead, and no fresh arrival — surfaces nothing
// here. The tile strip below carries its own "add your first reading" empty
// state, so a second alarming empty card on the hero would be noise. The
// all-clear state (score present, nothing needs attention) is handled inline
// below. A fresh marker counts as content even when line generation was
// unavailable: the deterministic digest line still gives the hero an honest
// lead, and hiding the marker would lose the arrival moment entirely.
if (
!hasScore &&
!hasItems &&
!digest.briefingLead &&
!digest.reactionLine &&
!digest.justIn
) {
return null;
}