"use client"; import { Area, AreaChart, ResponsiveContainer, Tooltip, XAxis, YAxis, } from "recharts"; import { useAnimationPreferences } from "~/components/providers/animation-preferences-provider"; interface RevenueChartProps { data: { month: string; revenue: number; monthLabel: string; }[]; } const CustomTooltip = ({ active, payload, label, }: { active?: boolean; payload?: Array<{ payload: { revenue: number } }>; label?: string; }) => { const formatCurrency = (value: number) => { return new Intl.NumberFormat("en-US", { style: "currency", currency: "USD", minimumFractionDigits: 0, maximumFractionDigits: 0, }).format(value); }; if (active && payload?.length) { const data = payload[0]!.payload; return (

{label}

Revenue: {formatCurrency(data.revenue)}

{/* Count not available in aggregated view currently */}

); } return null; }; export function RevenueChart({ data }: RevenueChartProps) { // Use data directly const chartData = data; const formatCurrency = (value: number) => { return new Intl.NumberFormat("en-US", { style: "currency", currency: "USD", minimumFractionDigits: 0, maximumFractionDigits: 0, }).format(value); }; const { prefersReducedMotion, animationSpeedMultiplier } = useAnimationPreferences(); if (chartData.length === 0) { return (

No revenue data available

Revenue will appear here once you have paid invoices

); } return (
} />
); }