import { Settings } from 'lucide-react'; import type { SectionSettings } from '../api'; import { formatAmount } from '@/lib/format'; import { Card } from '@/components/ui/card'; import { Accordion, AccordionItem, AccordionTrigger, AccordionContent, } from '@/components/ui/accordion'; import { getColorClasses } from '@/lib/colors'; import { cn } from '@/lib/utils'; interface Props { sectionId: string; settings: SectionSettings; total?: number; totalCurrency?: string; onToggleExpanded: (expanded: boolean) => void; onOpenConfig: () => void; children: React.ReactNode; } export default function DashboardSection({ sectionId, settings, total, totalCurrency, onToggleExpanded, onOpenConfig, children, }: Props) { const colors = getColorClasses(settings.color); return ( {/* Settings icon — outside accordion trigger to avoid button-in-button */} onToggleExpanded(value.includes(sectionId))} >
{settings.label} {total != null && totalCurrency && ( {formatAmount(total, totalCurrency)} )}
{children}
); }