Build 0pt ordering flow: configurator, deposit/escrow, production tracker, validation

Customer order lifecycle on the mono design system: red + provenance tokens, useReveal hook, lib/data pricing model, ProvenanceBadge/CellProvenance, OrderStepper, and 4 routes with live pricing, 50/50 escrow, simulated production, 4-view validation. tsc clean; next build green (5 routes).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-24 17:28:24 +02:00
co-authored by Claude Opus 4.8
parent 5e53a6d71c
commit 24035dec8b
12 changed files with 1253 additions and 0 deletions
+57
View File
@@ -0,0 +1,57 @@
import Link from "next/link";
const STEPS = [
{ n: 1, label: "Konfigurera", href: "/bestall" },
{ n: 2, label: "Förskott", href: "/bestall/forskott" },
{ n: 3, label: "Produktion", href: null },
{ n: 4, label: "Validera", href: null },
] as const;
/** Mono 4-step indicator. Active step carries the single red marker. */
export function OrderStepper({ active }: { active: 1 | 2 | 3 | 4 }) {
return (
<nav
aria-label="Beställningssteg"
className="flex w-full items-center gap-0 border-b border-border bg-background"
>
{STEPS.map((s, i) => {
const isActive = s.n === active;
const isDone = s.n < active;
const inner = (
<span className="flex items-center gap-3">
<span
className="flex h-6 w-6 items-center justify-center font-mono text-[11px]"
style={{
backgroundColor: isActive ? "var(--accent-red)" : isDone ? "var(--foreground)" : "transparent",
color: isActive || isDone ? "#fff" : "var(--muted-foreground)",
border: isActive || isDone ? "none" : "1px solid var(--border)",
}}
>
{s.n}
</span>
<span
className="font-mono text-[11px] uppercase tracking-[0.12em]"
style={{ color: isActive ? "var(--foreground)" : "var(--muted-foreground)" }}
>
{s.label}
</span>
</span>
);
return (
<div
key={s.n}
className="flex flex-1 items-center justify-center border-r border-border px-4 py-3 last:border-r-0"
>
{s.href && (isDone || isActive) ? (
<Link href={s.href} className="transition-opacity hover:opacity-70">
{inner}
</Link>
) : (
inner
)}
</div>
);
})}
</nav>
);
}
+75
View File
@@ -0,0 +1,75 @@
import type { ProvLevel } from "@/lib/data";
const PROV_COLOR: Record<ProvLevel, string> = {
0: "var(--prov-0)", // ej tillgänglig / licens
1: "var(--prov-1)", // en källa
2: "var(--prov-2)", // delvis bekräftad
3: "var(--prov-3)", // flera källor överens
};
const PROV_LABEL: Record<ProvLevel, string> = {
0: "Ej tillgänglig / licens",
1: "En källa",
2: "Delvis bekräftad",
3: "Flera källor överens",
};
/**
* The product's whole promise in one chip: where a value came from and how
* confident we are. The ONLY place non-mono color (besides the single red CTA)
* is allowed to appear.
*/
export function ProvenanceBadge({
level,
source,
freshness,
}: {
level: ProvLevel;
source: string;
freshness?: string;
}) {
return (
<span
className="inline-flex items-center gap-1.5 border border-border px-1.5 py-0.5 font-mono text-[10.5px] tracking-[0.02em] text-muted-foreground"
title={PROV_LABEL[level]}
>
<span
aria-hidden
className="inline-block h-[7px] w-[7px]"
style={{
backgroundColor: level === 0 ? "transparent" : PROV_COLOR[level],
border: level === 0 ? `1px solid ${PROV_COLOR[0]}` : "none",
}}
/>
<span className="uppercase">{source}</span>
{freshness ? (
<>
<span className="text-border">·</span>
<span>{freshness}</span>
</>
) : null}
</span>
);
}
/** Just the 9px status square — for the end of table cells. */
export function CellProvenance({ level }: { level: ProvLevel }) {
return (
<span
aria-hidden
title={PROV_LABEL[level]}
className="ml-1.5 inline-block h-[9px] w-[9px] align-middle"
style={{
backgroundColor: level === 0 ? "transparent" : PROV_COLOR[level],
border: level === 0 ? `1px solid ${PROV_COLOR[0]}` : "none",
}}
/>
);
}
export const PROVENANCE_LEGEND: { level: ProvLevel; text: string }[] = [
{ level: 3, text: "Flera källor överens" },
{ level: 2, text: "Delvis bekräftad" },
{ level: 1, text: "En källa" },
{ level: 0, text: "Licens krävs / ej tillgänglig" },
];