/* Messages list + Chat thread */
const JL_CONVOS = [
{ id:1, initials:'MJ', color:'blue', name:'Mrs. Johnson', role:'Math Teacher', preview:'EJ did great today in class!', time:'2m', unread:2, cat:'Teachers' },
{ id:2, initials:'MW', color:'cyan', name:'Mr. Williams', role:'Science Teacher', preview:"Don't forget the quiz tomorrow.", time:'1h', unread:0, cat:'Teachers' },
{ id:3, initials:'SA', color:'navy', name:'School Admin', role:'Katy Middle School', preview:'Early dismissal this Friday at 1:00 PM.', time:'2h', unread:0, cat:'School' },
{ id:4, initials:'AP', color:'gold', name:'Aftercare Program', role:'Katy Middle School', preview:'Reminder: Aftercare payment due.', time:'1d', unread:0, cat:'School' },
{ id:5, initials:'CB', color:'red', name:'Coach Brown', role:'Boys Basketball', preview:'Practice tomorrow at 4:30 PM.', time:'2d', unread:0, cat:'Groups' },
];
const JL_FILTERS = ['All','Teachers','School','Groups'];
function MessagesScreen({ onNav, onOpen, onBack }) {
const [filter, setFilter] = React.useState('All');
const list = JL_CONVOS.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 || JL_CONVOS[0];
const [bubbles, setBubbles] = React.useState([
{ 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.' },
]);
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 (
{/* AI Summary chip */}
{showSummary && (
SUMMARY
EJ had a great day. A fractions worksheet is due tonight at 11:59 PM — you confirmed it'll be done.
)}
{bubbles.map((b,i)=>(
{b.t}
))}
);
}
Object.assign(window, { MessagesScreen, ChatScreen, JL_CONVOS });