feat: buy everything + monitor everything in UI (client order ledger)

lib/order-client: createOrder records each order to a localStorage ledger; portal dashboard + admin queue merge it with /api/orders; order tracker falls back to it. Wired all buy paths: configurator, beskriv (custom services), and one-click catalog Beställ. Makes buy->monitor work in the browser now; becomes server-truth when Postgres is connected. tsc 0, build green.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
2026-06-25 02:10:12 +02:00
co-authored by Claude Opus 4.8
parent 78e38e9add
commit 56e117a6d6
7 changed files with 108 additions and 28 deletions
+2 -1
View File
@@ -4,6 +4,7 @@ import { useCallback, useEffect, useState } from "react";
import { PortalShell, StatusPill } from "@/components/portal-shell";
import { LoadingSkeleton, ErrorState, EmptyState } from "@/components/states";
import { formatSEK } from "@/lib/data";
import { mergeOrders } from "@/lib/order-client";
interface Order {
order_id: string;
@@ -42,7 +43,7 @@ export default function AdminPage() {
fetch("/api/orders", { cache: "no-store" }).then((r) => r.json()),
fetch("/api/admin/metrics", { cache: "no-store" }).then((r) => r.json()),
]);
setOrders(Array.isArray(o) ? o : []);
setOrders(mergeOrders(Array.isArray(o) ? o : []) as Order[]);
setMetrics(m);
} catch {
setError(true);