diff --git a/src/app/(app)/orders/page.tsx b/src/app/(app)/orders/page.tsx index fb6c783..ec29520 100644 --- a/src/app/(app)/orders/page.tsx +++ b/src/app/(app)/orders/page.tsx @@ -24,7 +24,8 @@ import { Copy, } from "lucide-react"; import getPocketBase from "@/lib/pocketbase"; -import { displayContactName } from "@/lib/utils"; +import { cn, displayContactName } from "@/lib/utils"; +import { getOrderAge, bucketToBadgeClass } from "@/lib/order-age"; import { isOrderComplete } from "@/lib/server/order-completion"; import { useAuth } from "@/components/auth-provider"; import { isRepUser } from "@/lib/rep-visibility"; @@ -96,6 +97,38 @@ function formatDate(dateStr: string): string { }); } +/** + * Inline age badge for the order card metadata slot. Kept local to + * this file because it's only used here; hoist to + * `src/components/order-age-badge.tsx` if a second page needs it. + * + * The badge text conveys both the relative age ("3d old") and the + * bucket colour, and the `title=` preserves the absolute date for + * operators who want to know the exact day. + */ +function OrderAgeBadge({ + created, + className, +}: { + created: string; + className?: string; +}) { + const age = getOrderAge(created); + return ( + + {age.label} + + ); +} + async function fetchDashboardJson(url: string): Promise { const token = getPocketBase().authStore.token; if (!token) throw new Error("Your session has expired. Please sign in again."); @@ -862,9 +895,10 @@ function OrderCard({ )} - - {formatDate(order.created)} - + {/* Per-tab item-count summary — the operator's at-a-glance scan line when cards are collapsed. */}