/* Admin → Calendar: author school events (publishes to parent & student calendars). */ function EventsScreen() { const TYPES = [ { id:'event', label:'Event', icon:'party-popper', tint:'var(--gold-100)', ic:'var(--gold-600)' }, { id:'sport', label:'Sports', icon:'volleyball', tint:'var(--info-100)', ic:'var(--info-500)' }, { id:'test', label:'Test/Quiz', icon:'file-pen', tint:'var(--danger-100)', ic:'var(--danger-500)' }, { id:'due', label:'Due date', icon:'clipboard-list', tint:'var(--blue-100)', ic:'var(--blue-500)' }, { id:'academic', label:'Academic', icon:'graduation-cap', tint:'var(--blue-100)', ic:'var(--blue-500)' }, { id:'early', label:'Early release',icon:'clock', tint:'var(--danger-100)', ic:'var(--danger-500)' }, { id:'off', label:'No school', icon:'palmtree', tint:'var(--success-100)', ic:'var(--success-500)' }, ]; const meta = (t) => TYPES.find(x=>x.id===t) || TYPES[0]; const SEED = [ { id:'e-due', type:'due', title:'Ecosystem Lab Report due', when:'Fri, Jun 6 · 11:59 PM', where:'Science' }, { id:'e-test', type:'test', title:'Math Quiz — Fractions', when:'Tue, Jun 9 · 9:00 AM', where:'Rm 118' }, { id:'e-fair', type:'event', title:'Spring Science Fair', when:'Thu, Jun 12 · 6:00 PM', where:'Main Gymnasium' }, { id:'e-erd', type:'early', title:'Early Release Day', when:'Fri, Jun 13 · 1:00 PM', where:'Storm schedule' }, { id:'e-soc', type:'sport', title:'6th Grade vs. Cinco Ranch', when:'Sat, Jun 14 · 10:00 AM', where:'Soccer Field 2' }, { id:'e-rc', type:'academic', title:'End-of-Year Report Cards', when:'Mon, Jun 16', where:'Posted in app' }, { id:'e-sum', type:'off', title:'Summer Break Begins', when:'Fri, Jun 20', where:'No school' }, ]; const [events, setEvents] = React.useState(() => { try { return JSON.parse(localStorage.getItem('jl_events') || 'null') || SEED; } catch(e){ return SEED; } }); const [form, setForm] = React.useState({ type:'event', title:'', when:'', where:'' }); const publish = (list) => { setEvents(list); try { localStorage.setItem('jl_events', JSON.stringify(list)); } catch(e){} }; const add = () => { if (!form.title.trim()) { jlToast('Add a title first', { icon:'triangle-alert', color:'#E5484D' }); return; } const e = { id:'e'+Date.now(), type:form.type, title:form.title, when:form.when||'TBD', where:form.where||'—' }; publish([...events, e]); setForm({ type:'event', title:'', where:'', when:'' }); jlToast('Published to families & students', { icon:'calendar-check' }); }; const remove = (id) => { publish(events.filter(e=>e.id!==id)); jlToast('Event removed', { icon:'trash-2', color:'#E5484D' }); }; return (
e.type==='event'||e.type==='sport').length} label="RSVP events" />
{/* composer */}
{TYPES.map(t => { const on = form.type===t.id; return ( ); })}
setForm(f=>({ ...f, title:e.target.value }))} placeholder="e.g. Fall Open House" style={{ ...evField, marginBottom:12 }} /> setForm(f=>({ ...f, when:e.target.value }))} placeholder="e.g. Thu, Sep 18 · 6:00 PM" style={{ ...evField, marginBottom:12 }} /> setForm(f=>({ ...f, where:e.target.value }))} placeholder="e.g. Main Gymnasium" style={{ ...evField, marginBottom:16 }} />
{/* published list */} Live to apps} pad={false}> {events.map((e,i) => { const m = meta(e.type); return (
0?'1px solid var(--gray-100)':'0' }}>
{e.title}
{e.when} · {e.where}
{m.label}
); })}
); } const evLbl = { display:'block', fontSize:11.5, fontWeight:700, color:'var(--gray-500)', marginBottom:6 }; const evField = { width:'100%', boxSizing:'border-box', border:'1px solid var(--gray-200)', borderRadius:9, padding:'10px 12px', fontSize:13.5, fontFamily:'var(--font-sans)', color:'var(--ink)', outline:'none', background:'#fff' }; Object.assign(window, { EventsScreen });