import { useState } from "react" import { subDays } from "date-fns" import { Activity, DollarSign, MousePointer, PieChart, ShoppingCart, TrendingUp, Users, } from "lucide-react" import { definePage } from "@squadbase/vantage" import { DashboardCard, DashboardCardAction, DashboardCardContent, DashboardCardHeader, DashboardCardPreset, DashboardCardTitle, DateRangePicker, AreaChart, BarChart, DonutChart, PageShell, PageShellContent, PageShellDescription, PageShellHeader, PageShellHeaderEnd, PageShellHeading, PageShellSummary, PageShellSummaryCard, PageShellTitle, Placeholder, Sparkline, } from "@squadbase/vantage/components" import { CampaignTable } from "./components/kpi-chart-advanced/campaign-table" import { breakdownSlices, campaignRows, comparisonSeries, headerKpis, trendSeries, } from "./components/kpi-chart-advanced/mock-data" import type { DashboardFilters, } from "./components/kpi-chart-advanced/types" export const page = definePage({ title: "KPI + Chart (Advanced)", description: "Hero KPI (1 large + 4 small in 2×2 grid), bar+line comparison, donut breakdown, daily trend, and a detail table. KPI-led analytics dashboard layout.", }) // ── page ───────────────────────────────────────────────────────────────────── const today = new Date() const initialFilters: DashboardFilters = { dateRange: { from: subDays(today, 29), to: today, }, } const smallKpiCards = [ { label: "Metric 2", icon: Users, kpi: headerKpis[1] }, { label: "Metric 3", icon: MousePointer, kpi: headerKpis[2] }, { label: "Metric 4", icon: Activity, kpi: headerKpis[3] }, { label: "Metric 5", icon: ShoppingCart, kpi: headerKpis[4] }, ] export default function HomePage() { const [filters, setFilters] = useState(initialFilters) const heroKpi = headerKpis[0] return ( [Template] Performance dashboard Headline KPIs, comparisons, and detail for the selected period. setFilters((prev) => ({ ...prev, dateRange: range })) } maxDate={today} />

Growth

Overall performance is trending up versus the previous period.

Mix

A single segment drives the largest share of the total.

Momentum

Recent activity points to a positive shift in the trend.

Metric 1
{heroKpi.value}
{heroKpi.change >= 0 ? `+${heroKpi.change}%` : `${heroKpi.change}%`}
({ value: v }))} height={88} area />

Metric A

$0.92M

Metric B

+8.4%
{smallKpiCards.map(({ label, icon: Icon, kpi }) => ( {label} {kpi.value}
{kpi.change >= 0 ? `+${kpi.change}%` : `${kpi.change}%`}
({ value: v }))} height={32} area className="mt-3" />
))}
) }