);
}
/**
* Safe-to-Spend hero card: what's left for the current 1st/15th period after
* everything still due before the next payday is covered. Sits directly under
* the summary cards and reads from the tracker payload's `cashflow` block.
*/
export default function CashFlowCard({ cashflow, onSetStartingAmounts }) {
if (!cashflow) return null;
// No starting amounts and no bank sync — invite setup instead of guessing.
if (!cashflow.has_data) {
return (
See your safe-to-spend
Add what's in your account for the 1st and 15th, and BillTracker projects what's left after bills.
until {shortDate(cashflow.next_payday)} · {daysUntilLabel(cashflow.days_until_payday)}
{/* ── Projection ── */}
{fmt(cashflow.available)} on hand → {cashflow.still_due_count === 0
? 'no bills left before payday'
: `${cashflow.still_due_count} bill${cashflow.still_due_count === 1 ? '' : 's'} (${fmt(cashflow.still_due_total)}) before payday`}