// ASCII block bar for vote weight visualisation function VoteBar({ pct, isWinner }) { const total = 14 const filled = Math.round((pct / 100) * total) const char = isWinner ? '█' : '▒' const color = isWinner ? 'var(--primary)' : 'var(--text-muted)' const shadow = isWinner ? 'var(--glow-sm)' : 'none' return ( {char.repeat(Math.max(0, filled))}{'░'.repeat(Math.max(0, total - filled))} ) } export default function VoteTally({ info }) { const tally = info?.winning_vote_tally if (!tally) return null const winner = Object.entries(tally).reduce((a, b) => (b[1] > a[1] ? b : a), ['', 0])[0] const max = Math.max(...Object.values(tally), 0.01) return (
Vote Tally
{Object.entries(tally).map(([opt, val]) => { const pct = Math.round((val / max) * 100) const isWinner = opt === winner return (
{opt.replace(/_/g, '_')} {val.toFixed(1)}
) })}
winner: {winner.replace(/_/g, '_')}
) }