76 lines
2.9 KiB
TypeScript
76 lines
2.9 KiB
TypeScript
"use client"
|
|
|
|
import { useState } from "react"
|
|
import { PageHeader } from "@/components/shared/page-header"
|
|
import { StatCard } from "@/components/dashboard/stat-card"
|
|
import { RecentLeadsTable } from "@/components/dashboard/recent-leads-table"
|
|
import { LeadStatusChart } from "@/components/dashboard/lead-status-chart"
|
|
import { LeadsPerMonthChart } from "@/components/dashboard/leads-per-month-chart"
|
|
import { dashboardStats } from "@/data/dashboard"
|
|
import {
|
|
Users,
|
|
UserPlus,
|
|
PhoneCall,
|
|
Clock,
|
|
CheckCircle2,
|
|
TrendingUp,
|
|
ListFilter,
|
|
} from "lucide-react"
|
|
import {
|
|
Select,
|
|
SelectContent,
|
|
SelectItem,
|
|
SelectTrigger,
|
|
SelectValue,
|
|
} from "@/components/ui/select"
|
|
|
|
export default function DashboardPage() {
|
|
const stats = dashboardStats
|
|
const [period, setPeriod] = useState("6months")
|
|
|
|
const statCards = [
|
|
{ title: "Total Leads", value: stats.totalLeads, icon: Users, variant: "blue" as const, description: "All time" },
|
|
{ title: "Open Leads", value: stats.openLeads, icon: UserPlus, variant: "blue" as const, description: "Needs attention" },
|
|
{ title: "Contacted", value: stats.contactedLeads, icon: PhoneCall, variant: "amber" as const, description: "In conversation" },
|
|
{ title: "Pending", value: stats.pendingLeads, icon: Clock, variant: "purple" as const, description: "Awaiting decision" },
|
|
{ title: "Closed", value: stats.closedLeads, icon: CheckCircle2, variant: "emerald" as const, description: "Won" },
|
|
{ title: "Conversion Rate", value: `${stats.conversionRate}%`, icon: TrendingUp, variant: "emerald" as const, description: `${stats.closedLeads} of ${stats.totalLeads} leads` },
|
|
]
|
|
|
|
return (
|
|
<div className="space-y-6">
|
|
<PageHeader title="Dashboard" description="Overview of your sales pipeline">
|
|
<Select value={period} onValueChange={setPeriod}>
|
|
<SelectTrigger className="h-9 w-[160px]">
|
|
<ListFilter className="mr-2 h-4 w-4" />
|
|
<SelectValue />
|
|
</SelectTrigger>
|
|
<SelectContent>
|
|
<SelectItem value="7days">Last 7 days</SelectItem>
|
|
<SelectItem value="30days">Last 30 days</SelectItem>
|
|
<SelectItem value="6months">Last 6 months</SelectItem>
|
|
<SelectItem value="12months">Last 12 months</SelectItem>
|
|
</SelectContent>
|
|
</Select>
|
|
</PageHeader>
|
|
|
|
<p className="text-xs font-semibold tracking-widest uppercase text-muted-foreground">Pipeline Overview</p>
|
|
|
|
<div className="grid gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6">
|
|
{statCards.map((card, i) => (
|
|
<StatCard key={card.title} {...card} index={i} />
|
|
))}
|
|
</div>
|
|
|
|
<p className="text-xs font-semibold tracking-widest uppercase text-muted-foreground">Analytics</p>
|
|
|
|
<div className="grid gap-6 lg:grid-cols-2">
|
|
<LeadStatusChart data={stats.statusDistribution} />
|
|
<LeadsPerMonthChart data={stats.leadsPerMonth} />
|
|
</div>
|
|
|
|
<RecentLeadsTable leads={stats.recentLeads} />
|
|
</div>
|
|
)
|
|
}
|