import { fmt } from "@/lib/format"; import { cn } from "@/lib/utils"; import type { RemitDetail } from "@/hooks/useRemitDetail"; type FinancialSummaryCardProps = { remit: RemitDetail; }; /** * Single label/value row used inside the financial summary card. * `mono` opts the value into the project's mono numeric treatment * (font-mono + tabular-nums + slightly heavier weight) so currency * figures line up vertically across rows. */ function SummaryRow({ testId, label, value, mono = false, }: { testId: string; label: string; value: React.ReactNode; mono?: boolean; }) { return (
{label} {value}
); } /** * Optional value renderer: returns `—` for null/undefined/empty so the * card never prints "null" or "undefined" in the UI. */ function opt(v: string | number | null | undefined, format?: (s: string) => string): React.ReactNode { if (v === null || v === undefined) return "—"; if (typeof v === "string" && v.trim() === "") return "—"; if (typeof v === "number" && !Number.isFinite(v)) return "—"; return format ? format(String(v)) : v; } /** * Financial summary card for the remittance detail drawer. * * Surfaces the headline money figures (paid amount + adjustment amount) * plus the supporting payment identifiers (method, date, check/trace * number). Headline amounts are stacked at the top so the eye lands on * the totals first, then scans the supporting rows below. * * All fields gracefully degrade to "—" when absent — the detail * endpoint doesn't yet populate `paymentMethod`, `paymentDate`, or * `checkNumber` for every remit, and we'd rather show an em-dash than * "undefined". */ export function FinancialSummaryCard({ remit }: FinancialSummaryCardProps) { const hasAdjustment = Math.abs(remit.adjustmentAmount) > 0; return (

Financial Summary

{/* Headline totals — big display digits, side by side */}
Paid amount {fmt.usdPrecise(remit.paidAmount)}
Adjustment amount {hasAdjustment ? fmt.usdPrecise(remit.adjustmentAmount) : "—"}
{/* Supporting rows: method, payment date, check / trace number */}
); }