Files
2026-07-13 12:58:18 +08:00

49 lines
1.5 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"use client";
import { useCrmContext } from "@/components/crm-context";
import {
KpiRow,
SalesOverTimeCard,
RevenueByCategoryCard,
TopReps,
UpcomingCloses,
LatestOrders,
DashboardSkeleton,
} from "@/components/dashboard";
export default function DashboardPage() {
const { crm, loading, setSelectedDealId } = useCrmContext();
return (
<div className="h-full overflow-auto p-6">
{loading ? (
<DashboardSkeleton />
) : crm.deals.length === 0 ? (
<div className="rounded-xl border border-dashed border-border p-10 text-center text-sm text-muted-foreground">
No data yet. Ask the assistant to research an account or build a quote
to get started.
</div>
) : (
<div className="space-y-4">
{/* 1 — KPI row */}
<KpiRow crm={crm} />
{/* 25 — responsive analytics grid (collapses to one column ≤1024px) */}
<div className="grid grid-cols-1 gap-4 lg:grid-cols-3">
<div className="lg:col-span-2">
<SalesOverTimeCard crm={crm} />
</div>
<RevenueByCategoryCard crm={crm} />
<TopReps crm={crm} />
<div className="lg:col-span-2">
<UpcomingCloses crm={crm} onSelect={setSelectedDealId} />
</div>
</div>
{/* 6 — latest orders, full width */}
<LatestOrders crm={crm} onSelect={setSelectedDealId} />
</div>
)}
</div>
);
}