diff --git a/components/Dashboard.tsx b/components/Dashboard.tsx index 8e5f805..33a7060 100644 --- a/components/Dashboard.tsx +++ b/components/Dashboard.tsx @@ -22,6 +22,16 @@ interface DashboardProps { const COLORS = ['#6366f1', '#ec4899', '#10b981', '#f59e0b', '#8b5cf6', '#0ea5e9']; +const getYearColor = (year: string | number) => { + const yStr = year.toString(); + if (yStr === '2024') return '#6366f1'; // Indigo + if (yStr === '2025') return '#ec4899'; // Pink + if (yStr === '2026') return '#10b981'; // Emerald + const yInt = parseInt(yStr); + if (isNaN(yInt)) return '#6366f1'; + return COLORS[yInt % COLORS.length]; +}; + // Reusable Expandable Card Component const ExpandableCard: React.FC<{ title: string; children: React.ReactNode; className?: string }> = ({ title, children, className }) => { const [isExpanded, setIsExpanded] = useState(false); @@ -99,9 +109,7 @@ const MultiYearKPICard: React.FC<{ const formatValue = (val: number) => { if (metric === 'sellOut') { - if (metric === 'sellOut') { - return `€${val.toLocaleString('de-DE', { minimumFractionDigits: 0, maximumFractionDigits: 0 })}`; - } + return `€${val.toLocaleString('de-DE', { minimumFractionDigits: 0, maximumFractionDigits: 0 })}`; } return val.toLocaleString('de-DE'); }; @@ -110,10 +118,10 @@ const MultiYearKPICard: React.FC<{ const displayTitle = contextData ? `${title} (Selected Item)` : title; return ( -
0
} + {sortedYears.length === 0 &&0
} {sortedYears.length > 0 && (