'use client' import { useTranslations } from 'next-intl' import { Area, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, Legend, Line, ComposedChart, } from 'recharts' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { formatCurrency } from '@/lib/utils' interface KPITrendChartProps { months: { label: string; income: number; expenses: number; net: number }[] } export function KPITrendChart({ months }: KPITrendChartProps) { const t = useTranslations('kpi') if (months.length === 0) return null const seriesLabel = (key: string) => key === 'income' ? t('trend_legend_income') : key === 'expenses' ? t('trend_legend_expenses') : t('trend_legend_net') return ( {t('trend_title')} new Intl.NumberFormat('sv-SE', { notation: 'compact' }).format(v) } tick={{ fontSize: 11 }} /> [ formatCurrency(Number(value)), seriesLabel(String(name)), ]} contentStyle={{ fontSize: '12px', borderRadius: '8px', border: '1px solid hsl(var(--border))', backgroundColor: 'hsl(var(--card))', }} /> seriesLabel(value)} /> ) }