feat(demo): showcase the seeded tiles on the demo dashboard

The demo account seeds rich sleep, steps, glucose, VO2max and workout
data but inserted no dashboard layout, so the home page rendered the
new-account default and under-sold the product on its primary surface.
Persist an explicit dashboard layout derived from the default with the
seeded-rich strip tiles forced on and the daily-verdict hero enabled, so
a fresh seed renders a full, lived-in dashboard for screenshots.
This commit is contained in:
Marc-André Bombeck committed 2026-06-22 07:01:03 +02:00
1 parent efd0470bc1
commit b2ff41070c
1 file changed
+30
+30
View File
@@ -48,6 +48,10 @@ import { Buffer } from "node:buffer";
import pg from "pg";
import { encryptToBytes } from "../src/lib/ai/coach/bytes-codec";
import { encrypt } from "../src/lib/crypto";
import {
DEFAULT_DASHBOARD_LAYOUT,
serializeDashboardLayout,
} from "../src/lib/dashboard-layout";
import { VALUE_RANGES } from "../src/lib/validations/measurement";
const DATABASE_URL = process.env.DATABASE_URL;
@@ -253,6 +257,32 @@ async function seed() {
],
);
// ── Dashboard showcase layout ─────────────
// The demo seeds rich sleep / steps / glucose / VO2max / vorsorge data,
// so persist an explicit dashboard layout that surfaces those tiles plus
// the daily-verdict hero. The v1.20.0 defaults already turn the data
// tiles on, but writing the layout verbatim keeps the public demo's home
// page stable regardless of future default tweaks. Derived from
// DEFAULT_DASHBOARD_LAYOUT with the seeded-rich strip tiles forced on.
const SHOWCASE_TILE_IDS = new Set([
"sleep",
"steps",
"glucose",
"vo2Max",
"recentWorkouts",
]);
const demoDashboardLayout = serializeDashboardLayout({
...DEFAULT_DASHBOARD_LAYOUT,
heroVisible: true,
widgets: DEFAULT_DASHBOARD_LAYOUT.widgets.map((w) =>
SHOWCASE_TILE_IDS.has(w.id) ? { ...w, tileVisible: true } : w,
),
});
await client.query(
`UPDATE users SET dashboard_widgets_json = $1 WHERE id = $2`,
[JSON.stringify(demoDashboardLayout), userId],
);
// ── Measurements (90 days) ────────────────
// The loop runs i = 0..days (inclusive) so the final iteration lands a
// point for TODAY (daysAgo(0)) — every headline metric has a current