// Council: manage award EVENTS and their CATEGORIES (add / amend / remove). const AWARD_SETUP = (function () { const COLORS = [ ['var(--navy)', 'var(--navy)', 'Navy'], ['var(--ocean)', 'var(--navy)', 'Ocean'], ['var(--gold)', 'var(--gold-d)', 'Red'], ['var(--ok)', 'var(--ok)', 'Green'], ['var(--warn)', '#9c6a16', 'Amber'], ['var(--navy2)', 'var(--navy)', 'Royal'], ]; const ICONS = ['♛', '★', '◈', '♦', '✦', '◎', '✎', '❦', '◆', '▲']; const uid = () => 'c_' + Math.random().toString(36).slice(2, 8); function EventEditor({ item, onClose }) { const { actions } = CTSCStore.useStore(); const [v, setV] = React.useState(item ? JSON.parse(JSON.stringify(item)) : { name: '', eyebrow: '', blurb: '', explainer: false, categories: [] }); const set = (k, val) => setV(s => ({ ...s, [k]: val })); const setCat = (id, patch) => setV(s => ({ ...s, categories: s.categories.map(c => c.id === id ? { ...c, ...patch } : c) })); const addCat = () => setV(s => ({ ...s, categories: [...s.categories, { id: uid(), name: '', desc: '', ic: '★', acc: 'var(--navy)', accD: 'var(--navy)' }] })); const delCat = (id) => setV(s => ({ ...s, categories: s.categories.filter(c => c.id !== id) })); const save = () => { const payload = { ...v, categories: v.categories.filter(c => c.name.trim()) }; if (item) actions.updateItem('awardEvents', item.id, payload); else actions.addItem('awardEvents', payload); onClose(); }; const valid = v.name.trim() && v.categories.some(c => c.name.trim()); return (
e.stopPropagation()} className="fade-in" style={{ background: '#fff', borderRadius: 14, width: 'min(640px,100%)', maxHeight: '90vh', overflow: 'auto', boxShadow: 'var(--shadow-lg)' }}>

{item ? 'Edit award event' : 'New award event'}

set('name', e.target.value)} placeholder="e.g. CTSC Sport Awards" />
set('eyebrow', e.target.value)} placeholder="e.g. Annual Sport Awards" />