import { ClipboardList, Inbox, CheckCircle2, Timer, type LucideIcon } from "lucide-react"; import { fmtNum } from "../lib/formatters"; export interface StatsBarProps { total: number; offered: number; accepted: number; avgLeadTime: number | null; // روز } export function StatsBar({ total, offered, accepted, avgLeadTime }: StatsBarProps) { const stats: { label: string; shortLabel: string; value: string; color: string; icon: LucideIcon; }[] = [ { label: "کل پیشنهادها", shortLabel: "کل", value: fmtNum(total), color: "text-ink", icon: ClipboardList, }, { label: "پیشنهاد باز", shortLabel: "باز", value: fmtNum(offered), color: "text-amber", icon: Inbox, }, { label: "پذیرفته‌شده", shortLabel: "پذیرفته", value: fmtNum(accepted), color: "text-[#1d4ed8]", icon: CheckCircle2, }, { label: "میانگین lead time (روز)", shortLabel: "زمان تحویل", value: avgLeadTime == null ? "—" : fmtNum(avgLeadTime), color: "text-green", icon: Timer, }, ]; return (
{stats.map((s) => (
{/* عنوان کارت */}
{s.shortLabel} {s.label} {/* آیکون در موبایل حذف شده تا فضا برای متن باز بماند */}
{/* مقدار عددی */}
{s.value}
))}
); }