import React from "react"; import { Info } from "lucide-react"; import { Card, CardContent, CardHeader, CardTitle } from "./card"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "./tooltip"; import { cn } from "@/lib/utils"; import { formatCurrencyAbbrev } from "@/lib/format-currency"; // ─── Types ─────────────────────────────────────────────────────────────────── export interface AssetsLiabilitiesSideCardProps { /** Total liabilities in dollars (positive number — displayed as negative) */ liabilities: number; /** Total cash assets in dollars */ assets: number; /** Net position in dollars (may be negative) */ netPosition: number; /** Total property value in dollars */ propertyValue: number; title?: string; /** Tooltip text explaining the snapshot context */ tooltipText?: string; className?: string; } // ─── Internal types ─────────────────────────────────────────────────────────── interface MetricCell { label: string; value: number; /** When true, value is prefixed with "-" and coloured with brand-secondary */ negative?: boolean; } // ─── Component ──────────────────────────────────────────────────────────────── export function AssetsLiabilitiesSideCard({ liabilities, assets, netPosition, propertyValue, title = "Assets & Liabilities", tooltipText = "Current snapshot of your financial position. These values are not affected by the date range filter.", className, }: AssetsLiabilitiesSideCardProps) { const cells: MetricCell[] = [ { label: "Total Liabilities", value: liabilities, negative: true }, { label: "Total Cash Assets", value: assets }, { label: "Net Position", value: netPosition }, { label: "Total Property Value", value: propertyValue }, ]; return (
{title} } /> {tooltipText}
{/* 2×2 grid — matches frontend layout */}
{cells.map((cell) => { const displayValue = `${cell.negative ? "-" : ""}${formatCurrencyAbbrev(Math.abs(cell.value))}`; const fullValue = `${cell.negative ? "-" : ""}$${Math.abs(cell.value).toLocaleString()}`; return (

{cell.label}

{displayValue} } /> {fullValue}
); })}
); }