import clsx from 'clsx';
import { fmt } from '../utils/format.js';
function EventCard({ event }) {
const sevClass = `s${event.severity}`;
const cls = event.is_positive ? 'positive' : event.severity >= 4 ? 'critical' : '';
return (
{event.name}
SEV {event.severity}
{event.narrative}
{Object.entries(event.affected_sectors).map(([k, v]) => (
{k} ×{v.toFixed(2)}
))}
{event.treasury_injection > 0 && (
+{fmt(event.treasury_injection)} treasury injection
)}
);
}
function ProposalCard({ proposal, voteResult, votes, ownerDept }) {
const status = voteResult?.status || 'PENDING';
const cls = status === 'APPROVED' ? 'approved' : status.startsWith('REJ') || status.startsWith('AUTO') ? 'rejected' : '';
const voteList = votes.filter(v => v.proposal_id === proposal.proposal_id);
return (
{proposal.department}
{fmt(proposal.amount)}
{proposal.justification}
{voteList.map(v => (
{v.department.slice(0, 3)}: {v.vote === 'ABSTAIN' ? '—' : v.vote === 'YES' ? '✓' : '✗'}
))}
{voteResult && (
{status} · {voteResult.yes} yes / {voteResult.no} no / {voteResult.abstain} abstain
)}
);
}
export default function PhasePanel({ round }) {
if (!round) return null;
const events = round.events || [];
const debate = round.debate || [];
const proposals = round.proposals || [];
const votes = round.votes || [];
const voteResults = round.vote_results || [];
const proposalOrder = round.proposal_order || [];
const phase = round._phase; // only present on live partial rounds
return (
Phase 1 — Events{phase === 'events' && }
{events.length === 0 ? (
No events this round (40% baseline).
) : (
events.map((e, i) =>
)
)}
Phase 2 — Debate{phase === 'debate' && }
{debate.length === 0 && phase !== 'debate' ? (
All ministers stayed silent.
) : debate.length === 0 && phase === 'debate' ? (
Waiting for first minister to speak…
) : (
debate.map((m, i) => (
{m.department || m.agent_id}
{m.message}
))
)}
Phase 3–4 — Proposals & Votes{(phase === 'proposals' || phase === 'votes') && }
{proposalOrder.length > 0 && (
rotating order: {proposalOrder.join(' → ')}
)}
{proposals.length === 0 && (phase === 'proposals' || phase === 'votes') && (
Waiting for proposals…
)}
{proposals.map(p => {
const result = voteResults.find(v => v.proposal_id === p.proposal_id);
return (
);
})}
);
}
function LiveDot() {
return (