import { fmtSigned } from '../utils/format.js'; const COMPONENTS = [ { key: 'base_reward', label: 'Base (prosperity)' }, { key: 'productivity_bonus', label: 'Productivity bonus' }, { key: 'survival_bonus', label: 'Survival bonus' }, { key: 'over_alloc_penalty', label: 'Over-alloc penalty' }, { key: 'under_alloc_penalty', label: 'Under-alloc penalty' }, { key: 'critical_penalty', label: 'Critical penalty' }, ]; export default function RewardCard({ reward, cumulative }) { if (!reward) return null; const max = Math.max( 1, ...COMPONENTS.map(c => Math.abs(reward[c.key] || 0)), ); return (

Reward breakdown cum {fmtSigned(cumulative, 1)}

{COMPONENTS.map(({ key, label }) => { const v = reward[key] || 0; const pct = (Math.abs(v) / max) * 50; return (
{label}
{v >= 0 ? (
) : (
)}
0 ? 'var(--accent-good)' : 'var(--text-dim)' }}> {fmtSigned(v, 2)}
); })}
Step total {fmtSigned(reward.total, 2)}
); }