/* Messages list + Chat thread — threads are per-child. */ const JL_CONVO_SETS = { ej: [ { id:'ej-1', initials:'MJ', color:'blue', name:'Mrs. Johnson', role:'Math Teacher', cat:'Teachers', time:'2m', unread:2, preview:'EJ did great today in class!', bubbles:[{me:false,t:'Hi! Just wanted to share that EJ did great today in class.'},{me:false,t:'Reminder: the fractions worksheet is due tonight at 11:59 PM.'},{me:true,t:'Thank you so much! We\u2019ll get it done tonight.'}], summary:'EJ had a great day. A fractions worksheet is due tonight at 11:59 PM — you confirmed it\u2019ll be done.' }, { id:'ej-2', initials:'MW', color:'cyan', name:'Mr. Williams', role:'Science Teacher', cat:'Teachers', time:'1h', unread:0, preview:"Don't forget the quiz tomorrow.", bubbles:[{me:false,t:'EJ\u2019s lab report was excellent work.'},{me:false,t:'Don\u2019t forget the quiz on ecosystems tomorrow.'},{me:true,t:'Thanks for the heads-up — we\u2019ll review tonight.'}], summary:'Praise for EJ\u2019s lab report; an ecosystems quiz is tomorrow.' }, { id:'ej-3', initials:'SA', color:'navy', name:'School Admin', role:'Katy Middle School', cat:'School', time:'2h', unread:0, preview:'Early dismissal this Friday at 1:00 PM.', bubbles:[{me:false,t:'Reminder: early dismissal this Friday at 1:00 PM.'},{me:false,t:'Please confirm your pickup plan in the app.'}], summary:'Early dismissal Friday at 1:00 PM — confirm your pickup plan.' }, { id:'ej-4', initials:'CB', color:'red', name:'Coach Brown', role:'Boys Basketball', cat:'Groups', time:'2d', unread:0, preview:'Practice tomorrow at 4:30 PM.', bubbles:[{me:false,t:'Practice tomorrow at 4:30 PM in the main gym.'},{me:true,t:'Got it, EJ will be there.'}], summary:'Basketball practice tomorrow at 4:30 PM in the main gym.' }, ], maya: [ { id:'maya-1', initials:'RC', color:'gold', name:'Ms. Carter', role:'4th Grade Teacher', cat:'Teachers', time:'15m', unread:1, preview:'Maya was so kind to a new student today.', bubbles:[{me:false,t:'Maya was so kind to a new student today — I wanted you to know.'},{me:false,t:'Spelling test is Friday; the word list is in her folder.'},{me:true,t:'That\u2019s wonderful to hear, thank you!'}], summary:'Kindness praise for Maya; spelling test Friday, list in her folder.' }, { id:'maya-2', initials:'LP', color:'green', name:'Ms. Park', role:'Reading Specialist', cat:'Teachers', time:'3h', unread:0, preview:'Maya moved up a reading level!', bubbles:[{me:false,t:'Great news — Maya moved up a reading level this week.'},{me:true,t:'She\u2019ll be thrilled — thank you for the support.'}], summary:'Maya advanced a reading level this week.' }, { id:'maya-3', initials:'SA', color:'navy', name:'School Admin', role:'Katy Elementary', cat:'School', time:'2h', unread:0, preview:'Early dismissal this Friday at 1:00 PM.', bubbles:[{me:false,t:'Reminder: early dismissal this Friday at 1:00 PM.'},{me:false,t:'Walkers will be released from the front entrance.'}], summary:'Early dismissal Friday at 1:00 PM — walkers released from the front.' }, { id:'maya-4', initials:'AG', color:'red', name:'Art Club', role:'Katy Elementary', cat:'Groups', time:'1d', unread:0, preview:'Bring a smock on Thursday.', bubbles:[{me:false,t:'Art Club meets Thursday — please send a smock with Maya.'},{me:true,t:'Will do, thanks!'}], summary:'Art Club Thursday; send a smock with Maya.' }, ], }; function jlConvos(){ return JL_CONVO_SETS[jlChild().id] || JL_CONVO_SETS.ej; } const JL_FILTERS = ['All','Teachers','School','Groups']; function MessagesScreen({ onNav, onOpen, onBack }) { const [filter, setFilter] = React.useState('All'); const list = jlConvos().filter(c => filter==='All' || c.cat===filter); return (
jlToast('New message', { icon:'square-pen' })} style={{ width:38, height:38, borderRadius:'999px', border:'1px solid var(--gray-200)', background:'#fff', display:'flex', alignItems:'center', justifyContent:'center', cursor:'pointer' }}>} />
{JL_FILTERS.map(f => ( ))}
{list.map(c => ( ))}
); } function ChatScreen({ convo, onBack }) { const c = convo || jlConvos()[0]; const [bubbles, setBubbles] = React.useState(c.bubbles || []); const [draft, setDraft] = React.useState(''); const [showSummary, setShowSummary] = React.useState(false); const endRef = React.useRef(null); const send = () => { const t = draft.trim(); if (!t) return; setBubbles(b => [...b, { me:true, t }]); setDraft(''); setTimeout(() => endRef.current && endRef.current.scrollIntoView({ behavior:'smooth' }), 50); }; return (
{c.name}
{c.role}
{/* AI Summary chip */}
{showSummary && (
SUMMARY
{c.summary}
)}
{bubbles.map((b,i)=>(
{b.t}
))}
setDraft(e.target.value)} onKeyDown={e=>{ if(e.key==='Enter') send(); }} placeholder="Type message..." style={{ flex:1, border:0, background:'transparent', outline:'none', fontSize:14, fontFamily:'var(--font-sans)' }} />
); } Object.assign(window, { MessagesScreen, ChatScreen, jlConvos });