"use client" import { Area, AreaChart, CartesianGrid, XAxis } from "recharts" import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card" import { ChartConfig, ChartContainer, ChartTooltip, ChartTooltipContent, } from "@/components/ui/chart" interface SimpleAreaProps { title: string description: string data: Array<{ date: Date; count: number }> } export function SimpleArea({ title, description, data }: SimpleAreaProps) { const chartConfig = { count: { label: "Total", color: "hsl(var(--chart-1))", }, } satisfies ChartConfig const formattedData = data.map(item => ({ label: item.date.toISOString().split('T')[0], count: item.count })) const total = data.length > 0 ? data[data.length - 1].count : 0 return (
{title} {description}
Total

{total.toLocaleString()}

{data.length > 0 ? ( { const date = new Date(value); return `${date.getMonth() + 1}/${date.getDate()}`; }} /> } /> ) : (
Loading...
)}
) }