export function subjectsFor(units) { return ['All', ...new Set(units.map((unit) => unit.subject).filter(Boolean))].sort((a, b) => { if (a === 'All') return -1; if (b === 'All') return 1; return a.localeCompare(b); }); } export function filterUnits(units, subject) { return subject === 'All' ? units : units.filter((unit) => unit.subject === subject); } export function teacherGuidesFor(unit) { return (unit.materials ?? []).filter((material) => material.role === 'Teacher Guide'); }