From b2ff41070c052d8cf8179a2d3346f82caa7cf3ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Mon, 22 Jun 2026 07:01:03 +0200 Subject: [PATCH] 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. --- scripts/seed-demo.ts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/scripts/seed-demo.ts b/scripts/seed-demo.ts index 36213bace..22f797799 100644 --- a/scripts/seed-demo.ts +++ b/scripts/seed-demo.ts @@ -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