// components/generic/Dashboard/DashboardSection.jsx import { StatGrid } from "./StatGrid"; import { PieBreakdown } from "./PieBreakdown"; import { BarBreakdown } from "./BarBreakdown"; /** * Renders a titled section with a stat grid and breakdown charts. * * @param {Object} props * @param {string} props.title * @param {Array} props.stats [{ key, label, value, icon? }] * @param {Array} [props.breakdowns] [{ key, label, chartType, data[] }] * @param {Object} [props.iconMap] { [statKey]: } * @param {Object} [props.linkMap] { [statKey]: () => void } — stat card click handlers * @param {Object} [props.chartLinkMap] { [breakdownKey]: (entry) => void } — chart segment click handlers * @param {string} [props.className] * * @example * navigate('/admin/users/all'), * archived: () => navigate('/admin/users/all/archived'), * }} * chartLinkMap={{ * acc_type: (entry) => navigate(`/admin/users/all`), * }} * /> */ export function DashboardSection({ title, stats = [], breakdowns = [], iconMap = {}, linkMap = {}, chartLinkMap = {}, chartHeight = 240, className = "", }) { return (
{title &&

{title}

} {stats.length > 0 && ( )} {breakdowns.length > 0 && (
1 ? "sm:grid-cols-2" : "grid-cols-1"}`}> {breakdowns.map((b) => b.chartType === "bar" ? ( ) : ( ) )}
)}
); }