/* Safety & Wellbeing — mood check-ins, teacher feedback, AI pattern insight */ const JL_MOODS = { happy: { icon:'smile', label:'Happy', bg:'var(--success-100)', fg:'var(--success-600)', dot:'var(--success-500)' }, calm: { icon:'meh', label:'Calm', bg:'var(--info-100)', fg:'var(--info-500)', dot:'var(--info-500)' }, tired: { icon:'cloud', label:'Tired', bg:'var(--warning-100)', fg:'var(--warning-600)', dot:'var(--warning-500)' }, upset: { icon:'frown', label:'Upset', bg:'var(--danger-100)', fg:'var(--danger-600)', dot:'var(--danger-500)' }, }; function SafetyScreen({ onNav, onBack }) { const week = [ { d:'Mon', m:'tired' }, { d:'Tue', m:'happy' }, { d:'Wed', m:'calm' }, { d:'Thu', m:'happy' }, { d:'Fri', m:'happy', today:true }, ]; const baseFeedback = [ { icon:'hand-helping', tint:'var(--success-100)', ic:'var(--success-500)', title:'Helped a classmate clean up', who:'Ms. Rivera · Today', kind:'pos' }, { icon:'target', tint:'var(--success-100)', ic:'var(--success-500)', title:'Great focus during math', who:'Mr. Allen · Today', kind:'pos' }, { icon:'volume-2', tint:'var(--warning-100)', ic:'var(--warning-600)', title:'Chatty during quiet reading', who:'Mr. Lee · Yesterday', kind:'watch' }, ]; const [live, setLive] = React.useState([]); React.useEffect(() => { const read = () => { try { const all = JSON.parse(localStorage.getItem('jl_behavior') || '{}'); setLive(all[jlChild().id] || []); } catch(e){} }; read(); const onStore = (e) => { if (e.key === 'jl_behavior') read(); }; window.addEventListener('storage', onStore); const iv = setInterval(read, 1500); return () => { window.removeEventListener('storage', onStore); clearInterval(iv); }; }, []); const feedback = [ ...live.map(n => ({ icon:n.icon, tint:n.kind==='pos'?'var(--success-100)':'var(--warning-100)', ic:n.kind==='pos'?'var(--success-500)':'var(--warning-600)', title:n.title, who:n.who, kind:n.kind })), ...baseFeedback, ]; return (
{/* mood-this-week hero */}
MOOD THIS WEEK
Mostly Positive
4 of 5 check-ins were happy or calm
{week.map(w => { const m = JL_MOODS[w.m]; return ( ); })}
{/* today's check-in */} {jlT('l_todays_checkin')}
{jlChild().first} checked in feeling Happy
8:42 AM · Homeroom self check-in
Happy
Looking forward to art class today.
{/* teacher feedback */} {jlT('l_teacher_feedback')}
{feedback.map((f,i) => ( {i>0 && }
{f.title}
{f.who}
{f.kind==='pos' ? Positive : Watch}
))}
{/* AI wellbeing insight */}
AI Wellbeing Insight
{jlChild().first}'s mood tends to dip on Mondays, often after weekends. A calmer Sunday-evening routine may help ease the start of the week.
{/* counselor CTA */}
); } Object.assign(window, { SafetyScreen });