"use client"; import React from "react"; import Link from "next/link"; import { ArrowRight, ArrowUp, ArrowDown, type LucideIcon } from "lucide-react"; import { TONES, type Tone } from "./tones"; /** A "vs last month"-style delta line. `value` is a percentage; null means no baseline to compare against (shown as "New"). */ export type StatDelta = { value: number | null; label?: string }; /** * Richer stat tile for dashboard KPI rows (icon chip + label + big value + * optional delta + optional "View X" link) — scaffolding for Phase 2's * dashboard rebuilds. Not the same component as reports/StatTile.tsx, which * stays as-is for Reports' own denser tiles. */ export function StatCard({ icon: Icon, label, value, tone = "brand", href, linkLabel, delta, }: { icon: LucideIcon; label: string; value: string | number; tone?: Tone; href?: string; linkLabel?: string; delta?: StatDelta; }) { const t = TONES[tone] || TONES.brand; return (
{label}
{value}
{delta && (
= 0 ? "text-emerald-600" : "text-rose-600")}> {delta.value == null ? ( New this month ) : ( <> {delta.value >= 0 ? : } {Math.abs(delta.value).toFixed(0)}% {delta.label || "vs last month"} )}
)} {href && ( {linkLabel || "View"} )}
); } export function StatCardRow({ children }: { children: React.ReactNode }) { return
{children}
; }