import Link from "next/link"; import { formatDistanceToNowStrict } from "date-fns"; import { cn } from "@/lib/utils"; import { DELIVERY_STATUS_STYLES } from "@/app/(dashboard)/pipeline/status-colors"; import type { DeliverySummary } from "@/lib/dashboard/ops"; /** * The last few packages, and whether any of them went wrong. * * A failed build is otherwise silent — the exports stay READY_FOR_DELIVERY and * nothing reaches the delivery volume, but no one finds out until the client * asks where the shots are. */ export function RecentDeliveries({ deliveries }: { deliveries: DeliverySummary[] }) { const problems = deliveries.filter((d) => d.status === "FAILED" || d.stuck).length; return (

Recent packages {problems > 0 && ( {problems} need{problems === 1 ? "s" : ""} attention )}

All deliveries →
{deliveries.length === 0 ? (

No packages built yet.

) : ( deliveries.map((d) => (
#{d.packageNumber}{" "} {d.projectCode} {d.episode ? ` · ${d.episode}` : ""} {d.kind === "MOV_REVIEW" ? " · review" : ""}
{d.status === "FAILED" && d.errorMessage ? d.errorMessage : `${d.itemCount} shot${d.itemCount === 1 ? "" : "s"} · ${d.atLabel} ${formatDistanceToNowStrict(d.at)} ago`}
{d.stuck ? "STUCK" : d.status} )) )}
); }