/* Admin → Announcements: compose & publish school-wide announcements. */ function AnnouncementsScreen() { const AUD = ['All families', 'Grade 6', 'Grade 7', 'Grade 8', 'Staff only']; const [title, setTitle] = React.useState(''); const [body, setBody] = React.useState(''); const [aud, setAud] = React.useState('All families'); const [pin, setPin] = React.useState(false); const [posts, setPosts] = React.useState([ { id:1, title:'Spring Science Fair — Save the Date', body:'Join us June 12 at 6 PM in the main gym for student projects and awards.', aud:'All families', when:'2 days ago', reach:'1,248', pinned:true }, { id:2, title:'Yearbook orders close Friday', body:'Order online before June 6 to guarantee a copy.', aud:'All families', when:'4 days ago', reach:'1,248', pinned:false }, { id:3, title:'Grade 8 DC trip — final payment', body:'Balance due by June 15. See the Billing tab in your app.', aud:'Grade 8', when:'1 week ago', reach:'284', pinned:false }, ]); const publish = () => { if (!title.trim()) { jlToast('Add a headline first', { icon:'triangle-alert', color:'#E5484D' }); return; } setPosts(p => [{ id:Date.now(), title, body, aud, when:'Just now', reach: aud==='All families'?'1,248':(aud==='Staff only'?'96':'284'), pinned:pin }, ...p]); jlToast('Announcement published to ' + aud, { icon:'megaphone' }); setTitle(''); setBody(''); setPin(false); }; const togglePin = (id) => setPosts(p => p.map(x => x.id===id ? { ...x, pinned:!x.pinned } : x)); const remove = (id) => { setPosts(p => p.filter(x => x.id!==id)); jlToast('Announcement removed', { icon:'trash-2', color:'#E5484D' }); }; const sorted = [...posts].sort((a,b)=> (b.pinned?1:0)-(a.pinned?1:0)); return (