"use client"; import { Check, CircleAlert, Clock, Minus, TriangleAlert } from "lucide-react"; import { Button } from "@/components/ui/button"; import { formatTime } from "@/lib/format"; import { buildTimeline, type StepState, type TimelineStep } from "@/lib/timeline"; import type { Order, OrderAction } from "@/lib/types"; import { cn } from "@/lib/utils"; type Props = { order: Order; now: number; onAction: (order: Order, action: OrderAction) => void; }; const ICON: Record = { done: Check, due: CircleAlert, pending: Clock, skipped: Minus, }; export function OrderTimeline({ order, now, onAction }: Props) { const steps = buildTimeline(order, now); return (

Verlauf

    {steps.map((step, index) => ( ))}
); } function Step({ step, last, order, onAction, }: { step: TimelineStep; last: boolean; order: Order; onAction: (order: Order, action: OrderAction) => void; }) { const Icon = ICON[step.state]; const danger = step.danger && step.state !== "pending" && step.state !== "skipped"; return (
  • {!last && }

    {step.label}

    {step.at !== undefined && ( {step.state === "pending" ? "ab " : ""} {formatTime(new Date(step.at).toISOString())} Uhr )}
    {step.description && (

    {step.description}

    )} {step.state === "due" && step.action && ( )}
  • ); }