"use client"; import { WidgetEmptyState } from "@/components/widget-empty-state"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { ChartContainer, ChartTooltip, ChartTooltipContent, } from "@/components/ui/chart"; import type { PagadorHistoryPoint } from "@/lib/pagadores/details"; import { RiBarChartLine } from "@remixicon/react"; import { Bar, BarChart, CartesianGrid, LabelList, type LabelProps, XAxis, } from "recharts"; import { currencyFormatter } from "@/lib/lancamentos/formatting-helpers"; const chartConfig = { despesas: { label: "Despesas", color: "hsl(356, 72%, 50%)", }, }; type PagadorHistoryCardProps = { data: PagadorHistoryPoint[]; }; const ValueLabel = (props: LabelProps) => { const { x, y, value, width } = props; if (typeof x !== "number" || typeof y !== "number" || width === undefined) { return null; } const labelX = x + (Number(width) ?? 0) / 2; const amount = typeof value === "number" ? currencyFormatter.format(value) : value; const labelY = Math.max(y - 6, 12); return ( {amount} ); }; export function PagadorHistoryCard({ data }: PagadorHistoryCardProps) { const hasData = data.length > 0; return ( Evolução (últimos 6 meses)

Despesas registradas para este pagador ao longo do tempo.

{hasData ? ( } /> } /> ) : ( } title="Sem dados para exibir" description="Ainda não há movimentações suficientes para gerar este gráfico." /> )}
); }