/* ================================================================== Test picker modal — shown when user opens "Paper Evaluation" from sidebar ================================================================== */ const { Icon: TPIcon, StatusPill: TPStatusPill } = window.AppUI; const TestPickerModal = ({ open, onClose, onPick }) => { const [search, setSearch] = React.useState(""); const [classFilter, setClassFilter] = React.useState("All"); const [subjectFilter, setSubjectFilter] = React.useState("All"); if (!open) return null; // Only tests that can be evaluated — those with structured questions and uploaded scripts const candidates = window.APP.TESTS.filter(t => t.status === "grading" || t.status === "optimised" || t.status === "closed"); const filtered = candidates.filter(t => { if (classFilter !== "All" && t.className !== classFilter) return false; if (subjectFilter !== "All" && t.subject !== subjectFilter) return false; if (search && !t.title.toLowerCase().includes(search.toLowerCase()) && !t.id.toLowerCase().includes(search.toLowerCase())) return false; return true; }); const recent = filtered.slice(0, 3); const rest = filtered.slice(3); return (