/* Brainstorm X — Shortlist board (Finalists). */ (function () { const { useState } = React; const DS = window.BrainstormXDesignSystem_f2a458; const { Button, Card, NameCard, Chip, Badge, HeatBadge } = DS; const I = window.BXIcons; const FILTERS = ['Most liked', 'Most debated', 'Shortest', 'Most brandable', 'Best for .com']; function Shortlist({ names, setNames, goto }) { const [filter, setFilter] = useState('Most liked'); const sorted = [...names].sort((a, b) => { if (filter === 'Shortest') return a.name.length - b.name.length; if (filter === 'Most debated') return (b.counts.down + b.counts.ice) - (a.counts.down + a.counts.ice); if (filter === 'Most brandable') return (b.style === 'brandable') - (a.style === 'brandable'); return b.score - a.score; }); const finalists = sorted.filter((n) => n.shortlisted || n.score >= 8).slice(0, 4); const rest = sorted.filter((n) => !finalists.includes(n)); const vote = (id, type) => setNames((ns) => ns.map((n) => { if (n.id !== id) return n; if (type === 'star') { const sl = !n.shortlisted; const score = n.score + (sl ? 5 : -5); return { ...n, shortlisted: sl, score, heat: window.BXheatFromScore(score) }; } const d = { up: 2, down: -2, fire: 3, ice: -3 }[type] || 0; const score = n.score + d; const counts = { ...n.counts, [type]: (n.counts[type] || 0) + 1 }; return { ...n, score, counts, heat: window.BXheatFromScore(score) }; })); return (
Pickle Paws · Shortlist
Finalists & top names
Sort {FILTERS.map((f) => setFilter(f)}>{f})}

Finalists

{finalists.length}
{finalists.map((n) => vote(n.id, t)} />)}

All names

{rest.length}
{rest.map((n, i) => (
{i + 1} {n.name} {n.style} = 0 ? 'var(--heat-warm)' : 'var(--cold-cool)' }}>{n.score > 0 ? '+' + n.score : n.score}
))}
); } window.BXShortlist = Shortlist; })();