// Summary panel — bottom right const SummaryPanel = ({ totalIncome, totalCommitted, totalSupplied, period, sources, consumers }) => { const surplus = totalIncome - totalCommitted; const deficit = surplus < 0; const unpoweredCount = consumers.filter(c => { return c.amount > 0; }).length; const periodSuffix = period === 'monthly' ? '/mo' : period === 'biweekly' ? '/2wk' : '/wk'; const annual = period === 'monthly' ? totalIncome * 12 : period === 'biweekly' ? totalIncome * 26 : totalIncome * 52; // bar dimensions const maxBar = Math.max(totalIncome, totalCommitted, 1); const incomePct = (totalIncome / maxBar) * 100; const committedPct = (totalCommitted / maxBar) * 100; return (
{/* header */}
GRID STATUS
{deficit ? '⚠ OVERDRAW' : 'NOMINAL'}
{/* bars */}
{/* Income bar */}
Generation ${totalIncome.toFixed(0)}{periodSuffix}
{/* Committed bar */}
Load ${totalCommitted.toFixed(0)}{periodSuffix}
{/* Big surplus number */}
{deficit ? 'Deficit' : 'Surplus'}
{deficit ? '-' : ''}${Math.abs(surplus).toFixed(0)}
{periodSuffix.replace('/', 'per ')} · ~${Math.abs(annual - (period === 'monthly' ? totalCommitted * 12 : period === 'biweekly' ? totalCommitted * 26 : totalCommitted * 52)).toFixed(0)} annual
{/* mini stats grid */}
Sources
{sources.length}
Loads
{consumers.length}
Funded
{totalCommitted > 0 ? Math.round((totalSupplied / totalCommitted) * 100) : 0}%
); }; window.SummaryPanel = SummaryPanel;