'use client'; import { useQuery } from '@tanstack/react-query'; import { DollarSign } from 'lucide-react'; import { apiFetch } from '@/lib/api/client'; import { Card, CardContent } from '@/components/ui/card'; import { Skeleton } from '@/components/ui/skeleton'; import { formatCurrency } from '@/lib/utils/currency'; interface KpiResponse { pipelineValue: number; pipelineValueCurrency: string; } /** * Total pipeline value for active interests, converted to the port's * default currency at display time. Sourced from the same KPIs endpoint * as the active-deals tile so the two share a cache entry and render in * lockstep. */ export function PipelineValueTile() { const { data, isLoading } = useQuery({ queryKey: ['dashboard', 'kpis'], queryFn: () => apiFetch('/api/v1/dashboard/kpis'), staleTime: 60_000, }); return ( {/* `pt-5 pb-5` is explicit because shadcn's default CardContent ships with `pt-0` (it assumes a CardHeader sits above). Without these overrides the tile content snaps to the top edge of the card. */}

Pipeline value

{isLoading ? ( ) : (

{formatCurrency(data?.pipelineValue ?? 0, data?.pipelineValueCurrency ?? 'USD', { maxFractionDigits: 0, })}

)}
); }