import { useQuery } from "@tanstack/react-query"; import { getLisaSummary } from "@/api/pensions"; import { formatCurrency } from "@/utils/currency"; import { AlertTriangle, Gift, Info } from "lucide-react"; function taxYearDisplay(year: number): string { return `${year - 1}/${String(year).slice(2)}`; } interface Props { accountId: string; } export default function LisaInfoCard({ accountId }: Props) { const { data, isLoading, isError } = useQuery({ queryKey: ["lisa-summary", accountId], queryFn: () => getLisaSummary(accountId), retry: false, }); if (isLoading) { return (
); } if (isError || !data) { return null; } const usedPct = Math.min(100, (data.current_year_contributions / 4000) * 100); const barColour = usedPct >= 100 ? "bg-green-500" : usedPct >= 75 ? "bg-amber-500" : "bg-primary"; return (
{/* Current year contribution meter */}

LISA — Current Year

{formatCurrency(data.current_year_contributions, "GBP")} contributed {formatCurrency(4000, "GBP")} limit
+{formatCurrency(data.current_year_bonus_expected, "GBP")} bonus {formatCurrency(data.current_year_limit_remaining, "GBP")} remaining

Total contributed

{formatCurrency(data.total_contributions, "GBP")}

Total bonus expected

+{formatCurrency(data.total_bonus_expected, "GBP")}

{/* Per-year breakdown */} {data.tax_year_breakdown.length > 0 && (

Year-by-year breakdown

{data.tax_year_breakdown.map((row) => (
{taxYearDisplay(row.tax_year)} {formatCurrency(row.contributions, "GBP")} +{formatCurrency(row.bonus_expected, "GBP")}
))}
)} {/* Withdrawal penalty warning */}

Withdrawal penalty

Withdrawing before age 60 (except for first-home purchase up to £450k) incurs a{" "} 25% penalty on the full withdrawal amount. Because the fund includes the government bonus, the effective loss can exceed the bonus itself.

If you withdrew the full balance today, the penalty would be approximately{" "} {formatCurrency(data.withdrawal_penalty_amount, "GBP")}.

{/* Key facts */}
LISA contributions attract a 25% government bonus (max £1,000/yr). Eligible for first-home purchase (property up to £450k) or retirement from age 60.
); }