'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 (
{/* Progress */}

Progress

{/* Overall progress bar */}
{/* Community Fund */} {state.communityFundBalance > 0 && (

Community Fund

{fmt(state.communityFundBalance)}
Overflow directed to community resilience
)} {/* Comparison */}

rMortgage vs Traditional

0} /> 0} />
{/* Key insight */}

Community Wealth

{fmt(summary.communityRetained)}

Interest that stays in the community instead of flowing to a distant institution. {summary.interestSaved > 0 && ( <> Plus {fmt(summary.interestSaved)} saved through distributed rates. )}

) } function StatCard({ label, value, sub, color }: { label: string; value: string; sub?: string; color?: string }) { return (
{label}
{value} {sub && {sub}}
) } function CompareRow({ label, myco, trad, highlight }: { label: string; myco: string; trad: string; highlight?: boolean }) { return (
{label}
{myco}
{trad}
) }