;
}
function LevelDesigner({user,baseUrl}){
const [data,setData]=React.useState(null),[catalog,setCatalog]=React.useState(null),[content,setContent]=React.useState([]),[level,setLevel]=React.useState(null),[index,setIndex]=React.useState(0),[tab,setTab]=React.useState('levels'),[error,setError]=React.useState(''),[notice,setNotice]=React.useState(''),[busy,setBusy]=React.useState(false),[preview,setPreview]=React.useState(false),[history,setHistory]=React.useState([]);
const request=(path,options)=>window.TeacherRoomClient.request(baseUrl,user,path,options);
async function load(){const [d,c,b]=await Promise.all([request('/authoring/levels'),request('/authoring/catalog'),request('/authoring/content')]);setData(d);setCatalog(c);setContent(b.items.filter(r=>r.state==='approved'));return d;}
React.useEffect(()=>{let live=true;load().then(d=>{if(live)setLevel(window.LevelDesignModel.hydrate(d.levels.find(l=>l.id===1)||{id:1,total:1,slots:[]}));}).catch(e=>setError(e.message));return()=>{live=false;};},[]);
if(!data||!catalog||!level)return
{error||'Cargando diseñador de niveles…'}
;
const slot=level.slots[index]||level.slots[0],update=(key,value)=>{setLevel(p=>({...p,slots:p.slots.map((s,i)=>i===index?{...s,[key]:value,...(['topicIds','difficulty','questionCount','contentIds'].includes(key)?{reactionBlocks:null}:{})}:s)}));setNotice('');};
const checkList=(label,key,options)=> ;
const activityNames={pending:'Pendiente',video:'Clase en video',zeroError:'Zero Error',reaction:'Reaction',group:'Alien / Special Technique',alienContact:'Mirror Reflection',aiExam:'Ejemplos del alumno'};
const kind=slot.type==='zeroError'?'zero':slot.type==='reaction'?'reaction':slot.type==='alienContact'?'mirror':slot.type==='group'?'alien':'';
return ESTUDIO DEL MAESTRO / EXCLUSIVO DE P
Diseño de niveles
El título dice qué aprende el alumno; el tipo dice cómo lo va a practicar. La presentación y el hover comparten la misma explicación.
{error&&
{error}
}{notice&&
{notice}
}{tab==='contacts'?:<>
{level.id>1&&<>La última casilla del nivel {level.id-1} la entrega al terminar.>}