'use client'; import { useQuery } from '@tanstack/react-query'; import { Bar, BarChart, CartesianGrid, ResponsiveContainer, Tooltip, XAxis, YAxis, } from 'recharts'; import { apiFetch } from '@/lib/api/client'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { CardSkeleton } from '@/components/shared/loading-skeleton'; import { WidgetErrorBoundary } from './widget-error-boundary'; interface PipelineRow { stage: string; count: number; } const STAGE_LABELS: Record = { open: 'Open', details_sent: 'Details Sent', in_communication: 'In Communication', visited: 'Visited', signed_eoi_nda: 'Signed EOI/NDA', deposit_10pct: 'Deposit 10%', contract: 'Contract', completed: 'Completed', }; function PipelineChartInner() { const { data, isLoading } = useQuery({ queryKey: ['dashboard', 'pipeline'], queryFn: () => apiFetch('/api/v1/dashboard/pipeline'), staleTime: 60_000, retry: 2, }); if (isLoading) { return ; } const chartData = (data ?? []).map((row) => ({ stage: STAGE_LABELS[row.stage] ?? row.stage, count: row.count, })); return ( Pipeline Overview ); } export function PipelineChart() { return ( ); }