diff --git a/src/app/(app)/dashboard2/page.tsx b/src/app/(app)/dashboard2/page.tsx index f6d78c4..818e1a9 100644 --- a/src/app/(app)/dashboard2/page.tsx +++ b/src/app/(app)/dashboard2/page.tsx @@ -185,6 +185,7 @@ export default function RepDashboardPage() { label="Selling this month" value={monthRevenue.sellingThisMonth} delta={deltaPct(monthRevenue.sellingThisMonth, monthRevenue.sellingLastMonth)} + previousValue={monthRevenue.sellingLastMonth} icon={DollarSign} accentColor={CHART.green} format="currency" @@ -238,6 +239,7 @@ function RepKpiCard({ icon: Icon, accentColor, format = "number", + previousValue, }: { label: string; value: number; @@ -245,10 +247,20 @@ function RepKpiCard({ icon: React.ComponentType<{ className?: string; style?: React.CSSProperties }>; accentColor: string; format?: "number" | "currency"; + /** Optional previous-period value shown alongside the delta arrow + * (e.g. "vs R 99,999 last month"). When omitted, the subline just + * shows the percentage. */ + previousValue?: number; }) { const positive = delta >= 0; const display = format === "currency" ? formatZar(value) : value.toLocaleString(); + const previousDisplay = + previousValue !== undefined + ? format === "currency" + ? formatZar(previousValue) + : previousValue.toLocaleString() + : null; return (
@@ -265,7 +277,7 @@ function RepKpiCard({
{positive ? "+" : ""} - {delta}% vs previous + {delta}% vs previous{previousDisplay !== null ? ` ยท ${previousDisplay}` : ""}
);