diff --git a/src/app/(app)/plan/page.tsx b/src/app/(app)/plan/page.tsx index 22b8955..6c110df 100644 --- a/src/app/(app)/plan/page.tsx +++ b/src/app/(app)/plan/page.tsx @@ -1,18 +1,10 @@ -import { ChevronDown } from "lucide-react"; import { EmptyBank } from "@/components/EmptyBank"; -import { NextMove } from "@/components/NextMove"; import { MoneyPlan, type PlanState } from "@/components/MoneyPlan"; import { PlanChat } from "@/components/PlanChat"; import { PlanContext } from "@/components/PlanContext"; -import { PlanSummary } from "@/components/PlanSummary"; -import { BillsOnCards } from "@/components/BillsOnCards"; -import { Suspense } from "react"; -import { countryOf } from "@/lib/countries"; import { getUser, today, typicalMonthly } from "@/lib/data"; import { money0, ymd } from "@/lib/format"; -import { loadPlan, planFacts } from "@/lib/plan-facts"; -import { laterOf, type Later } from "@/lib/projection"; -import { marginalRate } from "@/lib/tax"; +import { loadPlan } from "@/lib/plan-facts"; export default async function Plan() { const { supabase, user } = await getUser(); @@ -27,14 +19,7 @@ export default async function Plan() { const meta = user!.user_metadata ?? {}; const word = (user!.email ?? "").split("@")[0].match(/[a-z]+/i)?.[0] ?? ""; const name = (meta.full_name || meta.name || (word && word[0].toUpperCase() + word.slice(1)) || "[Your name]") as string; - // The payoff chart: the tax rate turns a contribution's tax saving back into the contribution (US only, like the tax moves). - // Possible later needs the full facts, so they load only when a live move is gated or a fund is still to build. const profile = meta.profile ?? {}; - const taxRate = countryOf(profile.country).code === "US" ? marginalRate(profile).rate : null; - const live = state.moves.filter((m) => m.status === "todo" || m.status === "doing"); - let later: Later | null = null; - if (live.some((m) => m.gate || m.ref?.startsWith("fund:"))) - later = await planFacts(supabase, user!.id, profile, ymd(now)).then((f) => laterOf(f, live), (e) => { console.error("[broke] payoff facts:", e); return null; }); // The savings rate, from the old For you page: the one thing on it the plan didn't already say. const rate = typical && typical.income > 0 ? (typical.income - typical.spend) / typical.income : null; return ( @@ -45,20 +30,12 @@ export default async function Plan() { {rate >= 0 ? <>You save {Math.round(rate * 100)}% of it.> : That's {money0(typical!.spend - typical!.income)} more out than in.}
)} - {/* One next move and a chat. The full plan is a click away for anyone who wants it. */} -+ {p?.summary ?? (p ? first?.title ?? "Nothing left to do." : "Get a plan for your money: what to do first, then what comes next.")} +
{STAGES[stage]}. This takes a minute or two; you can leave the page.
} {state.error &&{state.error}
} - {state.stale && !state.running &&{state.stale} Run it again to use your current accounts.
} + {state.stale && !state.running &&{state.stale} Redo it to use your current accounts.
} {!state.ready &&The money plan needs a database update. Open Setup to apply it.
} - {p?.note && !state.running && ( -
-
{p.summary}
} - + {p?.note && !state.running &&{p.note} Steps built on those numbers aren't counted.
} +Moves come in the usual order: stop the bleeding, a starter emergency fund, your match, debt, a full fund, tax-advantaged saving, then smaller wins. Each one has its value, the steps and any message to send. broke never acts for you: you choose what to do.
-{moves.length ? "Nothing left to do. Run the audit again after your next statement." : "This audit found no moves."}
} - {closed.length > 0 && ( -{moves.length ? "Nothing left to do. Redo your plan after your next statement." : "Your plan found nothing to change."}
} + + {closed.length > 0 && ( +General education, not financial advice. Values are estimates from your own transactions and stated assumptions; a move only counts what your spare money can cover.{moves.some((m) => m.kind === "tax") && " Tax moves use 2026 US federal rules from irs.gov. broke never files or pays anything for you."}
-General education, not financial advice. Amounts are estimates from your own transactions.
+ ); } -function Total({ ms }: { ms: PlanMove[] }) { - const { money0 } = useMoney(); - const y = value(ms, false), o = value(ms, true); - if (!y && !o) return null; - return{m.line}
- {m.gate &&{m.gate}
} -
-
| When | Following your plan | {hasLater &&Possible later | }Of which growth |
|---|---|---|---|
| {tickLabel(m)} | -{money0(counted[m].total)} | - {hasLater &&+{money0(possible[m].total)} | } -{money0(counted[m].growth)} | -
From your accounts as they are today. The full plan, with steps for each, is below.
-