/* Admin → Calendar Overview: month grid of published events (reads jl_events). */ function CalendarOverviewScreen() { const TYPES = { event: { tint:'var(--gold-100)', ic:'var(--gold-600)', dot:'var(--gold-500)', icon:'party-popper', label:'Event' }, sport: { tint:'var(--info-100)', ic:'var(--info-500)', dot:'var(--info-500)', icon:'volleyball', label:'Sports' }, test: { tint:'var(--danger-100)', ic:'var(--danger-500)', dot:'var(--danger-500)', icon:'file-pen', label:'Test' }, due: { tint:'var(--blue-100)', ic:'var(--blue-500)', dot:'var(--blue-500)', icon:'clipboard-list', label:'Due' }, academic: { tint:'var(--blue-100)', ic:'var(--blue-500)', dot:'var(--blue-500)', icon:'graduation-cap', label:'Academic' }, early: { tint:'var(--danger-100)', ic:'var(--danger-500)', dot:'var(--danger-500)', icon:'clock', label:'Early release' }, off: { tint:'var(--success-100)', ic:'var(--success-500)', dot:'var(--success-500)', icon:'palmtree', label:'No school' }, }; const meta = (t) => TYPES[t] || TYPES.event; const [events, setEvents] = React.useState([]); React.useEffect(() => { const read = () => { try { setEvents(JSON.parse(localStorage.getItem('jl_events') || '[]')); } catch(e){} }; read(); const onStore = (e) => { if (e.key === 'jl_events') read(); }; window.addEventListener('storage', onStore); const iv = setInterval(read, 1500); return () => { window.removeEventListener('storage', onStore); clearInterval(iv); }; }, []); const [sel, setSel] = React.useState(null); // map events to June day numbers via "Jun D" in the `when` string const dayOf = (e) => { const m = /Jun\s+(\d+)/.exec(e.when||''); return m ? parseInt(m[1]) : null; }; const byDay = {}; events.forEach(e => { const d = dayOf(e); if (d) { (byDay[d] = byDay[d] || []).push(e); } }); // June 2026 starts on a Monday; build a Mon-first grid const daysInMonth = 30, firstDow = 0; // Mon=0 const cells = []; for (let i=0;i
{/* month grid */} Live}>
{DOW.map(d =>
{d}
)} {cells.map((d,i) => { if (!d) return
; const evs = byDay[d] || []; const on = sel===d; return ( ); })}
{/* list */} setSel(null)} style={{ background:'transparent', border:0, color:'var(--blue-500)', fontWeight:700, fontSize:12.5, cursor:'pointer', fontFamily:'var(--font-sans)' }}>Show all} pad={false}> {shown.length===0 ?
No events{sel?' on this day':''}.
: shown.map((e,i) => { const m = meta(e.type); return (
0?'1px solid var(--gray-100)':'0' }}>
{e.title}
{e.when} · {e.where}
{m.label}
); })}
); } Object.assign(window, { CalendarOverviewScreen });