"use client"; import styles from "./HeroDashboard.module.css"; /** * Hero dashboard cluster — a tilted order board that floats while its rows run * on a CSS conveyor, three KPI chips drifting above it, and a courier rail with * a package riding a dashed flow path into a delivery pulse. * * Every loop is a CSS keyframe: no timers, no state, nothing to hydrate. Six * rows share one 24s animation offset by -3s each, so five slots are always * filled while the sixth is entering or leaving. */ const STATS = [ { label: "Orders today", value: "241", delta: "18%", tone: "ok" as const, icon: bagIcon }, { label: "COD collected", value: "$89,520", delta: "22%", tone: "warn" as const, icon: coinIcon }, { label: "Delivery rate", value: "96.8%", delta: "9%", tone: "ok" as const, icon: checkIcon }, ]; const NAV = [ "Dashboard", "Orders", "Products", "Courier", "Payments", "Reports", "Settings", ]; const FILTERS = [ { label: "All orders", count: "241", on: true }, { label: "New", count: "56", on: false }, { label: "Processing", count: "87", on: false }, { label: "Delivered", count: "27", on: false }, ]; type Status = "Delivered" | "Pickup" | "Processing" | "New"; const STATUS_TONE: Record = { Delivered: { bg: "var(--ok-soft)", fg: "var(--ok)" }, Pickup: { bg: "var(--warn-soft)", fg: "var(--warn)" }, Processing: { bg: "var(--accent-soft)", fg: "var(--accent)" }, New: { bg: "rgba(139,147,167,0.14)", fg: "var(--muted)" }, }; const ORDERS: { id: string; name: string; phone: string; source: string; amount: string; status: Status; courier: string; mark: string; score: number; }[] = [ { id: "10326", name: "Sakib Hossen", phone: "01762 29764", source: "Organic", amount: "$1,850", status: "Delivered", courier: "Metro", mark: "MT", score: 96 }, { id: "10325", name: "Nusrat Jahan", phone: "01489 71848", source: "Facebook", amount: "$890", status: "Pickup", courier: "Carrybee", mark: "CB", score: 88 }, { id: "10324", name: "Mehedi Hasan", phone: "01655 78629", source: "Retargeting", amount: "$1,450", status: "Processing", courier: "Steadfast", mark: "SF", score: 100 }, { id: "10323", name: "Tania Rahman", phone: "01744 26689", source: "Instagram", amount: "$970", status: "New", courier: "Metro", mark: "MT", score: 92 }, { id: "10322", name: "Farhana Akter", phone: "01326 90349", source: "Messenger", amount: "$1,780", status: "Pickup", courier: "Carrybee", mark: "CB", score: 99 }, { id: "10321", name: "Imran Kabir", phone: "01833 12907", source: "Organic", amount: "$2,120", status: "Delivered", courier: "Steadfast", mark: "SF", score: 94 }, { id: "10320", name: "Rumana Haque", phone: "01912 44508", source: "Facebook", amount: "$640", status: "Processing", courier: "Metro", mark: "MT", score: 86 }, { id: "10319", name: "Arif Chowdhury", phone: "01571 83320", source: "Organic", amount: "$3,050", status: "New", courier: "Carrybee", mark: "CB", score: 97 }, ]; // Eight rows at -3s apart cover the full 24s cycle, so five slots stay filled. const ROW_STAGGER = 3; const RAIL = [ { tag: "SF", name: "Steadfast" }, { tag: "PA", name: "Pathao" }, { tag: "CB", name: "Carrybee" }, ]; const FLOW_PATH = "M48 4 C48 44 48 70 48 100 L48 190 L48 268 C48 292 48 306 48 316"; function scoreTone(score: number) { if (score >= 95) return { background: "var(--ok-soft)", color: "var(--ok)" }; if (score >= 88) return { background: "var(--warn-soft)", color: "var(--warn)" }; return { background: "rgba(139,147,167,0.14)", color: "var(--muted)" }; } export default function HeroDashboard({ theme = "dark", }: { /** "light" switches to the green/white palette this layout is modelled on. */ theme?: "dark" | "light"; }) { return (
{/* KPI chips float above the panel, offset half a second apart */}
{STATS.map((stat, i) => (
{stat.icon()}
{stat.label} {stat.value} ▲ {stat.delta} vs yesterday
))}
{/* Tilted order board */}
Order board LIVE
Today All status Search by customer name or phone…
{FILTERS.map((f) => ( {f.label} {f.count} ))}
# Customer Total Status Courier Score
{ORDERS.map((order, i) => (
#{order.id} {order.name} {order.phone} {order.source} {order.amount} {order.status} {order.mark} {order.courier} {order.score}%
))}
{/* Courier rail: dashed flow with a package riding it into the drop-off */}
{RAIL.map((item, i) => (
{item.tag} {item.name}
))}
{homeIcon()} Received
); } /* --------------------------------------------------------------- icons -- */ function bagIcon() { return ( ); } function coinIcon() { return ( ); } function checkIcon() { return ( ); } function homeIcon() { return ( ); }