/* Brainstorm X — Name Arena. The signature live 3D-ish naming space. */
(function () {
const { useState, useRef } = React;
const DS = window.BrainstormXDesignSystem_f2a458;
const { Button, Card, NameCard, KeywordOrb, Badge, Avatar, AvatarStack, IconButton } = DS;
const I = window.BXIcons;
const heatFromScore = window.BXheatFromScore;
const SCALE = { on_fire: 1.0, hot: 0.94, warm: 0.86, neutral: 0.82, cold: 0.78, frozen: 0.7 };
const VOTE_DELTA = { up: 2, down: -2, fire: 3, ice: -3 };
function Stars({ n = 60 }) {
const stars = React.useMemo(() => Array.from({ length: n }, () => ({
top: Math.random() * 100, left: Math.random() * 100, s: Math.random() * 2 + 1,
o: Math.random() * 0.6 + 0.15, glow: Math.random() > 0.88,
})), [n]);
return
{stars.map((s, i) => )}
;
}
function Header({ wave, onGenerate, generating, goto }) {
return (
);
}
function KeywordRail({ keywords, onBoost }) {
return (
Keywords
{keywords.map((k) =>
onBoost(k.id)} />)}
);
}
function ActivityFeed({ events }) {
return (
Activity
{events.slice(0, 5).map((e, i) => (
{e.who.split(' ')[0]} {e.what}
))}
);
}
function DetailPanel({ name, onClose, onVote }) {
const variants = ['More like this', 'Make it shorter', 'More premium', 'More playful'];
return (
{name.style}
{name.name}
{name.pronunciation}
{name.reason}
{name.keywords.map((k) => {k})}
SCORE
{name.score > 0 ? '+' + name.score : name.score}
CONFIDENCE
{name.confidence}%
Evolve this name
{variants.map((v) => }>{v})}
Comments
I like how short this is.
Works for a .co.uk domain too 👍
);
}
function Arena({ names, setNames, keywords, setKeywords, wave, setWave, goto }) {
const [openId, setOpenId] = useState(null);
const [generating, setGenerating] = useState(false);
const [events, setEvents] = useState([
{ who: 'Sam Lee', what: 'boosted "quirky"' },
{ who: 'Alex Roy', what: 'shortlisted "Pawlio"' },
{ who: 'Priya N', what: 'upvoted "Snugglo"' },
]);
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: heatFromScore(score) };
}
const score = n.score + (VOTE_DELTA[type] || 0);
const counts = { ...n.counts, [type]: (n.counts[type] || 0) + 1 };
return { ...n, score, counts, heat: heatFromScore(score) };
}));
const labels = { up: 'upvoted', down: 'downvoted', fire: 'set 🔥 on', ice: 'cooled', star: 'shortlisted' };
const nm = names.find((n) => n.id === id);
setEvents((ev) => [{ who: 'You', what: `${labels[type]} "${nm ? nm.name : ''}"` }, ...ev]);
};
const boost = (id) => {
setKeywords((ks) => ks.map((k) => k.id === id ? { ...k, weight: k.weight + 1, count: (k.count || 0) + 1, state: k.state === 'avoid' ? 'avoid' : 'boosted' } : k));
const kw = keywords.find((k) => k.id === id);
setEvents((ev) => [{ who: 'You', what: `boosted "${kw ? kw.label : ''}"` }, ...ev]);
};
const generate = () => {
setGenerating(true);
setTimeout(() => {
const batch = [
{ id: 'pip-' + wave, name: 'Pippa & Co', style: 'short_phrase', pronunciation: 'pip-uh', reason: 'Playful, personable and clearly British in tone.', keywords: ['quirky', 'warm'], confidence: 77, score: 6, counts: { up: 4, down: 0, fire: 1, ice: 0 }, x: 40, y: 24, heat: 'hot', fresh: true },
{ id: 'wag-' + wave, name: 'Waggle', style: 'real_word', pronunciation: 'wag-uhl', reason: 'Fun, energetic and easy to remember for a pet brand.', keywords: ['playful', 'fun'], confidence: 73, score: 4, counts: { up: 3, down: 0, fire: 0, ice: 0 }, x: 56, y: 70, heat: 'warm', fresh: true },
];
setNames((ns) => [...ns.map((n) => ({ ...n, fresh: false })), ...batch]);
setWave((w) => w + 1);
setEvents((ev) => [{ who: 'Brainstorm X', what: `generated Wave ${wave + 1}` }, ...ev]);
setGenerating(false);
}, 1100);
};
const open = names.find((n) => n.id === openId);
return (
{/* scene */}
{names.map((n) => {
const sc = (SCALE[n.heat] || 0.82);
return (
0 ? {} : {}}
onVote={(t) => vote(n.id, t)} onOpen={() => setOpenId(n.id)} />
);
})}
{open &&
setOpenId(null)} onVote={vote} />}
{/* intro tooltip */}
Welcome to your Name Arena. Vote on names and boost keywords — liked names grow and glow, weak ones cool down.
);
}
// drop-in keyframe
if (!document.getElementById('bx-arena-extra')) {
const s = document.createElement('style'); s.id = 'bx-arena-extra';
s.textContent = '@keyframes bxDrop{0%{transform:translate(-50%,-90%) scale(0.4);opacity:0}100%{transform:translate(-50%,-50%) scale(1);opacity:1}}';
document.head.appendChild(s);
}
window.BXArena = Arena;
})();