// Deadlines, Admin auto-pilot, Money, Pipeline, Wins // These are the "big picture, structural" modules. function Deadlines() { const { state } = useStore(); const today = new Date(); today.setHours(0, 0, 0, 0); return (
Deadlines
{state.deadlines.length} on the horizon
{state.deadlines.map((d) => { const due = new Date(d.due); const days = Math.max(0, Math.round((due - today) / 86400000)); const label = due.toLocaleDateString(undefined, { weekday: 'short', month: 'short', day: 'numeric' }); return (
{days}d
{d.name}
{d.ctx}
{label}
); })}
); } // --- Admin Auto-pilot -------------------------------------------------- const ADMIN_META = { 'invoice-overdue': { ico: 'Banknote', title: 'Invoice overdue' }, 'invoice-send': { ico: 'Banknote', title: 'Invoices to send' }, 'vat': { ico: 'Receipt', title: 'VAT filing' }, 'expenses': { ico: 'Receipt', title: 'Expenses' }, 'contract': { ico: 'FilePen', title: 'Contract' }, 'subscriptions': { ico: 'Repeat', title: 'Subscriptions' }, 'inbox': { ico: 'Mail', title: 'Email inbox' }, 'tax-q3': { ico: 'Receipt', title: 'Q3 income tax' }, }; function Admin() { const { state, completeAdmin, addWin } = useStore(); return (
Admin auto-pilot
structural — don't think, just do
{state.admin.map((a) => { const meta = ADMIN_META[a.kind] || { ico: 'Refresh', title: a.kind }; const Ico = Icons[meta.ico] || Icons.Refresh; return (
{ addWin(`Handled: ${meta.title.toLowerCase()}`); completeAdmin(a.id); }}>
{meta.title} {a.when}
{a.count}
{a.who}
{a.do}
); })} {state.admin.length === 0 && (
Admin queue is empty. Rare. Beautiful.
)}
); } // --- Money snapshot ---------------------------------------------------- function Money() { const { state } = useStore(); const m = state.money; const net = m.inMonth - m.outMonth; const fmt = (n) => m.currency + n.toLocaleString('en-US'); const maxIn = Math.max(...m.inSpark); const maxOut = Math.max(...m.outSpark); return (
Money
this month, EUR
In
{fmt(m.inMonth)}
{m.inSpark.map((v, i) => )}
Out
{fmt(m.outMonth)}
{m.outSpark.map((v, i) => )}
Net {fmt(net)}
Outstanding {fmt(m.outstanding)}
); } // --- Pipeline ---------------------------------------------------------- function Pipeline() { const { state } = useStore(); const lanes = ['Opportunity', 'Discovery', 'Proposal', 'Negotiation', 'Won']; const total = lanes.reduce((acc, l) => acc + (state.pipeline[l]?.length || 0), 0); return (
Pipeline
{total} deals · big picture only — drill into CRM for detail
{lanes.map((lane) => { const deals = state.pipeline[lane] || []; return (
{lane} {deals.length}
{deals.map((d, i) => (
{d.n}
{d.v}{d.hot && ' · hot'}
))} {deals.length === 0 && (
)}
); })}
); } // --- Wins log ---------------------------------------------------------- function Wins() { const { state } = useStore(); return (
Wins
recent momentum
{state.wins.slice(0, 5).map((w) => (
{w.text} {w.when}
))}
); } Object.assign(window, { Deadlines, Admin, Money, Pipeline, Wins });