'use client' import type { MortgageSummary } from '@/lib/mortgage-engine' import type { MortgageState } from '@/lib/mortgage-types' interface Props { state: MortgageState summary: MortgageSummary } function fmt(n: number): string { return new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD', maximumFractionDigits: 0 }).format(n) } function fmtPct(n: number): string { return `${n.toFixed(1)}%` } export default function ComparisonPanel({ state, summary }: Props) { const repaidPct = state.totalPrincipal > 0 ? (state.totalPrincipalPaid / state.totalPrincipal) * 100 : 0 return (
Interest that stays in the community instead of flowing to a distant institution. {summary.interestSaved > 0 && ( <> Plus {fmt(summary.interestSaved)} saved through distributed rates.> )}