feat(dashboard): promote a Today hero above the tile strip

Surface the day's read at the top of the dashboard: a Today hero that
renders the daily digest — the health score with an honest
provisional/final and sleep-pending face, the briefing lead with a
read-the-full-briefing affordance, and the worth-a-look rail of priority
cards. The dense tile grid and chart rows stay exactly where they are,
one scroll below, so muscle memory survives and no new nav destination
is added.

The hero reads one cached digest cell (GET /api/daily/digest) through the
centralised query-key factory and unwraps the envelope; it recomputes
nothing and never warms a provider on mount. It is gated on the insights
module and self-gates its empty state: a genuinely empty account renders
nothing rather than an alarming card, while an account with a score but
nothing notable gets a calm all-clear line in the rail's place. A shimmer
skeleton holds the footprint while the digest loads.

Priority-card actions wire to their existing destinations by construction
(log dose, reconnect a sync, view check-ups). New copy lands in all six
locales.
This commit is contained in:
Marc-André Bombeck committed 2026-07-16 19:31:13 +02:00
1 parent ba6c0990bf
commit 168c1c85d7
14 files changed
+581

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
/**
* Query keys — the unified daily-value system (S2 Today surface).
* Part of the centralized factory; aggregated in `./index.ts`.
*
* The Today hero reads ONE cell against `GET /api/daily/digest` (the
* `DailyDigest` DTO S1 shipped). A single flat key: the digest is a
* per-user daily read with no discriminator, so `["daily","digest"]`
* is the whole surface. Kept in the factory so a future daily-data
* mutation can invalidate it by prefix without a bare-array literal
* (the `healthlog/queryKey-factory` rule bans those).
*/
export const dailyKeys = {
dailyDigest: () => ["daily", "digest"] as const,
};
+2
View File
@@ -21,6 +21,7 @@ import { coachKeys } from "./coach";
import { familyHistoryKeys } from "./family-history";
import { customMetrics } from "./custom-metrics";
import { cycleKeys } from "./cycle";
import { dailyKeys } from "./daily";
import { dashboardKeys } from "./dashboard";
import { environmentKeys } from "./environment";
import { documentKeys } from "./documents";
@@ -41,6 +42,7 @@ export const queryKeys = {
...authKeys,
...measurementKeys,
...moodKeys,
...dailyKeys,
...dashboardKeys,
...insightsKeys,
...medicationKeys,