A full rebuild of the cafe dashboard from Narong's 2026-07-17 mockups: Sales Overview ·
Today's Summary · Sales Behaviors, sharing a greeting header, date-range + shop
filter, Export, and an alerts bar. Deployed to nix-cafe-staging; renders clean on real staging SSO for
Pro and Starter (staging smoke 5/5). No migration.
What. One URL-driven tabbed shell replaces the old single-page dashboard. Reuses the reports
period/filter/summary machinery and adds lib/db/dashboard.ts (5 tz-aware, shop-scoped, pool-safe
aggregation DAOs) plus hand-built chart primitives (donut, day×hour heatmap, sparkline, trend line — on the repo's
recharts). Mockup cards our data can't yet back are rendered as greyed "Coming soon" stubs rather than faked.
Data-availability decisions
Stubbed (greyed "Coming soon") — Sales by Channel & Top Channel (no per-app delivery integration), Gross Profit (no COGS/cost field), Delivery % (no delivery metric), and the alerts bar's Low stock / Devices offline (inventory parked, no device registry).
Backed by real data — sales/orders/AOV/cups + vs-prior deltas, category & payment & daypart donuts, per-shop performance (with sparklines), top items, hourly + heatmap, order-type mix (Dine-in / Takeaway / Food App), repeat-vs-new, basket trend. "Shifts need closing" is the one live alert (open sessions).
Tab 1 — Sales Overview
Category + Payment donuts (Sales-by-Channel stubbed), per-shop performance table with vs-prev deltas + sparklines, top selling items, and KPI tiles with deltas (Gross Profit + Delivery % stubbed).
Tab 2 — Today's Summary
Six KPIs vs yesterday, today's summary list, Sales-Today-by-Hour with peak stats, payment mix donut, top selling today, and top shops today. Pinned to the tenant-local "today" regardless of the range picker.
Tab 3 — Sales Behaviors
Day×hour sales heatmap, behavior highlights (peak hour / strongest day / avg basket / repeat rate), daypart donut, weekly traffic + basket-size trend lines, order-type mix, repeat-vs-new, and the stubbed Top Channel card.
Checks
Typecheck (tsc --noEmit, nix-cafe)
clean
New DAOs verified against local lumiere (March 2026, ~7k orders): 4 ranked shops with deltas + sparklines, 4 categories, Mon–Sun heatmap (91 active cells)
pass
Staging deploy — page renders on real SSO, demo (Pro) + lumiere (Starter)
pass
Staging smoke regression
5/5
RSC bug found + fixed during Gate 2 — a function prop passed to a client chart (would have 500'd the Behaviors tab)
fixed
Pre-existing formatter bug fixed — same-month date range read "March 1 – 2026 (day: 31)"; now "March 1 – 31, 2026" (also fixes the reports page)
fixed
Notes
Screenshots use the rich local lumiere-coffee seed (20.8k orders); staging tenants have no seeded order history yet, so the same page there shows empty states. The deploy + smoke prove the real HTTP/SSO contract on staging.
Order-type mix shows Dine-in / Takeaway / Food App (checkout dine-type) — not a per-app delivery channel. Repeat-vs-new counts identified customers only (walk-ins with no customer record are excluded).
nix-cafe staging1326112 (Worker version
1cb33424). No migration. Parked for the scheduled prod promote alongside the promotions bundle.