import Link from "next/link"; import type { ReactNode } from "react"; /** * Verlinkte Karte fuer die Konto-Uebersicht (Bestellungen, Adressen, ...). * Ersetzt den zuvor identischen, icon-losen "border + hover:border-forest"- * Kartenstil, der auf jeder Konto-Seite gleich aussah. */ export function AccountNavCard({ href, icon, title, description, accent = false, className = "", }: { href: string; icon: ReactNode; title: string; description: string; accent?: boolean; className?: string; }) { return ( {icon} {title} {description} ); } const ORDER_STATUS_STYLES: Record = { NEU: "border-ink/20 text-ink/70", BEZAHLT: "border-honey/40 text-honey-dark bg-honey/5", IN_VORBEREITUNG: "border-honey/40 text-honey-dark bg-honey/5", VERSANDBEREIT: "border-honey/40 text-honey-dark bg-honey/5", VERSENDET: "border-forest/40 text-forest bg-forest/5", ABHOLBEREIT: "border-forest/40 text-forest bg-forest/5", ABGEHOLT: "border-forest/40 text-forest bg-forest/5", STORNIERT: "border-red-200 text-red-700 bg-red-50", }; /** Farbcodiertes Status-Label statt reinem Fließtext, damit der Bestellstatus auf einen Blick erkennbar ist. */ export function OrderStatusBadge({ status, label }: { status: string; label: string }) { const style = ORDER_STATUS_STYLES[status] ?? "border-ink/20 text-ink/70"; return ( {label} ); } const VERSAND_STEP_KEYS = ["NEU", "BEZAHLT", "IN_VORBEREITUNG", "VERSANDBEREIT", "VERSENDET"] as const; const ABHOLUNG_STEP_KEYS = ["NEU", "BEZAHLT", "IN_VORBEREITUNG", "ABHOLBEREIT", "ABGEHOLT"] as const; export interface OrderStatusTimelineLabels { ordered: string; paid: string; preparing: string; readyToShip: string; shipped: string; readyForPickup: string; pickedUp: string; cancelled: string; ariaLabel: string; } /** * Visuelle Fortschrittsanzeige statt reinem Status-Badge — nimmt das * Punkt/Linie-Muster der Chargen-Seite (app/charge/[code]) auf, damit * Kundschaft auf einen Blick sieht, wie weit die Bestellung bereits ist, * statt nur den aktuellen Einzelstatus als Wort zu lesen. Nimmt uebersetzte * Labels als Prop entgegen (statt selbst zu uebersetzen), damit diese Datei * server-sicher bleibt — sie wird auch von Admin-Server-Seiten importiert. */ export function OrderStatusTimeline({ status, fulfillmentMethod, labels, }: { status: string; fulfillmentMethod: "VERSAND" | "ABHOLUNG"; labels: OrderStatusTimelineLabels; }) { if (status === "STORNIERT") { return (
); } const stepLabels: Record<(typeof VERSAND_STEP_KEYS)[number] | (typeof ABHOLUNG_STEP_KEYS)[number], string> = { NEU: labels.ordered, BEZAHLT: labels.paid, IN_VORBEREITUNG: labels.preparing, VERSANDBEREIT: labels.readyToShip, VERSENDET: labels.shipped, ABHOLBEREIT: labels.readyForPickup, ABGEHOLT: labels.pickedUp, }; const stepKeys = fulfillmentMethod === "VERSAND" ? VERSAND_STEP_KEYS : ABHOLUNG_STEP_KEYS; const steps = stepKeys.map((key) => ({ key, label: stepLabels[key] })); const currentIndex = steps.findIndex((step) => step.key === status); return (
{steps.map((step, i) => { const isDone = currentIndex >= 0 && i <= currentIndex; const isLineDone = i < currentIndex; return (

{step.label}

); })}
); } /** Leerer-Zustand mit Icon statt eines einzelnen, unauffälligen Fließtext-Satzes. */ export function AccountEmptyState({ icon, title, description, action, }: { icon: ReactNode; title: string; description?: string; action?: ReactNode; }) { return (
{icon}

{title}

{description ? (

{description}

) : null} {action ?
{action}
: null}
); } const ICON_PROPS = { width: 20, height: 20, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round" as const, strokeLinejoin: "round" as const, }; export function OrderIcon() { return ( ); } export function AddressIcon() { return ( ); } export function HeartIcon() { return ( ); } export function ShieldIcon() { return ( ); }