openlearn-next 0.2.8 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/BatchPickerModal-9BhmNM2R.js +1 -0
- package/dist/assets/{ClassesView-B1B3wlkx.js → ClassesView-DKScQDos.js} +2 -2
- package/dist/assets/CloudDriveModal-cPtTMriS.js +1 -0
- package/dist/assets/CourseManagement-AoauIULq.js +1 -0
- package/dist/assets/CourseWizardModal-BOgLpLz7.js +3 -0
- package/dist/assets/{Dashboard-DQ91dQio.js → Dashboard-BPxkmnvI.js} +2 -2
- package/dist/assets/ExportWeightModal-DSzySeqh.js +1 -0
- package/dist/assets/{HelpView-DLAKVpwf.js → HelpView-CuNDka5n.js} +3 -3
- package/dist/assets/ImportLessonsModal-Bwy2r-96.js +1 -0
- package/dist/assets/InteractiveWhiteboard-C7JMplbp.js +62 -0
- package/dist/assets/{LazyWhiteboard-B6rDWBFb.js → LazyWhiteboard-BIepzrv9.js} +1 -1
- package/dist/assets/LessonEditorView-C-mvYRUd.js +1 -0
- package/dist/assets/LiveClassroomView-CqRbWNis.js +1 -0
- package/dist/assets/NotificationDetailModal-Bk1g_prI.js +1 -0
- package/dist/assets/{PluginView-DCY4yi2h.js → PluginView-C6s7Ltcy.js} +1 -1
- package/dist/assets/QuizGeneratorModal-DWH1zP0X.js +1 -0
- package/dist/assets/StudentAssignmentView-CfTjeoAp.js +1 -0
- package/dist/assets/StudentLessonView-D2XvNGnW.js +1 -0
- package/dist/assets/StudentPreviewModal-BwXG6Cis.js +1 -0
- package/dist/assets/StudentView-DT-373QP.js +2 -0
- package/dist/assets/SystemResourceLibraryModal-BTL8rB0g.js +1 -0
- package/dist/assets/TeacherView-XdD-y67J.js +2 -0
- package/dist/assets/index-C5FKWIUq.js +190 -0
- package/dist/assets/{vendor-pptx-B0hlo0eh.js → vendor-pptx-B_NheIKl.js} +5 -5
- package/dist/index.html +1 -1
- package/dist/server.cjs +92 -1
- package/package.json +1 -1
- package/dist/assets/BatchPickerModal-Bt8Qx0Av.js +0 -1
- package/dist/assets/CloudDriveModal-BSZaWIex.js +0 -1
- package/dist/assets/CourseManagement-Bnezm9Vv.js +0 -1
- package/dist/assets/CourseWizardModal-BvfTvcQT.js +0 -3
- package/dist/assets/ExportWeightModal-al1iIVxb.js +0 -1
- package/dist/assets/ImportLessonsModal-DwhvqzY_.js +0 -1
- package/dist/assets/InteractiveWhiteboard-CQ-4meYj.js +0 -102
- package/dist/assets/LessonEditorView-DixwX1Kw.js +0 -1
- package/dist/assets/LiveClassroomView-j93YOxSh.js +0 -1
- package/dist/assets/NotificationDetailModal-CQ9PIqkD.js +0 -1
- package/dist/assets/QuizGeneratorModal-BvTcmD68.js +0 -1
- package/dist/assets/StudentAssignmentView-4R0WxStx.js +0 -1
- package/dist/assets/StudentLessonView-DZ0i9-tX.js +0 -1
- package/dist/assets/StudentPreviewModal-CfsB1dPY.js +0 -1
- package/dist/assets/StudentView-D7GtUiYR.js +0 -2
- package/dist/assets/SystemResourceLibraryModal-Ilnthwpw.js +0 -1
- package/dist/assets/TeacherView-DjnjsQ_3.js +0 -2
- package/dist/assets/index-D8x6bUeG.js +0 -150
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as c,j as e,R as Xe}from"./vendor-react-0Lg0vA-4.js";import{ae as X,O as Ee,ab as Ye,C as Ze,ai as et,F as we,au as tt,U as st,ap as rt,b as at,D as Me,av as it,ao as Ae,ag as Pe,S as De,a3 as nt,m as lt,n as ot,o as dt,aw as ct,P as Te,_ as xt,i as Ne,k as Ce,ad as mt,N as ht,y as pt,af as ft,s as ut,I as gt}from"./vendor-icons-_c3xpwjZ.js";import{L as bt}from"./LazyWhiteboard-B6rDWBFb.js";import{l as jt,r as Nt}from"./index-D8x6bUeG.js";import"./vendor-pdf-CVyNPGVr.js";import"./vendor-utils-4FcTwKPj.js";import"./vendor-motion-DjY2czvL.js";import"./vendor-charts-B7ViBL9w.js";function wt({lessonId:d,lang:L,addToast:T}){const[oe,N]=c.useState(!1),[Y,s]=c.useState(!1),[w,M]=c.useState([]),[A,f]=c.useState(60),[U,S]=c.useState(40),[$,_]=c.useState({}),[R,Z]=c.useState({}),[y,V]=c.useState({}),[q,I]=c.useState({}),[C,G]=c.useState({}),[g,O]=c.useState({}),o=L==="zh",F=async(a=!1)=>{a?s(!0):N(!0);try{const h=await(await fetch(`/api/lessons/${d}/eval-grades`)).json();if(Array.isArray(h)){M(h);const u={},v={},b={},j={};h.forEach(n=>{n.grade?(u[n.id]=n.grade.teacher_score,v[n.id]=n.grade.teacher_comment,b[n.id]=Math.round(n.grade.teacher_weight*100),j[n.id]=Math.round(n.grade.peer_weight*100)):(u[n.id]=$[n.id]!==void 0?$[n.id]:80,v[n.id]=R[n.id]!==void 0?R[n.id]:"",b[n.id]=y[n.id]!==void 0?y[n.id]:A,j[n.id]=q[n.id]!==void 0?q[n.id]:U)}),_(n=>({...u,...n})),Z(n=>({...v,...n})),V(n=>({...b,...n})),I(n=>({...j,...n}))}else throw new Error("Invalid submissions data format")}catch(m){console.error("Error fetching submissions grades:",m),T(o?"数据加载失败":"Failed to Load Data",o?"请检查网络连接或刷新页面。":"Please check your connection and try again.","warning")}finally{N(!1),s(!1)}};c.useEffect(()=>{d&&F()},[d]);const ee=a=>{f(a),S(100-a),V(m=>{const h={...m};return w.forEach(u=>{(!u.grade||u.grade.status!=="confirmed")&&(h[u.id]=a)}),h}),I(m=>{const h={...m};return w.forEach(u=>{(!u.grade||u.grade.status!=="confirmed")&&(h[u.id]=100-a)}),h})},te=(a,m)=>{V(h=>({...h,[a]:m})),I(h=>({...h,[a]:100-m}))},Q=async(a,m)=>{const h=$[a],u=R[a]||"",v=(y[a]??A)/100,b=(q[a]??U)/100;if(h===void 0||isNaN(h)||h<0||h>100){T(o?"评分无效":"Invalid Score",o?"教师评分必须在 0 到 100 之间!":"Teacher score must be between 0 and 100!","warning");return}if(m==="confirmed"){const j=o?"确认同步后,最终得分将直接同步写入宿主学期成绩库,此后该学生的作业成绩将锁定不可修改。是否确认?":"Once confirmed, the final score will be synced to the host semester reports and locked. Proceed?";if(!window.confirm(j))return}O(j=>({...j,[a]:m}));try{const n=await(await fetch("/api/commands",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commandType:"assignment.grade",payload:{submissionId:a,teacherScore:Number(h),teacherComment:u,teacherWeight:v,peerWeight:b,status:m}})})).json();if(n.success)T(m==="confirmed"?o?"平时成绩同步成功":"Semester Grade Synced":o?"平时成绩草稿已保存":"Grade Draft Saved",m==="confirmed"?o?`已将平时成绩 ${n.result.calculatedFinalScore} 分同步至学期报告!`:`Successfully synced grade ${n.result.calculatedFinalScore}!`:o?"成功保存了教师打分与评语草稿。":"Successfully saved score and comment draft.","success"),F(!0);else throw new Error(n.error||"Failed to submit grade")}catch(j){T(o?"操作失败":"Operation Failed",j.message,"warning")}finally{O(j=>({...j,[a]:null}))}},K=a=>{G(m=>({...m,[a]:!m[a]}))};return oe?e.jsxs("div",{className:"flex-grow flex flex-col items-center justify-center py-12 text-gray-500",children:[e.jsx(X,{className:"animate-spin text-indigo-500 mb-2",size:32}),e.jsx("p",{className:"text-xs",children:o?"正在读取学生作业与成绩状态...":"Loading student submissions and grades..."})]}):e.jsxs("div",{className:"flex-1 flex flex-col min-h-0 w-full relative rounded-xl overflow-hidden border border-slate-200 shadow-md bg-white p-5 text-left",children:[e.jsxs("div",{className:"flex justify-between items-center pb-4 border-b border-slate-100 mb-4 gap-3 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("h3",{className:"text-sm font-bold text-slate-800 flex items-center gap-1.5 select-none",children:[e.jsx(Ee,{size:16,className:"text-indigo-655"}),o?"学生作业成绩评定与折算系统":"Student Assignment Grading & Sync"]}),e.jsxs("span",{className:"text-[9px] bg-indigo-50 text-indigo-750 px-2 py-0.5 rounded-full border border-indigo-100 font-bold",children:[w.length," ",o?"个提交":"submissions"]})]}),e.jsx("button",{onClick:()=>F(!0),disabled:Y,className:"p-1.5 bg-white hover:bg-slate-55 border border-slate-200 rounded-lg text-slate-600 transition-colors flex items-center justify-center cursor-pointer shadow-4xs",title:o?"刷新数据":"Refresh",children:e.jsx(X,{size:12,className:Y?"animate-spin":""})})]}),e.jsxs("div",{className:"bg-slate-50 border border-slate-200 rounded-xl p-4 mb-5 shrink-0 flex flex-col md:flex-row md:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx(Ye,{className:"text-indigo-500 shrink-0 mt-0.5",size:16}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-bold text-slate-700",children:o?"全局默认折算权重设置":"Default Grading Weights Configuration"}),e.jsx("p",{className:"text-[10px] text-slate-400 mt-0.5 font-medium",children:o?"调整权重分配,所有尚未锁定成绩的学生将自动应用此默认权重比例。":"Setting global default weights. Changes will automatically apply to non-confirmed grades."})]})]}),e.jsxs("div",{className:"flex items-center gap-4 shrink-0 bg-white px-3.5 py-2 rounded-lg border border-slate-200 shadow-3xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[11px] font-bold text-slate-500",children:o?"教师评分:":"Teacher:"}),e.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:A,onChange:a=>ee(Number(a.target.value)),className:"w-20 accent-indigo-650 cursor-pointer"}),e.jsxs("span",{className:"text-xs font-bold text-indigo-700 w-8 text-right",children:[A,"%"]})]}),e.jsx("div",{className:"h-4 w-[1px] bg-slate-200"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[11px] font-bold text-slate-500",children:o?"学生互评:":"Peer Review:"}),e.jsxs("span",{className:"text-xs font-bold text-slate-700 w-8",children:[U,"%"]})]})]})]}),e.jsx("div",{className:"flex-grow flex-1 overflow-y-auto space-y-4 pr-1 scrollbar-thin",children:w.length===0?e.jsxs("div",{className:"h-full flex flex-col items-center justify-center py-12 text-slate-400 gap-2",children:[e.jsx(Ze,{size:32,className:"text-slate-350"}),e.jsx("p",{className:"text-xs",children:o?"本节课目前没有任何学生提交作业。":"No students have submitted assignments yet for this lesson."})]}):w.map(a=>{const m=$[a.id]!==void 0?$[a.id]:80,h=R[a.id]||"",u=y[a.id]??A,v=q[a.id]??U,b=a.grade?.status==="confirmed",j=Math.round(m*(u/100)+a.peerAverageScore*(v/100));return e.jsxs("div",{className:`bg-white border rounded-xl shadow-3xs overflow-hidden transition-all ${b?"border-emerald-200 bg-emerald-50/5":"border-slate-200"}`,children:[e.jsxs("div",{className:"px-4 py-3 bg-slate-50/50 border-b border-slate-100 flex flex-col md:flex-row md:items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-indigo-50 border border-indigo-100 flex items-center justify-center text-indigo-700 font-bold text-xs select-none",children:a.studentName?.charAt(0)||"S"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-bold text-slate-800",children:a.studentName}),e.jsxs("div",{className:"text-[9px] text-slate-400 font-mono mt-0.5 flex items-center gap-1.5",children:[e.jsxs("span",{children:["V",a.version]}),e.jsx("span",{children:"•"}),e.jsx("span",{children:new Date(a.updatedAt).toLocaleString()})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[b?e.jsxs("span",{className:"bg-emerald-55 text-emerald-700 text-[10px] font-black px-2.5 py-1 rounded-full border border-emerald-150 flex items-center gap-1 shadow-3xs select-none",children:[e.jsx(et,{size:12}),o?"成绩已同步":"Synced to Reports"]}):e.jsx("span",{className:"bg-amber-50 text-amber-805 text-[10px] font-bold px-2 py-0.5 rounded-full border border-amber-200/60 select-none",children:a.grade?o?"草稿状态":"Draft":o?"未评定":"Ungraded"}),e.jsxs("a",{href:a.filePath,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-indigo-600 hover:text-indigo-850 font-medium hover:underline flex items-center gap-1 bg-white border border-slate-200 px-2 py-1 rounded-lg shadow-4xs",title:a.filePath,children:[e.jsx(we,{size:11}),o?"查看作业":"View File",e.jsx(tt,{size:8})]})]})]}),e.jsxs("div",{className:"p-4 grid grid-cols-1 lg:grid-cols-12 gap-5",children:[e.jsxs("div",{className:"lg:col-span-5 flex flex-col gap-2.5 border-r border-slate-100 pr-0 lg:pr-5 text-left",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("span",{className:"text-[11px] font-bold text-slate-650 flex items-center gap-1 select-none",children:[e.jsx(st,{size:13,className:"text-slate-400"}),o?"学生互评详情":"Peer Review Details"]}),e.jsxs("span",{className:"text-[10px] font-bold text-slate-500 bg-slate-100 px-2 py-0.5 rounded-md",children:[o?"互评人数:":"Reviews:"," ",a.peerReviews.length]})]}),e.jsxs("div",{className:"bg-slate-50 border border-slate-100 rounded-xl p-3 flex items-center gap-3",children:[e.jsxs("div",{className:"bg-white border border-slate-200 w-12 h-12 rounded-lg flex flex-col items-center justify-center shrink-0 shadow-3xs",children:[e.jsx("span",{className:"text-[9px] text-slate-405 select-none font-bold",children:o?"均分":"Avg"}),e.jsx("span",{className:"text-sm font-extrabold text-slate-700 leading-none mt-0.5",children:a.peerAverageScore})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-[10px] text-slate-450 leading-normal font-medium",children:a.peerReviews.length>0?o?"根据同学互评分数得出的平均值。":"Average score computed from classmate evaluations.":o?"暂无同学对此作业给出评分。":"No classmate peer reviews received yet."}),a.peerReviews.length>0&&e.jsx("button",{onClick:()=>K(a.id),className:"text-[10px] text-indigo-650 hover:text-indigo-800 font-bold mt-1.5 flex items-center gap-0.5 cursor-pointer outline-none",children:C[a.id]?e.jsxs(e.Fragment,{children:[o?"收起互评详情":"Hide Details"," ",e.jsx(rt,{size:12})]}):e.jsxs(e.Fragment,{children:[o?"展开互评详情":"Show Details"," ",e.jsx(at,{size:12})]})})]})]}),C[a.id]&&a.peerReviews.length>0&&e.jsx("div",{className:"mt-2 space-y-2 border-t border-slate-100 pt-2.5 max-h-40 overflow-y-auto scrollbar-thin",children:a.peerReviews.map(n=>e.jsxs("div",{className:"bg-white border border-slate-200 rounded-lg p-2.5 text-xs text-left shadow-4xs",children:[e.jsxs("div",{className:"flex justify-between items-center font-bold text-slate-700",children:[e.jsxs("span",{className:"flex items-center gap-1 font-semibold text-slate-655",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-slate-300"}),n.reviewer_name]}),e.jsxs("span",{className:"text-indigo-650 bg-indigo-50 border border-indigo-100 rounded px-1.5 py-0.5 text-[10px]",children:[n.score," ",o?"分":"pts"]})]}),n.comment&&e.jsxs("p",{className:"text-[10px] text-slate-550 mt-1 italic pl-2.5 border-l-2 border-slate-100 font-medium",children:['"',n.comment,'"']})]},n.id))})]}),e.jsxs("div",{className:"lg:col-span-7 flex flex-col gap-3 justify-between",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-bold text-slate-650 mb-1 select-none",children:o?"教师平时分评分 (0-100)":"Teacher Score (0-100)"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{id:`teacher_score_input_${a.id}`,type:"number",min:"0",max:"100",disabled:b,value:m,onChange:n=>_(J=>({...J,[a.id]:Math.min(100,Math.max(0,Number(n.target.value)))})),className:"bg-white border border-slate-250 rounded-lg text-xs font-bold text-slate-700 px-3 py-1.5 focus:ring-1 focus:ring-indigo-500 outline-none w-20 shadow-4xs disabled:opacity-50 disabled:bg-slate-50"}),e.jsx("input",{type:"range",min:"0",max:"100",disabled:b,value:m,onChange:n=>_(J=>({...J,[a.id]:Number(n.target.value)})),className:"flex-1 accent-indigo-650 disabled:opacity-40 cursor-pointer"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx("label",{className:"block text-[10px] font-bold text-slate-600 select-none",children:o?"打分占比 (教师权重)":"Teacher Score Weight"}),e.jsx("span",{className:"text-[10px] font-bold text-slate-400",children:o?`学生互评: ${v}%`:`Peer: ${v}%`})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{id:`teacher_weight_input_${a.id}`,type:"range",min:"0",max:"100",step:"5",disabled:b,value:u,onChange:n=>te(a.id,Number(n.target.value)),className:"flex-1 accent-indigo-650 disabled:opacity-40 cursor-pointer"}),e.jsxs("span",{className:"text-xs font-extrabold text-indigo-750 w-9 text-right",children:[u,"%"]})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-bold text-slate-655 mb-1 select-none",children:o?"教师评价评语":"Teacher Comments & Feedback"}),e.jsx("textarea",{id:`teacher_comment_input_${a.id}`,disabled:b,value:h,placeholder:o?"在此输入对学生作业作品的改进指导意见及评语。":"Enter guiding feedback for this student.",onChange:n=>Z(J=>({...J,[a.id]:n.target.value})),rows:2,className:"w-full bg-white border border-slate-250 rounded-lg text-xs p-2 focus:ring-1 focus:ring-indigo-500 outline-none shadow-4xs disabled:opacity-50 disabled:bg-slate-50 resize-none font-medium text-slate-700"})]}),e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4 pt-2 border-t border-slate-100 mt-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`p-1.5 rounded-lg border flex items-center justify-center shrink-0 ${b?"bg-emerald-50 text-emerald-600 border-emerald-100":"bg-indigo-50 text-indigo-700 border-indigo-100"}`,children:e.jsx(Me,{size:14})}),e.jsxs("div",{className:"text-[10px] text-slate-500 font-medium",children:[e.jsxs("div",{children:[o?"平时总分计算公式":"Calculated Final Grade",":"]}),e.jsxs("div",{className:"font-bold text-slate-700 mt-0.5 animate-formula",children:[u,"% × ",e.jsx("span",{className:"text-indigo-650 font-bold",children:m}),a.peerReviews.length>0&&` + ${v}% × ${a.peerAverageScore}`," = ",e.jsx("span",{className:b?"text-emerald-700 font-black text-xs":"text-indigo-700 font-black text-xs",children:b&&a.grade?.calculated_final_score||j}),o?"分":" pts"]})]})]}),!b&&e.jsxs("div",{className:"flex gap-2 justify-end shrink-0",children:[e.jsxs("button",{id:`teacher_draft_btn_${a.id}`,type:"button",disabled:!!g[a.id],onClick:()=>Q(a.id,"draft"),className:"px-3 py-1.5 bg-white border border-slate-350 rounded-lg text-xs font-bold text-slate-700 hover:bg-slate-55 flex items-center gap-1.5 shadow-4xs cursor-pointer select-none disabled:opacity-50",children:[e.jsx(it,{size:12}),g[a.id]==="draft"?o?"保存中...":"Saving...":o?"暂存草稿":"Save Draft"]}),e.jsxs("button",{id:`teacher_confirm_btn_${a.id}`,type:"button",disabled:!!g[a.id],onClick:()=>Q(a.id,"confirmed"),className:"px-3.5 py-1.5 bg-indigo-600 border border-indigo-700 rounded-lg text-xs font-bold text-white hover:bg-indigo-700 flex items-center gap-1.5 shadow-3xs cursor-pointer select-none disabled:opacity-50",children:[e.jsx(Ae,{size:12}),g[a.id]==="confirmed"?o?"同步中...":"Syncing...":o?"确认并同步":"Confirm & Sync"]})]})]})]})]})]},a.id)})})]})}function yt({name:d,...L}){const T=gt[d];return T?Xe.createElement(T,L):e.jsx(ut,{...L})}function Tt({selectedLesson:d,setSelectedLesson:L,lessons:T,classes:oe,students:N,plugins:Y,lang:s,timelineSegments:w,activeSegmentId:M,setActiveSegmentId:A,liveClassSelectedClassId:f,setLiveClassSelectedClassId:U,liveClassIsActive:S,setLiveClassIsActive:$,liveClassTimeRemaining:_,setLiveClassTimeRemaining:R,liveClassFeed:Z,setLiveClassFeed:y,liveClassAcknowledgedMap:V,setLiveClassAcknowledgedMap:q,elements:I,fetchElements:C,fetchStudents:G,addToast:g,onlineStudentIds:O,activeStudentLessons:o,liveClassStudentProgress:F,onPingStudent:ee,onOpenCoursewareHub:te,activeRole:Q,setActiveRole:K}){const[a,m]=c.useState(!1),[h,u]=c.useState(!1),[v,b]=c.useState(null),[j,n]=c.useState(!1),[J,ye]=c.useState(null),[Re,ve]=c.useState([]),de=c.useRef(null),se=c.useRef({lesson:null,classId:null}),[B,ce]=c.useState("whiteboard"),[re,Oe]=c.useState([]),[xe,ze]=c.useState(!1),[E,me]=c.useState(null),[he,ae]=c.useState(null),[We,ke]=c.useState(!1),[ie,Fe]=c.useState("all"),[pe,Je]=c.useState(""),ne=async()=>{ze(!0);try{const t=await fetch("/api/courseware/attempts");if(t.ok){const r=await t.json();Oe(r)}}catch(t){console.error("Failed to fetch attempts",t)}finally{ze(!1)}};c.useEffect(()=>{B==="submissions"&&ne()},[B]),c.useEffect(()=>{const t=jt();return t.on("courseware-attempt-updated",()=>{ne()}),()=>{t.disconnect()}},[]);const Be=async t=>{if(!d||!f){g(s==="zh"?"⚠️ 无法操作":"⚠️ Action Prevented",s==="zh"?"请先在顶部栏选择要绑定的课节和班级。":"Please select lesson and class first.","warning");return}try{const r=await fetch(`/api/courseware/attempts/${t}/promote`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lessonId:d,classId:f})});if(r.ok){const l=await r.json();g(s==="zh"?"✓ 学习数据已保存":"✓ Data Recorded",s==="zh"?`成功将该数据存入数据库!分数: ${l.score},已同步更新至学生学习进度。`:`Successfully recorded submission! Score: ${l.score}.`,"success"),ne(),G&&G()}else{const l=await r.json();throw new Error(l.error||"Server error")}}catch(r){g(s==="zh"?"❌ 保存失败":"❌ Save Failed",r.message||"Error occurred while saving.","warning")}},Le=async t=>{me(t),ke(!0),ae(null);try{const r=await fetch(`/api/courseware/attempts/${t.attemptId}/raw`);if(r.ok){const l=await r.json();ae(l)}else ae({error:"Failed to load raw data"})}catch(r){ae({error:r.message||"Error loading data"})}finally{ke(!1)}},le=!!(f&&N.filter(t=>t.locked_lesson_id===d).length>0),Ue=Y.filter(t=>t.status==="active"),fe=Array.from(new Map(Ue.flatMap(t=>{try{const r=typeof t.manifest=="string"?JSON.parse(t.manifest):t.manifest,l=r.classroomTools||[],i=r.contributes?.["classroom.tool"]||[];return[...l,...i].map(x=>({...x,pluginId:t.id,manifestId:r.id}))}catch{return[]}}).map(t=>[t.id,t])).values());c.useEffect(()=>(S&&_>0?de.current=setInterval(()=>{R(_-1)},1e3):_===0&&S&&(g(s==="zh"?"⏰ 环节时间到":"⏰ Phase Timer Ended",s==="zh"?"当前教学环节设定的时间已耗尽,建议转入下一环节。":"The current segment duration has elapsed. Transition recommended.","warning"),$(!1)),()=>{de.current&&clearInterval(de.current)}),[S,_]),c.useEffect(()=>{if(!d||!f){se.current={lesson:null,classId:null};return}(se.current.lesson!==d||se.current.classId!==f)&&(se.current={lesson:d,classId:f},Se(!0))},[d,f]);const Ge=t=>{const r=parseInt(t.replace(/[^0-9]/g,""));return isNaN(r)?300:t.includes("s")?r:r*60},Ve=t=>{A(t.id);const r=Ge(t.duration);R(r),$(!0),y(l=>[{id:Math.random().toString(),time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}),type:"info",message:`教学环节切换并广播:进入 [${t.title}] 环节,设定时间 ${t.duration}。`},...l]),g(s==="zh"?"📢 环节已广播":"📢 Phase Synchronized",s==="zh"?`已同步广播 [${t.title}] 环节至所有在线学生端。`:`Broadcasted phase [${t.title}] to all active students.`,"success")},Se=async t=>{if(!f||!d){g(s==="zh"?"⚠️ 无法操作":"⚠️ Action Prevented",s==="zh"?"请先选择需要授课的课节及班级。":"Please select a lesson and class first.","warning");return}m(!0);try{const r=t?`/api/classes/${f}/lock_lesson`:`/api/classes/${f}/unlock_lesson`;(await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:t?JSON.stringify({lessonId:d}):void 0})).ok&&(await G(),y(i=>[{id:Math.random().toString(),time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}),type:t?"warning":"info",message:t?"已对全班学生强制锁定专注模式(限定当前课程)。":"已解锁全班学生专注模式限制。"},...i]),g(s==="zh"?"🔒 锁状态更新":"🔒 Class Status Updated",t?"全班专注锁定成功,学生将无法切回主页。":"全班屏幕解锁成功,学生已恢复自由浏览。","success"))}catch(r){console.error("Failed to toggle class focus lock",r)}finally{m(!1)}},qe=async(t,r)=>{const l=r?null:d;try{if((await fetch(`/api/students/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({locked_lesson_id:l})})).ok){await G();const x=N.find(p=>p.id===t)?.name||t;y(p=>[{id:Math.random().toString(),time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}),type:l?"warning":"info",message:l?`已针对学生 [${x}] 单独开启专注限制锁定。`:`已解锁学生 [${x}] 的专注限制。`},...p])}}catch(i){console.error("Failed to toggle student lock",i)}},Ie=async t=>{if(!d){g(s==="zh"?"⚠️ 请选择课节":"⚠️ Select Lesson",s==="zh"?"请先选择要授课的课节。":"Please select a lesson first.","warning");return}if(JSON.stringify(t.payload||"").includes("$classId")&&!f){g(s==="zh"?"⚠️ 请选择班级":"⚠️ Select Class",s==="zh"?"该工具需要指定上课班级,请在顶部先选择班级。":"Please select class first for this tool.","warning");return}y(l=>[{id:Math.random().toString(),time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}),type:"info",message:`正在运行插件工具 [${t.name}]...`},...l]);try{const l=JSON.parse(JSON.stringify(t.payload||{}).replace(/\$classId/g,f||"").replace(/\$lessonId/g,d||""));if(l.type==="plugin"&&l.data)try{const z=JSON.parse(l.data);!z.segmentId&&M&&(z.segmentId=M,l.data=JSON.stringify(z))}catch{}const x=!/^(whiteboard|lesson|assignment|class|student|vfs|plugin|ai|agent|system)\./.test(t.commandType)&&t.manifestId?Nt(t.commandType,t.manifestId):t.commandType,p=await fetch("/api/commands",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commandType:x,payload:l})});if(p.ok)te&&(t.id==="courseware-hub-teacher"||t.commandType==="courseware.open_panel")&&te(),y(z=>[{id:Math.random().toString(),time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}),type:"success",message:`插件工具 [${t.name}] 执行完毕,数据成功下发。`},...z]),g(s==="zh"?"✓ 工具下发成功":"✓ Tool Synchronized",s==="zh"?`工具 [${t.name}] 已成功在当前白板上部署并投射。`:`Tool [${t.name}] synchronized successfully.`,"success"),await C(d);else{const z=await p.json();throw new Error(z.error||"Server error")}}catch(l){y(i=>[{id:Math.random().toString(),time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}),type:"error",message:`运行插件工具 [${t.name}] 失败: ${l.message}`},...i]),g(s==="zh"?"❌ 运行失败":"❌ Tool Failed",l.message||"Execution error","warning")}},Qe=()=>{if(N.length===0||j)return;const t=N.filter(p=>O.includes(p.id)&&o[p.id]===d);if(t.length===0){g(s==="zh"?"⚠️ 无法抽问":"⚠️ Cannot Draw",s==="zh"?"当前课堂中没有已进入的活跃学生。":"No students have entered the classroom yet.","warning");return}n(!0);let r=0;const l=18;let i=75;const x=()=>{const p=Math.floor(Math.random()*t.length),z=t[p];if(ye(z.id),r++,r<l)r>l-5&&(i+=45),setTimeout(x,i);else{const k=t[p];ye(null),n(!1),ve(P=>P.includes(k.id)?P:[...P,k.id]),y(P=>[{id:Math.random().toString(),time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}),type:"success",message:`🎯 随机提问抽选:学生 [${k.name}] 被抽中回答问题!`},...P]),g(s==="zh"?"🎯 随机提问抽选":"🎯 Student Drawn",s==="zh"?`恭喜学生 [${k.name}] 被抽中回答问题!`:`Student [${k.name}] was selected to answer!`,"success"),setTimeout(()=>{ve(P=>P.filter(ue=>ue!==k.id))},8e3)}};setTimeout(x,i)},Ke=t=>{const r=Math.floor(t/60),l=t%60;return`${r.toString().padStart(2,"0")}:${l.toString().padStart(2,"0")}`};return e.jsxs("div",{className:"flex-grow flex-1 flex flex-col min-h-0 bg-white border border-slate-200 rounded-2xl shadow-xl text-slate-800 overflow-hidden font-sans",children:[e.jsxs("div",{className:"bg-slate-50 p-4 border-b border-slate-200 flex flex-wrap items-center justify-between gap-4 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3 select-none",children:[e.jsxs("div",{className:"relative flex items-center justify-center",children:[e.jsx("span",{className:`w-3 h-3 rounded-full ${S?"bg-emerald-500 animate-ping":"bg-rose-500"} absolute`}),e.jsx("span",{className:`w-2 h-2 rounded-full ${S?"bg-emerald-500":"bg-rose-500"} relative`})]}),e.jsx("h2",{className:"text-sm font-extrabold tracking-tight text-slate-800 flex items-center gap-2",children:s==="zh"?"🔴 智能授课工作流控制中心":"🔴 Active Lesson control center"})]}),e.jsxs("div",{className:"flex items-center gap-2.5 flex-wrap",children:[e.jsx("div",{children:e.jsxs("select",{value:d||"",onChange:t=>{const r=t.target.value===""?null:t.target.value;L(r),r&&C(r)},className:"bg-white border border-slate-200 rounded-lg text-xs font-semibold px-3 py-1.5 focus:ring-1 focus:ring-indigo-500 text-slate-700 outline-none cursor-pointer hover:bg-slate-100 transition-colors",children:[e.jsx("option",{value:"",children:s==="zh"?"-- 选择授课课节 --":"-- Select Lesson --"}),T.map(t=>e.jsx("option",{value:t.id,children:t.title},t.id))]})}),e.jsx("div",{children:e.jsxs("select",{value:f||"",onChange:t=>U(t.target.value===""?null:t.target.value),className:"bg-white border border-slate-200 rounded-lg text-xs font-semibold px-3 py-1.5 focus:ring-1 focus:ring-indigo-500 text-slate-700 outline-none cursor-pointer hover:bg-slate-100 transition-colors",children:[e.jsx("option",{value:"",children:s==="zh"?"-- 选择授课班级 --":"-- Select Class --"}),oe.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[K&&e.jsxs("div",{className:"bg-slate-200/80 p-0.5 rounded-lg flex items-center gap-0.5 border border-slate-300/60 shadow-3xs",children:[e.jsxs("button",{onClick:()=>K("teacher"),className:`px-2.5 py-1 text-[11px] font-bold rounded transition-all cursor-pointer ${Q==="teacher"?"bg-white text-indigo-700 shadow-2xs font-extrabold":"text-slate-600 hover:text-slate-900"}`,children:["👨🏫 ",s==="zh"?"教师模式":"Teacher Mode"]}),e.jsxs("button",{onClick:()=>K("student"),className:`px-2.5 py-1 text-[11px] font-bold rounded transition-all cursor-pointer ${Q==="student"?"bg-pink-600 text-white shadow-2xs font-extrabold":"text-slate-600 hover:text-slate-900"}`,children:["🎓 ",s==="zh"?"学生模式":"Student Mode"]})]}),e.jsxs("button",{onClick:()=>Se(!le),disabled:a||!d||!f,className:`px-3 py-1.5 rounded-lg font-bold text-[11px] uppercase tracking-wider flex items-center gap-1.5 shadow-sm transition-all active:scale-95 disabled:opacity-50 cursor-pointer ${le?"bg-rose-500 hover:bg-rose-600 text-white":"bg-indigo-600 hover:bg-indigo-700 text-white"}`,children:[le?e.jsx(Pe,{size:12}):e.jsx(De,{size:12}),e.jsx("span",{children:le?s==="zh"?"一键解锁全班":"Unlock Entire Class":s==="zh"?"全班专注锁定":"Lock Class Screen"})]})]})]})]}),e.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0 bg-slate-50/30",children:[!h&&e.jsxs("div",{className:"w-[220px] shrink-0 bg-white p-3.5 border-r border-slate-200/80 flex flex-col gap-4 overflow-y-auto",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2 select-none",children:[e.jsx("h3",{className:"text-[10px] font-black uppercase text-slate-400 tracking-wider",children:s==="zh"?"教学步骤与时间管理":"Lesson Segments & Phases"}),e.jsx("button",{onClick:()=>u(!0),className:"p-1 rounded bg-slate-50 hover:bg-slate-100 border border-slate-200 text-slate-500 hover:text-slate-700 transition-colors cursor-pointer",title:s==="zh"?"折叠导航栏":"Collapse Sidebar",children:e.jsx(nt,{size:10})})]}),e.jsxs("div",{className:"bg-slate-50 border border-slate-150 rounded-xl p-3 flex flex-col items-center justify-center gap-1 shadow-sm",children:[e.jsxs("span",{className:"text-[9.5px] uppercase tracking-widest text-slate-505 font-semibold flex items-center gap-1",children:[e.jsx(lt,{size:11,className:S?"animate-spin":"",style:{animationDuration:"4s"}}),s==="zh"?"当前步骤剩余时间":"Phase Remaining"]}),e.jsx("div",{className:`text-2xl font-black font-mono tracking-widest ${S?"text-indigo-650":"text-slate-450"}`,children:Ke(_)}),e.jsxs("div",{className:"flex gap-1.5 w-full mt-2 shrink-0",children:[e.jsxs("button",{onClick:()=>$(!S),disabled:_<=0,className:"flex-1 py-1 rounded bg-slate-100 hover:bg-slate-205 text-[10px] font-bold text-slate-700 transition-all disabled:opacity-40 flex items-center justify-center gap-1 border border-slate-200",children:[S?e.jsx(ot,{size:10}):e.jsx(dt,{size:10}),e.jsx("span",{children:S?s==="zh"?"暂停":"Pause":s==="zh"?"开始":"Start"})]}),e.jsx("button",{onClick:()=>{$(!1),R(0)},className:"py-1 px-2.5 rounded bg-slate-100 hover:bg-rose-50 text-[10px] font-bold text-rose-600 hover:text-rose-700 transition-all flex items-center justify-center border border-slate-200",title:"重置",children:e.jsx(ct,{size:10})})]})]})]}),e.jsxs("div",{className:"flex-1 flex flex-col gap-2 min-h-0",children:[e.jsx("h4",{className:"text-[10px] font-black uppercase text-slate-400 tracking-wider select-none",children:s==="zh"?"教学环节进度表":"Timeline Segments"}),d?e.jsx("div",{className:"space-y-2 overflow-y-auto flex-1 pr-1.5 scrollbar-thin",children:w.map((t,r)=>{const l=M===t.id;return e.jsxs("div",{className:`p-2.5 rounded-xl border transition-all flex flex-col gap-1.5 ${l?"bg-indigo-50/50 border-indigo-250 shadow-sm":"bg-white border-slate-200 hover:bg-slate-50 hover:border-slate-300"}`,children:[e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsxs("span",{className:`text-[11.5px] font-bold ${l?"text-indigo-900":"text-slate-800"}`,children:[r+1,". ",t.title]}),e.jsx("span",{className:"text-[9px] font-mono px-1 py-0.5 rounded bg-slate-100 text-slate-550 border border-slate-200/50",children:t.duration})]}),e.jsx("div",{className:`text-[9.5px] line-clamp-2 leading-relaxed ${l?"text-indigo-750":"text-slate-450"}`,children:t.notes||"无步骤描述备注信息。"}),e.jsxs("button",{onClick:()=>Ve(t),className:`w-full py-1 rounded text-[10px] font-bold transition-all cursor-pointer flex items-center justify-center gap-1 ${l?"bg-indigo-600 text-white hover:bg-indigo-700 shadow-sm":"bg-slate-100 text-slate-600 hover:bg-slate-200 border border-slate-200/60"}`,children:[e.jsx(Te,{size:10}),e.jsx("span",{children:l?s==="zh"?"同步演示中":"Broadcasting":s==="zh"?"广播此环节":"Broadcast Step"})]})]},t.id)})}):e.jsx("div",{className:"text-xs text-slate-400 italic py-4 text-center",children:s==="zh"?"请选择一个课节加载流程表":"Select a lesson to view schedule."})]})]}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-slate-100 p-3 gap-3 relative",children:d?e.jsxs("div",{className:"w-full h-full relative flex flex-col min-h-0",children:[e.jsxs("div",{className:"flex justify-between items-center px-1.5 py-1 select-none text-slate-500 text-[10px] uppercase font-extrabold tracking-wide shrink-0 mb-1",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[h&&e.jsxs("button",{onClick:()=>u(!1),className:"p-1 rounded-lg bg-white hover:bg-slate-100 border border-slate-205 text-indigo-650 hover:text-indigo-700 transition-colors cursor-pointer mr-1.5 flex items-center gap-1 shadow-sm",title:s==="zh"?"展开环节大纲":"Expand Sidebar",children:[e.jsx(xt,{size:10}),e.jsx("span",{className:"text-[9px] font-bold tracking-wider",children:s==="zh"?"展开":"Expand"})]}),e.jsxs("div",{className:"bg-slate-200/60 p-0.5 rounded-lg flex items-center gap-1",children:[e.jsx("button",{onClick:()=>ce("whiteboard"),className:`px-3 py-1 rounded-md text-[10px] font-bold transition-all cursor-pointer ${B==="whiteboard"?"bg-white text-indigo-700 shadow-sm":"text-slate-500 hover:text-slate-700"}`,children:s==="zh"?"💻 演示白板":"💻 Whiteboard"}),e.jsx("button",{onClick:()=>ce("submissions"),className:`px-3 py-1 rounded-md text-[10px] font-bold transition-all cursor-pointer ${B==="submissions"?"bg-white text-indigo-700 shadow-sm":"text-slate-500 hover:text-slate-700"}`,children:s==="zh"?"📊 学生提交数据":"📊 Student Submissions"}),e.jsx("button",{id:"teacher_assignment_eval_tab_btn",onClick:()=>ce("assignment"),className:`px-3 py-1 rounded-md text-[10px] font-bold transition-all cursor-pointer ${B==="assignment"?"bg-white text-indigo-700 shadow-sm":"text-slate-500 hover:text-slate-700"}`,children:s==="zh"?"🎓 作业成绩评定":"🎓 Assignment Grades"})]})]}),e.jsxs("span",{className:"text-indigo-655 font-mono tracking-widest animate-pulse flex items-center gap-1",children:[e.jsx(Ne,{size:10})," Live Broadcaster Connected"]})]}),B==="whiteboard"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex-grow flex-1 min-h-0 w-full relative rounded-xl overflow-hidden border border-slate-200 shadow-md bg-white flex flex-col",children:e.jsx(bt,{lessonId:d,userRole:"teacher",isEditMode:!1,elements:I,activeSegmentId:M,onSegmentSync:t=>A(t),onElementAdd:async(t,r)=>{await fetch(`/api/lessons/${d}/whiteboard`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:t,data:r})}),C(d)},onElementUpdate:async(t,r)=>{await fetch(`/api/lessons/${d}/whiteboard/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:r})}),C(d)},onElementDelete:async t=>{await fetch(`/api/lessons/${d}/whiteboard/${t}`,{method:"DELETE"}),C(d)},onRefresh:()=>C(d)})}),e.jsxs("div",{className:"mt-3 bg-white border border-slate-200 rounded-xl p-3 shadow-sm shrink-0 flex flex-col gap-2 relative z-30",children:[e.jsxs("div",{className:"flex items-center justify-between text-[10px] uppercase font-black text-slate-555 tracking-wider select-none",children:[e.jsxs("span",{className:"flex items-center gap-1.5 text-indigo-655",children:[e.jsx(Ce,{size:12,className:"text-indigo-600 animate-pulse"}),e.jsx("span",{children:s==="zh"?"互动工具 (插件扩展)":"Classroom Interactive Tools"})]}),e.jsxs("span",{className:"text-[8.5px] text-slate-400 font-mono",children:["Plugins: ",fe.length," Active"]})]}),fe.length>0?e.jsx("div",{className:"flex gap-2.5 overflow-x-auto py-0.5 pr-2 scrollbar-thin",children:fe.map(t=>e.jsxs("button",{onClick:()=>Ie(t),disabled:!d,className:"p-2 bg-slate-50 hover:bg-slate-105 border border-slate-205 hover:border-indigo-200 rounded-xl text-left transition-all active:scale-[0.98] disabled:opacity-40 flex items-center gap-2.5 w-44 shrink-0 group cursor-pointer",title:t.description,children:[e.jsx("div",{className:"p-1.5 bg-indigo-50 text-indigo-650 group-hover:bg-indigo-100 group-hover:text-indigo-700 rounded-lg border border-indigo-100 shrink-0 transition-colors",children:e.jsx(yt,{name:t.icon,size:14})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-xs font-bold text-slate-700 group-hover:text-slate-900 truncate",children:t.name}),e.jsx("div",{className:"text-[9px] text-slate-400 group-hover:text-slate-555 truncate mt-0.5",children:t.description})]})]},t.id))}):e.jsx("div",{className:"text-center py-2 text-[10px] text-slate-400 italic",children:s==="zh"?"暂无可用的互动工具。请在应用商店启用插件。":"No plugin tools loaded."})]})]}):B==="submissions"?e.jsxs("div",{className:"flex-grow flex-1 min-h-0 w-full relative rounded-xl overflow-hidden border border-slate-200 shadow-md bg-white flex flex-col p-4",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4 gap-3 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-bold text-slate-700",children:s==="zh"?"学生互动提交数据列表":"Student Submissions"}),re.length>0&&e.jsxs("span",{className:"text-[9px] bg-indigo-50 text-indigo-750 px-2 py-0.5 rounded-full border border-indigo-100 font-bold",children:[re.length," ",s==="zh"?"条记录":"records"]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"text",placeholder:s==="zh"?"搜索学生或课件...":"Search student or courseware...",value:pe,onChange:t=>Je(t.target.value),className:"bg-white border border-slate-200 rounded-lg text-xs pl-8 pr-3 py-1.5 focus:ring-1 focus:ring-indigo-500 text-slate-700 outline-none w-44 transition-all"}),e.jsx(mt,{size:12,className:"absolute left-2.5 top-2.5 text-slate-400"})]}),e.jsxs("select",{value:ie,onChange:t=>Fe(t.target.value),className:"bg-white border border-slate-200 rounded-lg text-xs px-3 py-1.5 focus:ring-1 focus:ring-indigo-500 text-slate-700 outline-none cursor-pointer hover:bg-slate-50 transition-colors",children:[e.jsx("option",{value:"all",children:s==="zh"?"全部状态":"All Status"}),e.jsx("option",{value:"submitted",children:s==="zh"?"已提交/完成":"Submitted/Finished"}),e.jsx("option",{value:"started",children:s==="zh"?"进行中":"In Progress"})]}),e.jsx("button",{onClick:ne,disabled:xe,className:"p-1.5 bg-white hover:bg-slate-50 border border-slate-205 rounded-lg text-slate-605 hover:text-slate-800 transition-colors cursor-pointer flex items-center justify-center shadow-sm disabled:opacity-50",title:s==="zh"?"刷新数据":"Refresh",children:e.jsx(X,{size:12,className:xe?"animate-spin":""})})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto border border-slate-100 rounded-xl scrollbar-thin",children:xe?e.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-slate-400 gap-2",children:[e.jsx(X,{size:24,className:"animate-spin text-indigo-600 mb-2"}),e.jsx("span",{className:"text-xs",children:s==="zh"?"正在加载学生提交数据...":"Loading submissions..."})]}):(()=>{const t=f?N.map(i=>i.id):[],l=(f?re.filter(i=>t.includes(i.studentId)):re).filter(i=>{const x=i.studentName?.toLowerCase().includes(pe.toLowerCase())||i.coursewareName?.toLowerCase().includes(pe.toLowerCase()),p=ie==="all"||ie==="submitted"&&(i.status==="submitted"||i.status==="finished")||ie==="started"&&i.status==="started";return x&&p});return l.length===0?e.jsxs("div",{className:"h-full flex flex-col items-center justify-center py-12 text-slate-400 gap-2",children:[e.jsx(we,{size:32,className:"text-slate-300"}),e.jsx("span",{className:"text-xs",children:s==="zh"?"暂无匹配的提交数据。":"No matching submissions found."}),!f&&e.jsx("span",{className:"text-[10px] text-slate-400 italic",children:s==="zh"?"提示:请在顶部选择一个班级进行筛选。":"Tip: Select a class at the top to filter."})]}):e.jsxs("table",{className:"w-full border-collapse text-left text-xs text-slate-700",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-slate-50 border-b border-slate-100 font-bold text-slate-550 select-none",children:[e.jsx("th",{className:"p-3",children:s==="zh"?"学生姓名":"Student Name"}),e.jsx("th",{className:"p-3",children:s==="zh"?"交互课件":"Courseware"}),e.jsx("th",{className:"p-3",children:s==="zh"?"状态":"Status"}),e.jsx("th",{className:"p-3 text-center",children:s==="zh"?"成绩":"Score"}),e.jsx("th",{className:"p-3 text-center",children:s==="zh"?"完成度":"Completion"}),e.jsx("th",{className:"p-3 text-right",children:s==="zh"?"操作":"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-100",children:l.map(i=>{const x=i.status==="finished"||i.status==="submitted",p=i.started_at?new Date(i.started_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"N/A";return e.jsxs("tr",{className:"hover:bg-slate-50/50 transition-colors group",children:[e.jsxs("td",{className:"p-3",children:[e.jsx("div",{className:"font-semibold text-slate-800",children:i.studentName}),e.jsxs("div",{className:"text-[10px] text-slate-400 mt-0.5",children:[s==="zh"?"时间":"Time",": ",p]})]}),e.jsx("td",{className:"p-3 font-medium text-slate-600 max-w-[150px] truncate",title:i.coursewareName,children:i.coursewareName}),e.jsx("td",{className:"p-3",children:e.jsx("span",{className:`px-2 py-0.5 rounded-full border text-[10px] font-bold ${x?"bg-emerald-50 text-emerald-700 border-emerald-100":"bg-blue-50 text-blue-700 border-blue-100 animate-pulse"}`,children:x?s==="zh"?"已提交":"Finished":s==="zh"?"进行中":"Running"})}),e.jsx("td",{className:"p-3 text-center font-bold font-mono",children:i.score!==null?e.jsxs("span",{className:"text-indigo-650 bg-indigo-50 border border-indigo-100 px-1.5 py-0.5 rounded-md",children:[i.score,"分"]}):e.jsx("span",{className:"text-slate-400 font-medium",children:"-"})}),e.jsx("td",{className:"p-3 text-center font-semibold font-mono",children:i.completion!==null?`${Math.round(i.completion*100)}%`:"0%"}),e.jsx("td",{className:"p-3 text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs("button",{onClick:()=>Le(i),className:"p-1 text-slate-500 hover:text-indigo-600 hover:bg-slate-100 border border-transparent hover:border-slate-200 rounded-lg transition-colors cursor-pointer flex items-center gap-1 text-[10px]",title:s==="zh"?"查看提交轨迹事件数据":"View Raw Data",children:[e.jsx(ht,{size:12}),e.jsx("span",{children:s==="zh"?"轨迹":"Events"})]}),i.isPromoted>0?e.jsxs("span",{className:"px-2 py-1 text-emerald-650 font-bold text-[10px] flex items-center gap-0.5 bg-emerald-50/50 rounded-lg border border-emerald-100",children:[e.jsx(pt,{size:11}),s==="zh"?"已归档":"Saved"]}):e.jsxs("button",{onClick:()=>Be(i.attemptId),disabled:!x,className:`px-2 py-1 text-[10px] font-bold rounded-lg flex items-center gap-1 shadow-sm transition-all active:scale-95 cursor-pointer border ${x?"bg-indigo-600 hover:bg-indigo-700 text-white border-indigo-600":"bg-slate-55 text-slate-400 border-slate-200 cursor-not-allowed opacity-60"}`,title:s==="zh"?"将分数和进度作为随堂学习数据存入数据库,记入学期成绩":"Save to DB & Semester grade",children:[e.jsx(Me,{size:11}),e.jsx("span",{children:s==="zh"?"录入成绩":"Record"})]})]})})]},i.attemptId)})})]})})()})]}):e.jsx(wt,{lessonId:d||"",lang:s==="zh"?"zh":"en",addToast:g})]}):e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-slate-455 gap-2.5 select-none",children:[e.jsx(Te,{size:38,className:"text-slate-300 animate-bounce",style:{animationDuration:"2.5s"}}),e.jsx("div",{className:"text-sm font-bold text-slate-655",children:s==="zh"?"请在顶部栏选择一个授课课节":"Please select a lesson to start teaching"}),e.jsx("p",{className:"text-[10px] text-slate-400",children:"白板及环节控制面板将在课节载入后自动生成"})]})}),e.jsxs("div",{className:"w-[260px] shrink-0 bg-white p-3.5 border-l border-slate-200/80 flex flex-col gap-3.5 overflow-hidden",children:[e.jsxs("div",{className:"flex-1 flex flex-col min-h-0 gap-2",children:[e.jsxs("h3",{className:"text-[10px] font-black uppercase text-slate-555 tracking-wider select-none flex justify-between items-center shrink-0",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{children:s==="zh"?"学生专注力监控":"Student Status Console"}),f&&e.jsxs("button",{onClick:Qe,disabled:N.length===0||j,className:"ml-2 text-[9px] font-bold bg-indigo-50 text-indigo-600 border border-indigo-200 px-1.5 py-0.5 rounded hover:bg-indigo-105 transition-colors flex items-center gap-1 active:scale-95 disabled:opacity-50 cursor-pointer shrink-0",title:s==="zh"?"随机抽取一名学生提问":"Pick a student randomly",children:[e.jsx(Ce,{size:8.5,className:j?"animate-spin":""}),e.jsx("span",{children:s==="zh"?"随机抽问":"Pick Student"})]})]}),e.jsxs("span",{className:"text-[9px] bg-slate-100 border border-slate-200 text-slate-555 font-mono px-1.5 py-0.5 rounded-md",children:[N.filter(t=>t.locked_lesson_id===d).length," / ",N.length," Locked"]})]}),f?e.jsx("div",{className:"overflow-y-auto flex-1 pr-1 grid grid-cols-3 gap-2 justify-items-center auto-rows-max scrollbar-thin py-2",children:N.map(t=>{const r=t.locked_lesson_id===d,l=V.get(t.id),i=O.includes(t.id),p=o[t.id]===d,k=F.find(H=>H.student_id===t.id)?.progress_percent??0,P=M?w.findIndex(H=>H.id===M):-1,ue=w.length>0?Math.round((P+1)/w.length*100):0,$e=P>=0&&k<ue,D=Re.includes(t.id),ge=J===t.id,be=22,_e=3,je=2*Math.PI*be,He=je-k/100*je;let W="stroke-indigo-650";return D?W="stroke-amber-500 stroke-[3.5px]":ge?W="stroke-indigo-500 stroke-[3.5px] animate-pulse":i?r?W="stroke-rose-500 animate-pulse":$e?W="stroke-amber-500 animate-pulse":p?k===100&&(W="stroke-emerald-500"):W="stroke-blue-400":W="stroke-slate-200",e.jsxs("div",{onMouseEnter:()=>b(t.id),onMouseLeave:()=>b(null),className:`group relative flex flex-col items-center justify-center p-1 rounded-xl transition-all cursor-default ${D?"z-20 duration-300":ge?"z-20":"hover:bg-slate-50"}`,children:[e.jsxs("div",{className:`relative w-14 h-14 flex items-center justify-center rounded-full transition-all duration-300 ${D?"shadow-[0_0_15px_#f59e0b] scale-110 z-10 bg-amber-50 ring-2 ring-amber-400 ring-offset-1":ge?"shadow-[0_0_10px_#6366f1] scale-105 z-10 bg-indigo-50 ring-1 ring-indigo-400":""}`,children:[D&&e.jsx("div",{className:"absolute inset-0 rounded-full bg-amber-400/30 animate-ping",style:{animationDuration:"2s"}}),e.jsxs("svg",{className:"absolute w-full h-full transform -rotate-90",viewBox:"0 0 50 50",children:[e.jsx("circle",{cx:"25",cy:"25",r:be,className:"stroke-slate-100 fill-white",strokeWidth:_e}),e.jsx("circle",{cx:"25",cy:"25",r:be,className:`fill-transparent transition-all duration-300 ${W}`,strokeWidth:_e,strokeDasharray:je,strokeDashoffset:He,strokeLinecap:"round"})]}),e.jsxs("div",{className:`relative z-10 w-10 h-10 rounded-full flex items-center justify-center overflow-hidden transition-colors ${D?"bg-amber-100/90":""}`,children:[e.jsx("span",{className:`text-[10px] font-bold tracking-tight truncate max-w-[34px] group-hover:scale-0 group-hover:opacity-0 transition-all duration-200 select-none ${D?"text-amber-900 font-extrabold":i?"text-slate-700":"text-slate-400"}`,children:t.name}),e.jsxs("div",{className:"absolute inset-0 flex items-center justify-center gap-1 opacity-0 scale-50 group-hover:opacity-100 group-hover:scale-100 transition-all duration-200 bg-white/95 rounded-full shadow-inner",children:[d&&ee&&e.jsx("button",{onClick:()=>{const H=s==="zh"?`⚠️ 学习进度预警:您当前的进度 (${k}%) 落后于老师的讲解进度。请专注课堂,跟上讲解!`:`⚠️ Progress Alert: Your progress (${k}%) is behind.`;ee(t.id,H),g(s==="zh"?"🔔 已发送提醒":"🔔 Alert Sent",`已向学生 ${t.name} 发送进度提醒。`,"success")},className:`p-0.5 rounded-md hover:bg-slate-105 transition-colors shrink-0 cursor-pointer ${$e?"text-amber-500 hover:text-amber-600 animate-pulse":"text-slate-400 hover:text-slate-650"}`,title:"提醒",children:e.jsx(Ae,{size:10})}),e.jsx("button",{onClick:()=>qe(t.id,t.locked_lesson_id),disabled:!d,className:`p-0.5 rounded-md hover:bg-slate-105 transition-colors shrink-0 cursor-pointer ${r?"text-rose-500 hover:text-rose-600":"text-slate-400 hover:text-slate-655"}`,title:r?"解锁":"锁定",children:r?e.jsx(Pe,{size:10}):e.jsx(De,{size:10})})]})]}),D?e.jsx("span",{className:"absolute -top-1.5 -right-1.5 z-20 text-[9px] bg-amber-500 text-white rounded-full w-4 h-4 flex items-center justify-center font-bold shadow-md animate-bounce",children:"🎯"}):i&&e.jsx("span",{className:`absolute top-0 right-0 w-2.5 h-2.5 rounded-full border-2 border-white shrink-0 ${p?"bg-emerald-500":"bg-blue-400"}`,title:p?"正在上课":"在线(但未进课堂)"}),l===!0&&!D&&e.jsx("span",{className:"absolute bottom-0 right-0 w-2.5 h-2.5 rounded-full border-2 border-white bg-amber-500 shrink-0 animate-bounce",title:"已确认/就位"})]}),e.jsx("span",{className:`text-[8.5px] mt-1 truncate max-w-[48px] select-none font-medium ${D?"text-amber-600 font-extrabold animate-bounce":i?"text-slate-505":"text-slate-350"}`,children:D?"🎯 抽中":`${k}%`})]},t.id)})}):e.jsx("div",{className:"text-xs text-slate-400 italic py-4 text-center flex-1 flex items-center justify-center",children:s==="zh"?"请选择班级以显示学生":"Select class to show student monitors."})]}),e.jsx("div",{className:"bg-slate-50 border border-slate-150 rounded-xl p-3 flex flex-col gap-1.5 h-[135px] shrink-0 shadow-sm select-none justify-center",children:v?(()=>{const t=N.find(x=>x.id===v);if(!t)return null;const r=F.find(x=>x.student_id===t.id),l=r?.progress_percent??0,i=(()=>{if(!r||!r.completed_segments)return[];try{return typeof r.completed_segments=="string"?JSON.parse(r.completed_segments):r.completed_segments}catch{return[]}})();return e.jsxs("div",{className:"flex flex-col gap-1.5 text-xs text-slate-705",children:[e.jsxs("div",{className:"font-extrabold text-slate-800 border-b border-slate-200 pb-1 flex justify-between items-center shrink-0",children:[e.jsxs("span",{className:"flex items-center gap-1.5 truncate",children:[e.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${O.includes(t.id)?"bg-emerald-500 animate-pulse":"bg-slate-300"}`}),e.jsxs("span",{className:"truncate max-w-[130px]",children:[t.name," (",t.student_number||"N/A",")"]})]}),e.jsxs("span",{className:"text-[10px] text-indigo-655 font-mono font-black shrink-0",children:[l,"%"]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-1.5 text-[9.5px] leading-tight shrink-0",children:[e.jsxs("div",{className:"flex flex-col gap-0.5 bg-white p-1 rounded-lg border border-slate-150",children:[e.jsx("span",{className:"text-slate-400 font-bold",children:"随堂测验"}),e.jsx("span",{className:`font-bold font-mono text-[10px] ${r!=null&&r.quiz_score!==null?"text-indigo-600":"text-slate-400"}`,children:r!=null&&r.quiz_score!==null?`${r.quiz_score} / 100`:"未提交"})]}),e.jsxs("div",{className:"flex flex-col gap-0.5 bg-white p-1 rounded-lg border border-slate-150",children:[e.jsx("span",{className:"text-slate-400 font-bold",children:"教学环节进度"}),e.jsxs("span",{className:"font-bold text-slate-655 text-[10px]",children:[Array.isArray(i)?i.length:0," / ",w.length]})]})]}),e.jsxs("div",{className:"text-[9px] text-slate-500 leading-relaxed truncate mt-0.5 shrink-0",children:["环节: ",w.length>0?w.map((x,p)=>{const z=Array.isArray(i)&&i.includes(x.id);return e.jsxs("span",{className:`mr-1 px-1 py-0.2 rounded ${z?"bg-emerald-50 text-emerald-600 border border-emerald-100":"bg-slate-105 text-slate-400 border border-slate-150"}`,title:x.title,children:[p+1,":",z?"✓":"✗"]},x.id)}):e.jsx("span",{className:"italic text-slate-400",children:"暂无步骤"})]})]})})():e.jsxs("div",{className:"flex flex-col gap-1 text-xs text-slate-700 h-full justify-center",children:[e.jsxs("div",{className:"font-extrabold text-slate-800 border-b border-slate-200 pb-1.5 flex items-center gap-1.5 shrink-0",children:[e.jsx(Ne,{size:12,className:"text-indigo-655 animate-pulse"}),e.jsx("span",{children:s==="zh"?"班级学情概况":"Class Overview"})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-1.5 text-[9.5px] leading-tight mt-1.5 shrink-0",children:[e.jsxs("div",{className:"flex flex-col items-center bg-white py-1 rounded-lg border border-slate-150",children:[e.jsx("span",{className:"text-slate-400 font-medium",children:"在线/总数"}),e.jsxs("span",{className:"font-bold font-mono text-emerald-600 text-[11px] mt-0.5",children:[N.filter(t=>O.includes(t.id)).length,"/",N.length]})]}),e.jsxs("div",{className:"flex flex-col items-center bg-white py-1 rounded-lg border border-slate-150",children:[e.jsx("span",{className:"text-slate-400 font-medium",children:"屏幕锁定"}),e.jsx("span",{className:"font-bold font-mono text-rose-500 text-[11px] mt-0.5",children:N.filter(t=>t.locked_lesson_id===d).length})]}),e.jsxs("div",{className:"flex flex-col items-center bg-white py-1 rounded-lg border border-slate-150",children:[e.jsx("span",{className:"text-slate-400 font-medium",children:"平均进度"}),e.jsx("span",{className:"font-bold font-mono text-indigo-650 text-[11px] mt-0.5",children:(()=>{const t=N.filter(l=>O.includes(l.id));if(t.length===0)return"0%";const r=t.reduce((l,i)=>{const x=F.find(p=>p.student_id===i.id);return l+(x?.progress_percent??0)},0);return`${Math.round(r/t.length)}%`})()})]})]})]})}),e.jsxs("div",{className:"h-[160px] flex flex-col border-t border-slate-150 pt-3 min-h-0 gap-2 shrink-0",children:[e.jsxs("h3",{className:"text-[10px] font-black uppercase text-slate-550 tracking-wider select-none flex justify-between items-center",children:[e.jsx("span",{children:s==="zh"?"课堂互动反馈流":"Live Classroom Feed"}),e.jsx("button",{onClick:()=>y([{id:"clear",time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}),type:"info",message:"反馈流已清空。"}]),className:"text-[9px] hover:text-slate-700 text-slate-400 underline transition-all",children:"Clear"})]}),e.jsx("div",{className:"flex-1 bg-white border border-slate-200 rounded-xl p-2.5 font-mono text-[9px] leading-relaxed overflow-y-auto space-y-2 select-text text-left text-slate-600 shadow-inner scrollbar-thin",children:Z.map(t=>e.jsxs("div",{className:"border-b border-slate-100 pb-1.5 last:border-b-0",children:[e.jsxs("div",{className:"flex justify-between items-center text-slate-400 font-bold mb-0.5",children:[e.jsx("span",{children:t.time}),e.jsx("span",{className:`px-1 rounded uppercase tracking-wide text-[7px] ${t.type==="success"?"bg-emerald-50 text-emerald-600 border border-emerald-100":t.type==="warning"?"bg-amber-50 text-amber-600 border border-amber-100":"bg-slate-100 text-slate-500 border border-slate-200"}`,children:t.type})]}),e.jsx("p",{className:t.type==="success"?"text-emerald-700 font-medium":t.type==="warning"?"text-amber-700 font-medium":"text-slate-655",children:t.message})]},t.id))})]})]})]}),E&&e.jsx("div",{className:"fixed inset-0 bg-slate-900/60 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl max-w-2xl w-full max-h-[85vh] flex flex-col overflow-hidden border border-slate-100 animate-in fade-in zoom-in duration-200",children:[e.jsxs("div",{className:"bg-slate-50 px-6 py-4 border-b border-slate-100 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(we,{className:"text-indigo-600",size:18}),e.jsx("h3",{className:"text-sm font-bold text-slate-800",children:s==="zh"?`[${E.studentName}] 的互动提交轨迹详情`:`Submission Details - ${E.studentName}`})]}),e.jsx("button",{onClick:()=>me(null),className:"text-slate-400 hover:text-slate-600 p-1.5 hover:bg-slate-100 rounded-lg transition-colors cursor-pointer",children:e.jsx(ft,{size:18})})]}),e.jsxs("div",{className:"p-6 overflow-y-auto space-y-4 flex-1 scrollbar-thin",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{className:"bg-slate-50 p-3 rounded-xl border border-slate-100",children:[e.jsx("div",{className:"text-[10px] text-slate-400 font-bold uppercase tracking-wider",children:s==="zh"?"课件名称":"Courseware"}),e.jsx("div",{className:"text-xs font-semibold text-slate-700 mt-1 truncate",title:E.coursewareName,children:E.coursewareName})]}),e.jsxs("div",{className:"bg-slate-50 p-3 rounded-xl border border-slate-100",children:[e.jsx("div",{className:"text-[10px] text-slate-400 font-bold uppercase tracking-wider",children:s==="zh"?"提交成绩":"Score"}),e.jsx("div",{className:"text-xs font-bold text-indigo-600 mt-1",children:E.score!==null?`${E.score} 分`:s==="zh"?"未打分":"N/A"})]}),e.jsxs("div",{className:"bg-slate-50 p-3 rounded-xl border border-slate-100",children:[e.jsx("div",{className:"text-[10px] text-slate-400 font-bold uppercase tracking-wider",children:s==="zh"?"课件完成度":"Completion"}),e.jsx("div",{className:"text-xs font-bold text-emerald-600 mt-1",children:E.completion!==null?`${Math.round(E.completion*100)}%`:"0%"})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h4",{className:"text-xs font-bold text-slate-700 border-b border-slate-100 pb-1.5 flex items-center gap-1.5 flex-wrap",children:[e.jsx(Ne,{size:13,className:"text-indigo-650"}),e.jsx("span",{children:s==="zh"?"实时捕获轨迹事件流 (LMS Bridge)":"LMS Event Captures"})]}),We?e.jsxs("div",{className:"py-12 flex flex-col items-center justify-center text-slate-400 gap-2",children:[e.jsx(X,{size:20,className:"animate-spin text-indigo-600"}),e.jsx("span",{className:"text-xs",children:s==="zh"?"正在查询原始数据...":"Loading raw data..."})]}):Array.isArray(he)&&he.length>0?e.jsx("div",{className:"space-y-3 font-mono text-[11px] max-h-[40vh] overflow-y-auto pr-1 scrollbar-thin",children:he.map((t,r)=>{let l={};try{l=typeof t.payload_json=="string"?JSON.parse(t.payload_json):t.payload_json}catch{}return e.jsxs("div",{className:"p-3 bg-slate-900 text-slate-200 rounded-xl border border-slate-800 flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex justify-between items-center text-[10px] text-slate-400 border-b border-slate-800 pb-1",children:[e.jsx("span",{className:"font-bold text-indigo-400 bg-indigo-950/50 border border-indigo-900/50 px-1.5 py-0.5 rounded",children:t.event_type}),e.jsx("span",{children:new Date(t.created_at).toLocaleTimeString()})]}),e.jsx("pre",{className:"overflow-x-auto text-[10px] leading-relaxed p-1 text-emerald-400/90 whitespace-pre-wrap word-break-all",children:JSON.stringify(l,null,2)})]},t.id||r)})}):e.jsx("div",{className:"py-8 text-center text-xs text-slate-400 italic",children:s==="zh"?"该学生未产生任何轨迹事件数据。":"No trace events captured."})]})]}),e.jsxs("div",{className:"bg-slate-50 px-6 py-4 border-t border-slate-100 flex justify-between gap-3 shrink-0",children:[e.jsxs("div",{className:"text-[10px] text-slate-400 flex items-center gap-1",children:[e.jsx(Ee,{size:10}),e.jsx("span",{children:"Powered by LMS Bridge API v1"})]}),e.jsx("button",{onClick:()=>me(null),className:"px-4 py-1.5 bg-slate-200 hover:bg-slate-300 text-slate-700 font-bold rounded-lg text-xs transition-all cursor-pointer shadow-sm active:scale-95",children:s==="zh"?"关闭窗口":"Close"})]})]})})]})}export{Tt as LiveClassroomView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./vendor-react-0Lg0vA-4.js";import{m as n}from"./index-D8x6bUeG.js";import{B as d,g as o,m as l,a1 as i}from"./vendor-icons-_c3xpwjZ.js";import"./vendor-utils-4FcTwKPj.js";import"./vendor-pdf-CVyNPGVr.js";import"./vendor-motion-DjY2czvL.js";import"./vendor-charts-B7ViBL9w.js";function y({notification:s,onClose:t,lang:r,onOpenWorkspace:a}){return s?e.jsx("div",{className:"fixed inset-0 bg-gray-900/40 backdrop-blur-sm flex items-center justify-center p-6 z-50",children:e.jsxs(n.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-white border text-gray-900 border-gray-200 rounded-2xl shadow-2xl w-full max-w-xl flex flex-col overflow-hidden max-h-[85vh] font-sans",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between bg-gray-50/80 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(d,{className:"text-indigo-600 font-sans shrink-0",size:20}),e.jsx("h2",{className:"font-bold text-gray-800 text-base font-sans truncate",children:s.title})]}),e.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-600 font-bold p-1 hover:bg-gray-200 rounded transition-colors text-lg",children:"×"})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:[e.jsx("div",{className:"p-4 bg-indigo-50/50 rounded-xl border border-indigo-100 text-sm text-gray-700 leading-relaxed font-sans",children:s.message}),s.assignment&&e.jsxs("div",{className:"space-y-4 font-sans",children:[e.jsxs("div",{className:"border border-gray-150 rounded-xl p-4 bg-gray-50/50 space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-xs text-gray-400 uppercase tracking-wider font-semibold font-sans",children:r==="zh"?"关联作业":"Associated Assignment"}),s.assignment.submission_status==="graded"&&e.jsx("span",{className:"bg-green-100 border border-green-200 text-green-800 text-xs font-bold px-2.5 py-1 rounded-full shadow-sm font-mono",children:r==="zh"?`得分:${s.assignment.score}%`:`Score: ${s.assignment.score}%`})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-bold text-base text-indigo-900 font-sans",children:s.assignment.title}),e.jsx("p",{className:"text-xs text-gray-500 mt-1 font-sans",children:s.assignment.class_name})]}),s.assignment.feedback&&e.jsxs("div",{className:"mt-3 bg-white p-3 rounded-lg border border-gray-150 space-y-1 font-sans",children:[e.jsxs("div",{className:"text-xs font-bold text-green-700 flex items-center justify-between gap-2 font-sans",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(o,{size:14,className:"font-sans"}),e.jsx("span",{children:r==="zh"?"教师评审意见与反馈":"Teacher Feedback & Recommendations"})]}),s.assignment.graded_at&&e.jsxs("div",{className:"text-[10px] text-gray-400 font-mono flex items-center gap-1 font-normal select-none",children:[e.jsx(l,{size:11,className:"text-neutral-400"}),e.jsx("span",{children:new Date(s.assignment.graded_at).toLocaleString(r==="zh"?"zh-CN":"en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]})]}),e.jsx("div",{className:"text-xs text-gray-600 italic bg-green-50/30 p-2 rounded border border-green-50 mt-1 leading-relaxed whitespace-pre-wrap font-sans",children:s.assignment.feedback})]})]}),s.assignment.submission_content&&e.jsxs("div",{className:"space-y-1.5 font-sans",children:[e.jsx("div",{className:"text-xs text-gray-400 font-bold uppercase tracking-wider font-sans",children:r==="zh"?"我提交的内容":"My Submission Content"}),e.jsx("div",{className:"bg-gray-900 text-gray-100 p-4 rounded-xl border border-gray-800 overflow-x-auto max-h-40 overflow-y-auto text-xs font-mono leading-relaxed whitespace-pre-wrap",children:s.assignment.submission_content})]})]})]}),e.jsxs("div",{className:"p-4 border-t border-gray-100 bg-gray-50/85 flex justify-end gap-2.5 shrink-0 font-sans",children:[e.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-xs font-semibold border border-gray-200 text-gray-700 bg-white rounded-lg hover:bg-gray-100 transition-colors cursor-pointer",children:r==="zh"?"关闭":"Close"}),s.assignment&&e.jsxs("button",{type:"button",onClick:()=>a(s.assignment),className:"px-4 py-2 text-xs font-bold bg-indigo-600 text-white border border-indigo-700 rounded-lg hover:bg-indigo-700 hover:shadow shadow-sm transition-all cursor-pointer flex items-center gap-1.5 font-sans",children:[e.jsx(i,{size:14,className:"font-sans"}),r==="zh"?"打开画布 / 查看详情":"Open Workspace Canvas"]})]})]})}):null}export{y as NotificationDetailModal};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./vendor-react-0Lg0vA-4.js";import{m as O}from"./index-D8x6bUeG.js";import{W as w,l as C,g as k}from"./vendor-icons-_c3xpwjZ.js";import"./vendor-utils-4FcTwKPj.js";import"./vendor-pdf-CVyNPGVr.js";import"./vendor-motion-DjY2czvL.js";import"./vendor-charts-B7ViBL9w.js";function E(z){const{isQuizGeneratorOpen:S,setIsQuizGeneratorOpen:x,lessons:g,quizGenMode:n,setQuizGenMode:u,quizGenSelectedLessonId:l,setQuizGenSelectedLessonId:Q,quizGenTopic:d,setQuizGenTopic:M,isGeneratingSuggestions:p,setIsGeneratingSuggestions:h,suggestedObjectives:b,setSuggestedObjectives:f,suggestedQuestions:r,setSuggestedQuestions:m,quizGenTimeLimit:j,setQuizGenTimeLimit:G,savingQuiz:y,setSavingQuiz:v,quizGeneratorClassId:o,fetchClassDashboard:N}=z;return e.jsx(e.Fragment,{children:S&&e.jsx("div",{className:"fixed inset-0 bg-gray-900/40 backdrop-blur-sm flex items-center justify-center p-6 z-50 overflow-y-auto text-gray-850",children:e.jsxs(O.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-white border text-gray-900 border-gray-200 rounded-2xl shadow-2xl w-full max-w-3xl flex flex-col overflow-hidden max-h-[90vh]",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between bg-gray-50/80 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(w,{className:"text-indigo-600 animate-pulse",size:20}),e.jsx("h2",{className:"font-bold text-gray-800 text-lg",children:"AI-Objective Quiz Generator"})]}),e.jsx("button",{onClick:()=>x(!1),className:"text-gray-400 hover:text-gray-600 font-bold p-1 hover:bg-gray-200 rounded transition-colors",children:"×"})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[r.length===0&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"bg-indigo-50/80 p-4 rounded-xl border border-indigo-100 text-xs text-indigo-800 leading-relaxed font-sans",children:"Choose a lesson to scan. Our advanced AI model will run a deep semantic scan across the entire lesson curriculum content, discover your core learning objectives, and construct interactive multiple-choice questions aligning precisely with each of them."}),e.jsxs("div",{className:"font-sans",children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2",children:"Scan Core Selection Mode"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("button",{onClick:()=>u("scan_lesson"),className:`p-3 rounded-lg border text-left flex flex-col transition-all ${n==="scan_lesson"?"border-indigo-600 bg-indigo-50/40 ring-2 ring-indigo-100":"border-gray-200 hover:border-gray-300"}`,children:[e.jsx("span",{className:"font-semibold text-sm text-indigo-900",children:"Curriculum Lesson Scanning"}),e.jsx("span",{className:"text-[10px] text-gray-500 mt-1",children:"Examines real Markdown content inside virtual lesson modules."})]}),e.jsxs("button",{onClick:()=>u("topic"),className:`p-3 rounded-lg border text-left flex flex-col transition-all ${n==="topic"?"border-indigo-600 bg-indigo-50/40 ring-2 ring-indigo-100":"border-gray-200 hover:border-gray-300"}`,children:[e.jsx("span",{className:"font-semibold text-sm text-indigo-900",children:"Custom Keyword / Topic"}),e.jsx("span",{className:"text-[10px] text-gray-500 mt-1",children:"Provide a custom prompt keyword or objective manually."})]})]})]}),n==="scan_lesson"?e.jsxs("div",{className:"font-sans",children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2",children:"Select Lesson to Scan"}),g.length===0?e.jsx("div",{className:"text-gray-500 text-xs py-3 border rounded border-dashed text-center",children:"No lessons available. Please create a lesson first."}):e.jsxs("select",{value:l,onChange:s=>Q(s.target.value),className:"w-full p-2.5 bg-white border border-gray-200 rounded-lg text-sm text-gray-800 focus:border-indigo-500 focus:outline-none shadow-sm",children:[e.jsx("option",{value:"",children:"-- Choose a lesson --"}),g.map(s=>e.jsx("option",{value:s.id,children:s.title},s.id))]})]}):e.jsxs("div",{className:"font-sans",children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-505 uppercase tracking-wider mb-2",children:"Custom Topic Prompt"}),e.jsx("input",{type:"text",placeholder:"e.g. Introduction to React state, Cloud SQL setup...",value:d,onChange:s=>M(s.target.value),className:"w-full p-2.5 bg-white border border-gray-200 rounded-lg text-sm focus:border-indigo-500 focus:outline-none shadow-sm text-gray-800"})]}),e.jsx("div",{className:"pt-4 flex justify-end font-sans",children:e.jsx("button",{disabled:p||n==="scan_lesson"&&!l||n==="topic"&&!d.trim(),onClick:async()=>{h(!0);try{if(n==="scan_lesson"){const s=await fetch(`/api/classes/${o}/assignments/suggest`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lessonId:l})});if(s.ok){const t=await s.json();f(t.learningObjectives||[]),m((t.questions||[]).map(a=>({...a,selected:!0})))}else alert("Error generating suggestions. Please make sure the selected lesson has content.")}else(await fetch(`/api/classes/${o}/assignments/generate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({topic:d})})).ok?(await N(o),x(!1)):alert("Error generating topic quiz.")}catch(s){console.error(s),alert(s.message)}finally{h(!1)}},className:"px-5 py-2.5 bg-indigo-600 hover:bg-indigo-700 disabled:opacity-50 text-white rounded-lg font-medium text-xs shadow transition flex items-center gap-2",children:p?e.jsxs(e.Fragment,{children:[e.jsx(C,{size:16,className:"animate-spin"}),e.jsx("span",{children:"AI Scanning Content..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(w,{size:16}),e.jsx("span",{children:"Generate Key MCQ Quiz"})]})})})]}),r.length>0&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"font-sans",children:[e.jsx("div",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider mb-2",children:"Identified Core Objectives"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:b.map((s,t)=>e.jsxs("span",{className:"px-2.5 py-1 bg-teal-50 text-teal-800 border border-teal-200 rounded-full text-xs font-semibold",children:["🎯 ",s]},t))})]}),e.jsxs("div",{className:"space-y-4 font-sans",children:[e.jsx("div",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider font-semibold",children:"Suggested MCQ Questions"}),e.jsx("div",{className:"space-y-3",children:r.map((s,t)=>e.jsxs("div",{className:"p-4 rounded-xl border border-gray-150 bg-gray-50/50 hover:bg-gray-50 transition space-y-3 text-gray-800 text-gray-850",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-5 h-5 rounded-full bg-indigo-150 text-indigo-700 flex items-center justify-center text-xs font-bold shrink-0",children:t+1}),e.jsxs("span",{className:"text-[10px] font-semibold text-teal-700 bg-teal-50 px-2.5 py-0.5 rounded border border-teal-100",children:["objective: ",s.objective]})]}),e.jsx("input",{type:"checkbox",checked:!!s.selected,onChange:a=>{const i=[...r];i[t].selected=a.target.checked,m(i)},className:"w-4 h-4 text-indigo-600 border-gray-300 rounded focus:ring-indigo-500"})]}),e.jsx("p",{className:"font-semibold text-gray-800 text-sm leading-relaxed",children:s.question}),e.jsx("div",{className:"grid grid-cols-2 gap-2 text-xs",children:s.options.map((a,i)=>{const c=a===s.correctAnswer;return e.jsxs("div",{className:`p-2 rounded border flex items-center justify-between ${c?"bg-green-50 border-green-200 text-green-955 font-semibold":"bg-white border-gray-100 text-gray-700"}`,children:[e.jsx("span",{children:a}),c&&e.jsx(k,{size:12,className:"text-green-600 shrink-0"})]},i)})})]},t))})]}),e.jsxs("div",{className:"pt-4 border-t border-gray-100 flex justify-between items-center font-sans",children:[e.jsx("button",{onClick:()=>{f([]),m([])},className:"px-4 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-lg text-xs font-semibold transition",children:"Back / Scan New"}),e.jsxs("div",{className:"flex items-center gap-2 border border-indigo-150 bg-indigo-50/50 px-3 py-1.5 rounded-lg text-xs font-semibold text-indigo-900",children:[e.jsx("span",{children:"⏱️ Quiz Time Limit:"}),e.jsxs("select",{value:j,onChange:s=>G(Number(s.target.value)),className:"bg-transparent text-xs text-indigo-950 font-bold focus:outline-none cursor-pointer",children:[e.jsx("option",{className:"text-gray-800",value:0,children:"No Limit"}),e.jsx("option",{className:"text-gray-800",value:1,children:"1 Min"}),e.jsx("option",{className:"text-gray-800",value:2,children:"2 Mins"}),e.jsx("option",{className:"text-gray-800",value:5,children:"5 Mins"}),e.jsx("option",{className:"text-gray-800",value:10,children:"10 Mins"}),e.jsx("option",{className:"text-gray-800",value:15,children:"15 Mins"}),e.jsx("option",{className:"text-gray-800",value:20,children:"20 Mins"}),e.jsx("option",{className:"text-gray-800",value:30,children:"30 Mins"}),e.jsx("option",{className:"text-gray-800",value:45,children:"45 Mins"}),e.jsx("option",{className:"text-gray-800",value:60,children:"60 Mins"})]})]}),e.jsxs("button",{disabled:y||r.filter(s=>s.selected).length===0,onClick:async()=>{v(!0);try{const s=g.find(i=>i.id===l),t=s?s.title:d||"Custom Objective";(await fetch(`/api/classes/${o}/assignments/create-suggested-quiz`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:`MCQ Evaluation: ${t}`,description:"Automatic evaluation based on core learning objectives.",questions:r.filter(i=>i.selected).map(({selected:i,...c})=>c),learningObjectives:b,timeLimit:j})})).ok?(await N(o),x(!1)):alert("Failed to save suggested quiz.")}catch(s){console.error(s),alert(s.message)}finally{v(!1)}},className:"px-5 py-2.5 bg-indigo-600 hover:bg-indigo-700 text-white rounded-lg font-medium text-xs shadow hover:shadow-md transition flex items-center gap-2",children:[y?e.jsx(C,{size:16,className:"animate-spin"}):e.jsx(k,{size:16}),e.jsx("span",{children:"Create Assessment Quiz"})]})]})]})]})]})})})}export{E as QuizGeneratorModal};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,r as N}from"./vendor-react-0Lg0vA-4.js";import{_ as z,W as T,g as A,ak as S,al as q,X as _}from"./vendor-icons-_c3xpwjZ.js";import{M as C}from"./index-D8x6bUeG.js";import{L as E}from"./LazyWhiteboard-B6rDWBFb.js";import"./vendor-utils-4FcTwKPj.js";import"./vendor-pdf-CVyNPGVr.js";import"./vendor-motion-DjY2czvL.js";import"./vendor-charts-B7ViBL9w.js";function O(l){const{setStudentViewStatus:t,setSelectedAssignment:r,selectedAssignment:d}=l;return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("button",{onClick:()=>{t("dashboard"),r(null)},className:"flex items-center gap-2 text-indigo-600 hover:text-indigo-800 transition-colors font-medium text-sm",children:[e.jsx(z,{className:"rotate-180",size:16})," Back to Dashboard"]}),e.jsxs("h2",{className:"text-xl font-bold text-gray-800",children:["Assignment: ",d.title]})]})}function I(l){const{selectedAssignment:t,quizStudentAnswers:r,submitQuizAssignment:d}=l;return e.jsxs("div",{className:"w-1/3 border-r border-gray-100 pr-4 overflow-y-auto hidden md:block",children:[e.jsx("div",{className:"flex justify-between items-center mb-4",children:e.jsx("div",{className:"text-xs font-semibold uppercase tracking-wider text-gray-400",children:t?.content&&t.content.startsWith('{"quizType":"mcq_learning_objectives"')?"Assessment":"Question"})}),t?.content&&t.content.startsWith('{"quizType":"mcq_learning_objectives"')?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-xs font-semibold uppercase tracking-wider text-teal-700 bg-teal-50 border border-teal-100 p-2.5 rounded-lg flex items-center gap-1.5 font-sans",children:[e.jsx(T,{size:12,className:"text-teal-600 animate-pulse"})," AI Interactive Evaluation"]}),e.jsx("p",{className:"text-xs text-gray-500 leading-relaxed font-sans",children:"This assessment was automatically mapped to the core learning objectives of your lesson by our tutoring assistant compiler."}),(()=>{try{const s=JSON.parse(t.content);return e.jsxs("div",{className:"space-y-2 font-sans",children:[e.jsx("div",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-wider",children:"Lesson Learning Objectives:"}),e.jsx("ul",{className:"space-y-1.5",children:(s.learningObjectives||[]).map((i,c)=>e.jsxs("li",{className:"text-xs text-gray-755 flex items-start gap-1.5 font-medium leading-normal",children:[e.jsx("span",{className:"text-indigo-500 shrink-0 select-none",children:"🎯"}),e.jsx("span",{children:i})]},c))})]})}catch{return null}})()]}):e.jsx("div",{className:"prose prose-sm prose-indigo max-w-none mb-6",children:e.jsx(C,{children:t.content||""})}),!t.submission_status&&e.jsxs("div",{className:"mt-8 border-t border-gray-100 pt-6",children:[e.jsx("div",{className:"text-xs font-semibold uppercase tracking-wider text-gray-400 mb-2",children:"Ready to submit?"}),e.jsx("p",{className:"text-xs text-gray-500 mb-4",children:t?.content&&t.content.startsWith('{"quizType":"mcq_learning_objectives"')?"Please answer all the interactive questions on the evaluation sheet, then click Submit.":"You can use the whiteboard to draw or answer, then click submit when finished."}),e.jsx("button",{onClick:async()=>{const s=t?.content&&t.content.startsWith('{"quizType":"mcq_learning_objectives"');if(s&&JSON.stringify(r),s)try{const i=JSON.parse(t.content),c=Object.keys(r).length;if(c<i.questions.length&&!window.confirm(`You have only answered ${c}/${i.questions.length} questions. Are you sure you want to submit your answers?`))return}catch{}await d(!1)},className:"w-full py-2 bg-indigo-600 text-white rounded-lg shadow font-medium hover:bg-indigo-700 transition",children:"Submit"})]}),t.submission_status==="graded"&&t.feedback&&e.jsxs("div",{className:"mt-6 bg-green-50 p-4 rounded-xl border border-green-100",children:[e.jsxs("div",{className:"font-semibold text-green-800 text-sm mb-1 flex items-center gap-1",children:[e.jsx(A,{size:16})," Grade: ",t.score,"%"]}),e.jsx("div",{className:"text-xs text-green-700 whitespace-pre-wrap leading-relaxed font-sans",children:t.feedback})]})]})}function R({assignmentId:l,timeLimitMinutes:t,onTimeUp:r,isSubmitted:d}){const[s,i]=N.useState(null);if(N.useEffect(()=>{if(d||!t||t<=0){i(null);return}const n=`quiz_timer_start_${l}`;let m=sessionStorage.getItem(n),x=m?parseInt(m,10):null;x||(x=Date.now(),sessionStorage.setItem(n,x.toString()));const a=t*60,o=()=>{const j=Math.floor((Date.now()-x)/1e3),b=a-j;b<=0?(i(0),r()):i(b)};o();const g=setInterval(o,1e3);return()=>clearInterval(g)},[l,t,d,r]),!t||t<=0)return null;if(d)return e.jsxs("div",{className:"flex items-center gap-2 font-sans text-xs bg-gray-100 text-gray-600 px-3 py-1.5 rounded-lg border border-gray-200",children:[e.jsx(S,{size:14}),e.jsxs("span",{children:["Time Limit: ",t," mins (Completed)"]})]});if(s===null)return null;const c=Math.floor(s/60),p=s%60,u=s<60;return e.jsxs("div",{className:`flex items-center gap-3 font-sans px-4 py-2.5 rounded-xl border transition-all ${u?"bg-red-50 text-red-700 border-red-200 animate-pulse font-bold":s<180?"bg-amber-50 text-amber-700 border-amber-200 font-semibold":"bg-indigo-50 text-indigo-700 border-indigo-100"}`,children:[e.jsx(S,{size:16,className:u?"text-red-600 animate-pulse":"text-indigo-600"}),e.jsxs("div",{className:"flex-1 flex justify-between items-center text-xs gap-4",children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"Time Remaining:"}),e.jsxs("span",{className:"font-mono ml-1 text-sm bg-black/5 text-slate-800 px-1.5 py-0.5 rounded font-bold",children:[c.toString().padStart(2,"0"),":",p.toString().padStart(2,"0")]})]}),u&&e.jsxs("span",{className:"flex items-center gap-1 text-[10px] uppercase tracking-wider text-red-600 font-bold animate-pulse",children:[e.jsx(q,{size:12})," Time is almost up!"]})]})]})}function W(l){const{selectedAssignment:t,subAssignmentTab:r,setSubAssignmentTab:d,quizStudentAnswers:s,setQuizStudentAnswers:i,submitQuizAssignment:c,elements:p,activeRole:u,activeStudentId:n,fetchElements:m}=l;return e.jsx("div",{className:"flex-1 relative flex flex-col min-h-0",children:(()=>{const x=t?.content&&t.content.startsWith('{"quizType":"mcq_learning_objectives"');return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 pointer-events-none",children:x&&r==="quiz"?"Evaluation Sheet":"Live Canvas"}),x&&e.jsxs("div",{className:"flex bg-gray-100 p-0.5 rounded-lg border border-gray-200 text-xs",children:[e.jsx("button",{onClick:()=>d("quiz"),className:`px-2.5 py-0.5 rounded text-[10px] font-bold transition-all ${r==="quiz"?"bg-white text-indigo-700 shadow-sm":"text-gray-500 hover:text-gray-900"}`,children:"Interactive Test"}),e.jsx("button",{onClick:()=>d("whiteboard"),className:`px-2.5 py-0.5 rounded text-[10px] font-bold transition-all ${r==="whiteboard"?"bg-white text-indigo-700 shadow-sm":"text-gray-500 hover:text-gray-900"}`,children:"Sketch Whiteboard"})]})]}),t.submission_status&&e.jsx("div",{className:"text-[10px] uppercase font-bold text-gray-400 bg-gray-100 px-2 py-0.5 rounded",children:"Read Only"})]}),x&&r==="quiz"?e.jsx("div",{className:"flex-1 bg-gray-50/50 rounded-xl border border-gray-200 p-6 overflow-y-auto space-y-6",children:(()=>{try{const a=JSON.parse(t.content);return e.jsxs(e.Fragment,{children:[a.timeLimit>0&&e.jsx(R,{assignmentId:t.id,timeLimitMinutes:a.timeLimit,onTimeUp:()=>c(!0),isSubmitted:!!t.submission_status}),a.questions.map((o,g)=>{const j=s[g],b=!!t.submission_status,w=s[g]===o.correctAnswer;return e.jsxs("div",{className:"bg-white p-5 rounded-xl border border-gray-100 shadow-sm space-y-3 font-sans",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-6 h-6 rounded-full bg-indigo-50 text-indigo-700 flex items-center justify-center text-xs font-bold ring-1 ring-indigo-100",children:g+1}),e.jsxs("span",{className:"text-[10px] font-semibold text-teal-700 bg-teal-50 px-2.5 py-0.5 rounded-full border border-teal-100",children:["evaluates: ",o.objective]})]}),b&&e.jsx("span",{className:`text-[10px] font-bold px-2.5 py-0.5 rounded-full ${w?"bg-green-100 text-green-800":"bg-red-100 text-red-800"}`,children:w?"Correct ✓":`Incorrect (Correct Option: ${o.correctAnswer})`})]}),e.jsx("div",{className:"font-semibold text-gray-800 text-sm",children:o.question}),e.jsx("div",{className:"grid grid-cols-2 gap-3 text-xs pt-1",children:o.options.map((f,$)=>{const y=j===f,v=f===o.correctAnswer;let h="border-gray-200 hover:border-gray-300 bg-white text-gray-700 hover:bg-gray-50/50 cursor-pointer";return b?y?h=v?"border-green-600 bg-green-50 text-green-900 ring-2 ring-green-100":"border-red-600 bg-red-50 text-red-900 ring-2 ring-red-100":v?h="border-green-400 bg-green-50/20 text-green-900":h="border-gray-200 opacity-60 text-gray-400":y&&(h="border-indigo-600 bg-indigo-50/30 text-indigo-900 ring-2 ring-indigo-100 font-medium cursor-pointer"),e.jsxs("div",{onClick:()=>{b||i(k=>({...k,[g]:f}))},className:`p-3 rounded-xl border transition-all duration-150 flex items-center justify-between ${h}`,children:[e.jsx("span",{children:f}),y&&(b?v?e.jsx(A,{size:14,className:"text-green-600 shrink-0"}):e.jsx(_,{size:14,className:"text-red-600 shrink-0"}):e.jsx("div",{className:"w-2 h-2 rounded-full bg-indigo-600 shadow-sm shrink-0"}))]},$)})})]},g)})]})}catch{return e.jsx("div",{className:"text-xs text-red-500 font-sans",children:"Error parsing quiz structure."})}})()}):e.jsx("div",{className:`flex-1 min-h-0 flex flex-col ${t.submission_status?"opacity-90 pointer-events-none filter grayscale-[0.2]":""}`,children:e.jsx(E,{lessonId:`assignment-${t.id}-student-${n}`,elements:p,userRole:u,enableAutoAI:u==="student"&&!t.submission_status,onElementAdd:async(a,o)=>{await fetch(`/api/lessons/assignment-${t.id}-student-${n}/whiteboard`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:a,data:o})}),m(`assignment-${t.id}-student-${n}`)},onElementUpdate:async(a,o)=>{await fetch(`/api/lessons/assignment-${t.id}-student-${n}/whiteboard/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:o})}),m(`assignment-${t.id}-student-${n}`)},onElementDelete:async a=>{await fetch(`/api/lessons/assignment-${t.id}-student-${n}/whiteboard/${a}`,{method:"DELETE"}),m(`assignment-${t.id}-student-${n}`)},onClearBoard:async()=>{await fetch(`/api/lessons/assignment-${t.id}-student-${n}/whiteboard`,{method:"DELETE"}),m(`assignment-${t.id}-student-${n}`)},onRefresh:()=>m(`assignment-${t.id}-student-${n}`)})})]})})()})}function Y(l){const{selectedAssignment:t,setStudentViewStatus:r,setSelectedAssignment:d,quizStudentAnswers:s,submitQuizAssignment:i,subAssignmentTab:c,setSubAssignmentTab:p,setQuizStudentAnswers:u,elements:n,activeRole:m,activeStudentId:x,fetchElements:a}=l;return e.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[e.jsx(O,{setStudentViewStatus:r,setSelectedAssignment:d,selectedAssignment:t}),e.jsxs("div",{className:"flex-1 flex gap-6 min-h-0 bg-white border border-gray-200 rounded-xl p-4 shadow-sm",children:[e.jsx(I,{selectedAssignment:t,quizStudentAnswers:s,submitQuizAssignment:i}),e.jsx(W,{selectedAssignment:t,subAssignmentTab:c,setSubAssignmentTab:p,quizStudentAnswers:s,setQuizStudentAnswers:u,submitQuizAssignment:i,elements:n,activeRole:m,activeStudentId:x,fetchElements:a})]})]})}export{Y as StudentAssignmentView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,r as y}from"./vendor-react-0Lg0vA-4.js";import{ag as q,_ as B,p as U,x as G,a8 as H,i as W,ae as A,a4 as O,ah as J,m as Y,C as K,O as Q,w as X,a as Z,F as ee,ai as te,aj as se,a9 as ae,h as ne}from"./vendor-icons-_c3xpwjZ.js";import{M as re}from"./index-D8x6bUeG.js";import{L as ie}from"./LazyWhiteboard-B6rDWBFb.js";import{L as le}from"./LazyCourseware-g7b8EXR_.js";import"./vendor-utils-4FcTwKPj.js";import"./vendor-pdf-CVyNPGVr.js";import"./vendor-motion-DjY2czvL.js";import"./vendor-charts-B7ViBL9w.js";function oe(u){const{students:i,activeStudentId:g,setStudentViewStatus:r,setSelectedLesson:S,lessons:c,selectedLesson:o}=u;return e.jsxs("div",{className:"flex items-center justify-between",children:[i.find(p=>p.id===g)?.locked_lesson_id?e.jsxs("div",{className:"text-indigo-600 font-medium text-sm flex items-center gap-2 px-2",children:[e.jsx(q,{size:16})," Restricted Mode"]}):e.jsxs("button",{onClick:()=>{r("dashboard"),S(null)},className:"flex items-center gap-2 text-indigo-600 hover:text-indigo-800 transition-colors font-medium text-sm",children:[e.jsx(B,{className:"rotate-180",size:16})," Back to Dashboard"]}),e.jsx("h2",{className:"text-xl font-bold text-gray-800",children:c.find(p=>p.id===o)?.title})]})}function de(u){const{students:i,activeStudentId:g,studentFullscreenPanel:r,setStudentFullscreenPanel:S,timelineSegments:c,lang:o,activeSegmentId:p,setActiveSegmentId:d,localProgressPercent:f,setLocalProgressPercent:C,updateStudentProgress:j,selectedLesson:v,lessons:k,isStudentLessonContentCollapsed:z}=u;return e.jsxs("div",{className:`${z?"hidden":r==="left"?"w-full":"w-1/3 md:block hidden"} border-gray-100 pr-4 overflow-y-auto ${r==="right"?"hidden":""} ${r==="left"?"":"border-r"} transition-all duration-300`,children:[e.jsxs("div",{className:"text-xs font-semibold uppercase tracking-wider text-gray-400 mb-4 flex items-center justify-between pointer-events-auto shrink-0 select-none border-b border-gray-100 pb-2",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(U,{size:14,className:"text-indigo-500"})," Lesson Content (课程内容)"]}),e.jsx("button",{onClick:()=>S(n=>n==="left"?"none":"left"),className:"p-1 hover:bg-gray-100 text-gray-400 hover:text-gray-700 rounded transition-colors cursor-pointer flex items-center gap-1",title:r==="left"?"退出全屏":"全屏",children:r==="left"?e.jsxs(e.Fragment,{children:[e.jsx(G,{size:13}),e.jsx("span",{className:"text-[10px] font-medium",children:"退出全屏"})]}):e.jsxs(e.Fragment,{children:[e.jsx(H,{size:13}),e.jsx("span",{className:"text-[10px] font-medium",children:"全屏"})]})})]}),e.jsxs("div",{className:"prose prose-sm prose-indigo max-w-none",children:[!i.find(n=>n.id===g)?.locked_lesson_id&&c.length>0&&e.jsxs("div",{className:"mb-4 flex flex-col gap-2 p-3 bg-slate-50/70 border border-slate-200/50 rounded-xl shadow-3xs text-left",onClick:n=>n.stopPropagation(),children:[e.jsxs("div",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-wider flex items-center gap-1.5 mb-1 select-none",children:[e.jsx(W,{size:12,className:"text-indigo-500"}),o==="zh"?"教学环节 (点击切换)":"Timeline Segments"]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:c.map((n,m)=>e.jsxs("button",{onClick:()=>d(n.id),className:`px-2.5 py-1 text-xs font-semibold rounded-lg border transition-all cursor-pointer shadow-3xs ${n.color} ${p===n.id?"ring-2 ring-indigo-500 scale-[1.02] shadow-sm border-indigo-400 font-bold":"opacity-85 hover:opacity-100"}`,children:[n.title," (",n.duration,")"]},n.id||m))})]}),e.jsxs("div",{className:"mb-4 bg-slate-50 p-2.5 rounded-xl border border-slate-200/60 shadow-3xs flex flex-col gap-1.5 text-left select-none",children:[e.jsxs("div",{className:"flex justify-between items-center text-[10px] font-bold text-gray-500",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(W,{size:12,className:"text-indigo-500 animate-pulse"}),o==="zh"?"自主学习进度反馈":"Learning Progress"]}),e.jsxs("span",{className:"font-mono text-indigo-600 font-extrabold",children:[f,"%"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"range",min:"0",max:"100",value:f,onChange:n=>{const m=parseInt(n.target.value);C(m)},onMouseUp:()=>j(f),onTouchEnd:()=>j(f),className:"flex-grow h-1.5 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-indigo-600"}),e.jsx("button",{onClick:()=>{C(100),j(100)},className:`text-[9px] font-bold rounded-lg px-2 py-1 transition-all ${f===100?"bg-emerald-100 text-emerald-700 border border-emerald-200":"bg-white hover:bg-slate-50 text-slate-650 border border-slate-200 hover:border-indigo-200 shadow-3xs cursor-pointer"}`,children:o==="zh"?"已完成":"Done"})]})]}),e.jsx(re,{children:k.find(n=>n.id===v)?.content||""})]})]})}function ce({lessonId:u,studentId:i,lang:g,addToast:r}){const[S,c]=y.useState(!1),[o,p]=y.useState(!1),[d,f]=y.useState(null),[C,j]=y.useState([]),[v,k]=y.useState("/files/my-homework.pdf"),[z,n]=y.useState(!1),[m,P]=y.useState({}),[L,R]=y.useState({}),[E,a]=y.useState({}),t=g==="zh",$=async(s=!1)=>{s?p(!0):c(!0);try{const x=await(await fetch(`/api/lessons/${u}/students/${i}/eval-status`)).json();f(x);const b=await(await fetch(`/api/lessons/${u}/eval-submissions`)).json();j(b)}catch(l){console.error("Error fetching eval data:",l),r(t?"数据加载失败":"Failed to Load Data",t?"请检查网络连接或刷新页面。":"Please check your connection and try again.","warning")}finally{c(!1),p(!1)}};y.useEffect(()=>{u&&i&&$()},[u,i]);const M=async s=>{if(s.preventDefault(),!!v.trim()){n(!0);try{const x=await(await fetch("/api/commands",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commandType:"assignment.submit",payload:{lessonId:u,studentId:i,filePath:v.trim()}})})).json();if(x.success)r(t?"作业提交成功":"Assignment Submitted",t?`成功提交版本 ${x.result.version}!`:`Successfully submitted version ${x.result.version}!`,"success"),$(!0);else throw new Error(x.error||"Failed to submit assignment")}catch(l){r(t?"提交失败":"Submission Failed",l.message,"warning")}finally{n(!1)}}},D=async(s,l)=>{const x=m[s],T=L[s]||"";if(x===void 0||isNaN(x)||x<0||x>100){r(t?"评分无效":"Invalid Score",t?"分数必须在 0 到 100 之间!":"Score must be between 0 and 100!","warning");return}a(b=>({...b,[s]:!0}));try{const N=await(await fetch("/api/commands",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commandType:"assignment.peer_review",payload:{submissionId:s,reviewerId:i,score:Number(x),comment:T}})})).json();if(N.success)r(t?"互评提交成功":"Review Submitted",t?"成功对同学的作品完成了评价!":"Successfully completed review for classmate!","success"),R(_=>{const F={..._};return delete F[s],F}),$(!0);else throw new Error(N.error||"Failed to submit review")}catch(b){r(t?"评价提交失败":"Review Failed",b.message,"warning")}finally{a(b=>({...b,[s]:!1}))}};if(S)return e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center py-12 text-gray-500",children:[e.jsx(A,{className:"animate-spin text-indigo-500 mb-2",size:32}),e.jsx("p",{children:t?"正在读取作业互评状态...":"Loading assignment status..."})]});const w=d?.submission,h=d?.grade,I=d?.reviewsWritten||[],V=C.filter(s=>s.student_id!==i);return e.jsxs("div",{className:"flex-1 flex flex-col lg:flex-row gap-6 overflow-y-auto pr-2",children:[e.jsxs("div",{className:"w-full lg:w-5/12 flex flex-col gap-6",children:[e.jsxs("div",{className:"bg-slate-50 border border-slate-200/80 rounded-2xl p-5 shadow-3xs text-left",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsxs("h3",{className:"text-sm font-bold text-slate-800 flex items-center gap-1.5 select-none",children:[e.jsx(O,{size:16,className:"text-indigo-650"}),t?"我的作业提交":"My Assignment Submission"]}),e.jsx("button",{onClick:()=>$(!0),className:"p-1 hover:bg-slate-200/50 rounded transition-colors text-slate-550",title:t?"刷新数据":"Refresh Data",children:e.jsx(A,{size:14,className:o?"animate-spin":""})})]}),w?e.jsxs("div",{className:"bg-white border border-slate-200 p-4 rounded-xl space-y-3 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"bg-emerald-50 text-emerald-600 p-2.5 rounded-lg border border-emerald-100",children:e.jsx(J,{size:20})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs text-slate-400 font-medium",children:t?"当前已提交版本":"Currently Submitted Version"}),e.jsx("p",{className:"text-sm font-semibold text-slate-700 truncate",children:w.file_path.split("/").pop()})]}),e.jsxs("span",{className:"bg-indigo-100 text-indigo-700 text-[10px] font-bold px-2 py-0.5 rounded-full border border-indigo-200",children:["V",w.version]})]}),e.jsxs("div",{className:"border-t border-slate-100 pt-2.5 flex justify-between items-center text-[10px] text-slate-400",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Y,{size:11}),t?"更新时间:":"Updated At:"," ",new Date(w.updated_at).toLocaleString()]}),e.jsx("span",{className:"font-mono text-slate-350 select-all truncate max-w-[120px]",title:w.file_path,children:w.file_path})]})]}):e.jsxs("div",{className:"bg-amber-50/50 border border-amber-100 p-4 rounded-xl flex items-start gap-3 mb-4 text-left",children:[e.jsx(K,{className:"text-amber-500 shrink-0 mt-0.5",size:16}),e.jsxs("div",{className:"text-xs text-amber-700",children:[e.jsx("p",{className:"font-bold",children:t?"未提交作业":"No Submission Yet"}),e.jsx("p",{className:"mt-1",children:t?"在此上传提交后,其他同学将可以对您的作业进行评分互评。":"Once submitted, other students can view and peer-review your work."})]})]}),e.jsx("form",{onSubmit:M,className:"space-y-3",children:e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] font-bold text-slate-500 uppercase tracking-wider mb-1",children:t?"输入作品文件路径 / 虚拟路径":"Simulated File Path"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:v,onChange:s=>k(s.target.value),placeholder:"/files/homework.pdf",required:!0,className:"flex-1 bg-white border border-slate-200 px-3 py-2 text-xs rounded-lg text-slate-700 focus:outline-none focus:border-indigo-400 font-mono transition-colors"}),e.jsxs("button",{type:"submit",disabled:z,className:"bg-indigo-650 hover:bg-indigo-700 text-white font-bold text-xs px-4 py-2 rounded-lg transition-colors cursor-pointer disabled:opacity-50 flex items-center gap-1.5 shadow-3xs",children:[z?e.jsx(A,{className:"animate-spin",size:13}):e.jsx(O,{size:13}),w?t?"重新提交":"Re-submit":t?"上传作品":"Submit"]})]})]})})]}),w&&e.jsxs("div",{className:"bg-slate-50 border border-slate-200/80 rounded-2xl p-5 shadow-3xs text-left",children:[e.jsxs("h3",{className:"text-sm font-bold text-slate-800 flex items-center gap-1.5 mb-4 select-none",children:[e.jsx(Q,{size:16,className:"text-pink-650"}),t?"我的平时学习得分":"My Score & Feedback"]}),h?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-white border border-slate-200 p-4 rounded-xl flex items-center justify-between shadow-3xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-slate-400 font-bold uppercase tracking-wider",children:t?"学期对接总分":"Weighted Final Grade"}),e.jsxs("h2",{className:"text-3xl font-extrabold text-indigo-700 font-mono mt-1",children:[h.calculated_final_score," ",e.jsx("span",{className:"text-xs text-slate-455 font-normal",children:"/ 100"})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("span",{className:`inline-block px-2.5 py-1 text-[10px] font-bold rounded-lg border ${h.status==="confirmed"?"bg-emerald-50 text-emerald-700 border-emerald-100":"bg-amber-50 text-amber-700 border-amber-100"}`,children:h.status==="confirmed"?t?"已确认同步":"Synced":t?"教师评分草稿":"Draft"}),e.jsx("p",{className:"text-[9px] text-slate-400 mt-1.5 font-medium",children:t?`教师分 ${h.teacher_score} (占 ${(h.teacher_weight*100).toFixed(0)}%)`:`Teacher ${h.teacher_score} (${(h.teacher_weight*100).toFixed(0)}%)`}),e.jsx("p",{className:"text-[9px] text-slate-400 mt-0.5 font-medium",children:t?`学生互评 (占 ${(h.peer_weight*100).toFixed(0)}%)`:`Peer Review (${(h.peer_weight*100).toFixed(0)}%)`})]})]}),h.teacher_comment&&e.jsxs("div",{className:"bg-slate-100/60 p-3 rounded-lg border border-slate-200 flex gap-2",children:[e.jsx(X,{size:14,className:"text-slate-400 shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-500",children:t?"教师寄语":"Teacher Comments"}),e.jsx("p",{className:"text-xs text-slate-650 mt-0.5",children:h.teacher_comment})]})]})]}):e.jsx("div",{className:"bg-white border border-slate-150 p-4 rounded-xl flex items-center justify-center text-slate-400 italic text-xs py-8",children:t?"教师尚未确认最终成绩与权重折算。":"Teacher grading is in progress."})]})]}),e.jsxs("div",{className:"flex-grow bg-slate-50 border border-slate-200/80 rounded-2xl p-5 shadow-3xs flex flex-col min-h-[400px] text-left",children:[e.jsxs("h3",{className:"text-sm font-bold text-slate-800 flex items-center gap-1.5 mb-4 shrink-0 select-none",children:[e.jsx(Z,{size:16,className:"text-teal-650"}),t?"同学作业互评公开板":"Classmate Submissions for Peer Review"]}),V.length===0?e.jsx("div",{className:"flex-grow flex items-center justify-center text-slate-400 italic text-xs py-12 border border-dashed border-slate-200 rounded-xl bg-white",children:t?"当前暂无同学提交作业作品。":"No classmate submissions available yet."}):e.jsx("div",{className:"flex-grow overflow-y-auto space-y-4 pr-1",children:V.map(s=>{const l=I.find(N=>N.submission_id===s.id),x=m[s.id]!==void 0?m[s.id]:l?l.score:85,T=L[s.id]!==void 0?L[s.id]:l?l.comment:"",b=E[s.id]||!1;return e.jsxs("div",{className:"bg-white border border-slate-200 rounded-xl p-4 shadow-3xs flex flex-col gap-3",children:[e.jsxs("div",{className:"flex justify-between items-start border-b border-slate-100 pb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-indigo-50 text-indigo-700 flex items-center justify-center font-bold text-xs select-none",children:s.student_name?s.student_name[0]:"?"}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-bold text-slate-700",children:s.student_name||s.student_id}),e.jsxs("p",{className:"text-[10px] text-slate-400 font-mono flex items-center gap-1 mt-0.5 truncate max-w-[200px]",title:s.file_path,children:[e.jsx(ee,{size:11,className:"text-slate-350"}),s.file_path.split("/").pop()," (V",s.version,")"]})]})]}),e.jsx("a",{href:s.file_path,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] font-bold text-indigo-650 hover:text-indigo-800 transition-colors border border-indigo-100 px-2 py-1 rounded bg-indigo-50/50 hover:bg-indigo-50",children:t?"下载查阅":"Download File"})]}),l&&e.jsxs("div",{className:"bg-emerald-50/50 border border-emerald-100 p-2.5 rounded-lg flex items-start gap-2 text-xs text-emerald-800",children:[e.jsx(te,{className:"text-emerald-500 shrink-0 mt-0.5",size:14}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-bold flex items-center gap-1",children:t?`我已评分:${l.score} 分`:`My Score: ${l.score} pts`}),l.comment&&e.jsxs("p",{className:"text-[11px] text-emerald-700/80 mt-0.5 italic",children:['"',l.comment,'"']})]})]}),e.jsxs("div",{className:"bg-slate-50/60 border border-slate-100 rounded-lg p-3 space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-[10px] font-bold text-slate-500 uppercase tracking-wider",children:t?"滑动或输入互评分数":"Peer Rating"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("input",{type:"number",min:"0",max:"100",value:x,onChange:N=>{const _=Math.min(100,Math.max(0,parseInt(N.target.value)||0));P(F=>({...F,[s.id]:_}))},className:"w-12 text-center text-xs font-bold font-mono border border-slate-200 rounded px-1 py-0.5 bg-white text-indigo-750"}),e.jsx("span",{className:"text-[10px] text-slate-400 font-bold",children:t?"分":"pts"})]})]}),e.jsx("input",{type:"range",min:"0",max:"100",value:x,onChange:N=>{const _=parseInt(N.target.value);P(F=>({...F,[s.id]:_}))},className:"w-full h-1.5 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-indigo-650"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("textarea",{rows:1,value:T,onChange:N=>{R(_=>({..._,[s.id]:N.target.value}))},placeholder:t?"简要评语反馈...":"Brief feedback comment...",className:"flex-1 bg-white border border-slate-200 px-2 py-1 text-xs rounded-lg text-slate-700 focus:outline-none focus:border-indigo-400 resize-none transition-colors"}),e.jsxs("button",{onClick:()=>D(s.id,s.student_id),disabled:b,className:"bg-indigo-650 hover:bg-indigo-700 text-white font-bold text-xs px-3 rounded-lg transition-colors cursor-pointer disabled:opacity-50 flex items-center justify-center",children:[b?e.jsx(A,{className:"animate-spin",size:13}):e.jsx(se,{size:13}),e.jsx("span",{className:"ml-1 shrink-0",children:l?t?"修改评分":"Update":t?"确认提交":"Submit"})]})]})]})]},s.id)})})]})]})}function xe(u){const{studentLessonTab:i,setStudentLessonTab:g,isStudentLessonContentCollapsed:r,setIsStudentLessonContentCollapsed:S,lang:c,studentFullscreenPanel:o,setStudentFullscreenPanel:p,selectedLesson:d,elements:f,activeRole:C,activeSegmentId:j,setActiveSegmentId:v,fetchElements:k,currentVfsParent:z,setCurrentVfsParent:n,vfsNodes:m,studentSelectedCourseware:P,setStudentSelectedCourseware:L,activeStudentId:R,addToast:E}=u;return e.jsxs("div",{className:`${r||o==="right"?"w-full flex-grow":"flex-grow flex-1"} relative flex flex-col min-h-0 ${o==="left"?"hidden":""} transition-all duration-300`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>S(!r),className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-bold bg-indigo-50 text-indigo-700 rounded-lg hover:bg-indigo-100 transition-colors border border-indigo-100/80 cursor-pointer shadow-3xs",title:r?"展开课程内容":"折叠课程内容",children:[e.jsx(U,{size:13,className:"text-indigo-650"}),e.jsx("span",{children:r?c==="zh"?"展开课程内容":"Expand Content":c==="zh"?"折叠课程内容":"Collapse Content"})]}),e.jsx("button",{onClick:()=>g("whiteboard"),className:`px-3 py-1.5 text-xs font-medium rounded-md transition-colors cursor-pointer ${i==="whiteboard"?"bg-indigo-50 text-indigo-700 shadow-sm":"text-gray-500 hover:bg-gray-100"}`,children:"Interactive Whiteboard"}),e.jsx("button",{onClick:()=>g("courseware"),className:`px-3 py-1.5 text-xs font-medium rounded-md transition-colors cursor-pointer ${i==="courseware"?"bg-indigo-50 text-indigo-700 shadow-sm":"text-gray-500 hover:bg-gray-100"}`,children:"Interactive Courseware Viewer"}),e.jsx("button",{onClick:()=>g("assignment"),className:`px-3 py-1.5 text-xs font-medium rounded-md transition-colors cursor-pointer ${i==="assignment"?"bg-indigo-50 text-indigo-700 shadow-sm":"text-gray-500 hover:bg-gray-100"}`,children:c==="zh"?"作业提交与互评":"Assignments & Peer Reviews"})]}),e.jsx("button",{onClick:()=>p(a=>a==="right"?"none":"right"),className:"p-1 hover:bg-gray-100 text-gray-400 hover:text-gray-700 rounded transition-colors cursor-pointer flex items-center gap-1",title:o==="right"?"退出全屏":"全屏",children:o==="right"?e.jsxs(e.Fragment,{children:[e.jsx(G,{size:13}),e.jsx("span",{className:"text-[10px] font-medium",children:"退出全屏"})]}):e.jsxs(e.Fragment,{children:[e.jsx(H,{size:13}),e.jsx("span",{className:"text-[10px] font-medium",children:"全屏"})]})})]}),i==="whiteboard"&&e.jsx(ie,{lessonId:d,elements:f,userRole:C,activeSegmentId:j,onSegmentSync:a=>v(a),onElementUpdate:async()=>{},onElementDelete:async a=>{await fetch(`/api/lessons/${d}/whiteboard/${a}`,{method:"DELETE"}),k(d)},onClearBoard:async()=>{await fetch(`/api/lessons/${d}/whiteboard`,{method:"DELETE"}),k(d)},onElementAdd:async()=>{},onRefresh:()=>k(d)}),i==="courseware"&&e.jsxs("div",{className:"flex-1 flex gap-4 min-h-0",children:[e.jsxs("div",{className:"w-48 flex-shrink-0 bg-gray-50 border border-gray-200 rounded-lg p-3 flex flex-col min-h-0",children:[e.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 mb-2 border-b border-gray-200 pb-2",children:"Cloud Apps"}),e.jsxs("div",{className:"flex-1 overflow-y-auto space-y-1",children:[z!==null&&e.jsxs("button",{onClick:()=>n(null),className:"flex items-center gap-2 p-1.5 text-xs text-indigo-600 w-full hover:bg-gray-200 rounded mb-1 font-medium",children:[e.jsx(B,{className:"rotate-180",size:14})," Back to Root"]}),m.filter(a=>a.type==="dir").map(a=>e.jsxs("button",{onClick:()=>n(a.id),className:"w-full text-left p-1.5 rounded text-xs text-gray-700 hover:bg-gray-200 flex items-center gap-2 group truncate",title:a.name,children:[e.jsx(ae,{size:14,className:"text-indigo-400 shrink-0 group-hover:text-indigo-600"}),e.jsx("span",{className:"truncate",children:a.name})]},a.id)),m.filter(a=>a.type==="file"&&(a.name.endsWith(".html")||a.name.endsWith(".htm")||a.content?.includes("<html"))).length===0?e.jsx("div",{className:"text-xs text-center text-gray-400 italic py-4",children:"No interactive HTML apps found."}):m.filter(a=>a.type==="file"&&(a.name.endsWith(".html")||a.name.endsWith(".htm")||a.content?.includes("<html"))).map(a=>e.jsxs("button",{onClick:()=>L(a.id),className:`w-full text-left p-2 rounded text-xs flex items-center gap-2 truncate transition-colors ${P===a.id?"bg-indigo-100 text-indigo-700 font-medium":"text-gray-600 hover:bg-gray-100"}`,title:a.name,children:[e.jsx(ne,{size:14,className:"shrink-0"}),e.jsx("span",{className:"truncate",children:a.name})]},a.id))]}),e.jsx("div",{className:"mt-2 text-[10px] text-gray-400 leading-tight",children:"Note: Showing HTML courseware from current OS drive directory. Ask agent to generate courseware."})]}),e.jsx("div",{className:"flex-1 relative bg-white min-h-0",children:e.jsx(le,{coursewareId:P,onClose:()=>L(null)})})]}),i==="assignment"&&e.jsx(ce,{lessonId:d,studentId:R,lang:c,addToast:E})]})}function we(u){const{students:i,activeStudentId:g,setStudentViewStatus:r,setSelectedLesson:S,lessons:c,selectedLesson:o,studentFullscreenPanel:p,setStudentFullscreenPanel:d,timelineSegments:f,lang:C,activeSegmentId:j,setActiveSegmentId:v,localProgressPercent:k,setLocalProgressPercent:z,updateStudentProgress:n,isStudentLessonContentCollapsed:m,setIsStudentLessonContentCollapsed:P,studentLessonTab:L,setStudentLessonTab:R,elements:E,activeRole:a,fetchElements:t,currentVfsParent:$,setCurrentVfsParent:M,vfsNodes:D,studentSelectedCourseware:w,setStudentSelectedCourseware:h,addToast:I}=u;return e.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[e.jsx(oe,{students:i,activeStudentId:g,setStudentViewStatus:r,setSelectedLesson:S,lessons:c,selectedLesson:o}),e.jsxs("div",{className:"flex-1 flex gap-6 min-h-0 bg-white border border-gray-200 rounded-xl p-4 shadow-sm",children:[e.jsx(de,{students:i,activeStudentId:g,studentFullscreenPanel:p,setStudentFullscreenPanel:d,timelineSegments:f,lang:C,activeSegmentId:j,setActiveSegmentId:v,localProgressPercent:k,setLocalProgressPercent:z,updateStudentProgress:n,selectedLesson:o,lessons:c,isStudentLessonContentCollapsed:m}),e.jsx(xe,{studentLessonTab:L,setStudentLessonTab:R,isStudentLessonContentCollapsed:m,setIsStudentLessonContentCollapsed:P,lang:C,studentFullscreenPanel:p,setStudentFullscreenPanel:d,selectedLesson:o,elements:E,activeRole:a,activeSegmentId:j,setActiveSegmentId:v,fetchElements:t,currentVfsParent:$,setCurrentVfsParent:M,vfsNodes:D,studentSelectedCourseware:w,setStudentSelectedCourseware:h,activeStudentId:g,addToast:I})]})]})}export{we as StudentLessonView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./vendor-react-0Lg0vA-4.js";import{L as k}from"./LazyWhiteboard-B6rDWBFb.js";import{L as C}from"./LazyCourseware-g7b8EXR_.js";import{m as z,M as L}from"./index-D8x6bUeG.js";import{N as P,X as S,p as $,x as g,a8 as f,_ as E,a9 as T,h as F}from"./vendor-icons-_c3xpwjZ.js";import"./vendor-pdf-CVyNPGVr.js";import"./vendor-utils-4FcTwKPj.js";import"./vendor-motion-DjY2czvL.js";import"./vendor-charts-B7ViBL9w.js";function H(p){const{isLessonPreviewVisible:b,setIsLessonPreviewVisible:u,lessons:o,selectedLesson:s,previewFullscreenPanel:r,setPreviewFullscreenPanel:d,previewLessonTab:a,setPreviewLessonTab:c,activeRole:y,elements:w,activeSegmentId:j,setActiveSegmentId:v,fetchElements:i,currentVfsParent:N,setCurrentVfsParent:x,vfsNodes:l,previewSelectedCourseware:m,setPreviewSelectedCourseware:h}=p;return e.jsx(e.Fragment,{children:b&&e.jsx("div",{className:"fixed inset-0 bg-gray-900/60 backdrop-blur-sm flex items-center justify-center p-4 md:p-6 z-[60] overflow-hidden text-gray-850",children:e.jsxs(z.div,{initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},className:"bg-white border text-gray-900 border-gray-200 rounded-2xl shadow-2xl w-full max-w-7xl h-[90vh] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between bg-indigo-50/70 shrink-0 select-none",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"bg-indigo-600 text-white p-2 rounded-lg shadow-sm",children:e.jsx(P,{size:18})}),e.jsxs("div",{children:[e.jsx("h2",{className:"font-bold text-gray-900 text-base flex items-center gap-2",children:"学生视角预览 (Student Perspective Preview)"}),e.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["正在预览课程: ",e.jsx("span",{className:"font-semibold text-gray-700",children:o.find(t=>t.id===s)?.title})," • 演示同步与交互"]})]})]}),e.jsxs("button",{onClick:()=>u(!1),className:"px-3.5 py-1.5 bg-gray-100 hover:bg-gray-200 text-gray-600 hover:text-gray-800 text-xs font-semibold rounded-lg shadow-sm transition-all cursor-pointer flex items-center gap-1 border border-gray-200",children:[e.jsx(S,{size:14})," 退出预览"]})]}),e.jsxs("div",{className:"flex-1 flex min-h-0 bg-slate-50/50 p-4 gap-4",children:[e.jsxs("div",{className:`${r==="left"?"w-full":"w-1/3"} bg-white border border-gray-200 rounded-xl p-4 flex flex-col min-h-0 shadow-sm ${r==="right"?"hidden":""} transition-all duration-300`,children:[e.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-gray-400 mb-3 border-b border-gray-100 pb-2 flex items-center justify-between shrink-0 select-none",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx($,{size:14,className:"text-indigo-500"})," Lesson Content (课程内容)"]}),e.jsx("button",{onClick:()=>d(t=>t==="left"?"none":"left"),className:"p-1 hover:bg-gray-100 text-gray-400 hover:text-gray-700 rounded transition-colors cursor-pointer flex items-center gap-1",title:r==="left"?"退出全屏":"全屏",children:r==="left"?e.jsxs(e.Fragment,{children:[e.jsx(g,{size:13}),e.jsx("span",{className:"text-[10px] font-medium",children:"退出全屏"})]}):e.jsxs(e.Fragment,{children:[e.jsx(f,{size:13}),e.jsx("span",{className:"text-[10px] font-medium",children:"全屏"})]})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto prose prose-sm prose-indigo max-w-none text-gray-700 pr-1",children:e.jsx(L,{children:o.find(t=>t.id===s)?.content||""})})]}),e.jsxs("div",{className:`${r==="right"?"w-full flex-grow":"flex-1"} bg-white border border-gray-200 rounded-xl p-4 flex flex-col min-h-0 shadow-sm ${r==="left"?"hidden":""} transition-all duration-300`,children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-gray-100 pb-3 mb-3 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("button",{onClick:()=>c("whiteboard"),className:`px-3 py-1.5 text-xs font-semibold rounded-lg transition-all cursor-pointer ${a==="whiteboard"?"bg-indigo-600 text-white shadow-sm":"text-gray-500 hover:bg-gray-100"}`,children:"Interactive Whiteboard"}),e.jsx("button",{onClick:()=>c("courseware"),className:`px-3 py-1.5 text-xs font-semibold rounded-lg transition-all cursor-pointer ${a==="courseware"?"bg-indigo-600 text-white shadow-sm":"text-gray-500 hover:bg-gray-100"}`,children:"Cloud Apps Viewer"})]}),e.jsx("button",{onClick:()=>d(t=>t==="right"?"none":"right"),className:"p-1 hover:bg-gray-100 text-gray-400 hover:text-gray-700 rounded transition-colors cursor-pointer flex items-center gap-1",title:r==="right"?"退出全屏":"全屏",children:r==="right"?e.jsxs(e.Fragment,{children:[e.jsx(g,{size:13}),e.jsx("span",{className:"text-[10px] font-medium",children:"退出全屏"})]}):e.jsxs(e.Fragment,{children:[e.jsx(f,{size:13}),e.jsx("span",{className:"text-[10px] font-medium",children:"全屏"})]})})]}),e.jsx("div",{className:"flex-grow flex-1 min-h-0 flex flex-col h-full relative",children:a==="whiteboard"?e.jsx("div",{className:"flex-grow flex-1 min-h-0 w-full h-full relative rounded-lg overflow-hidden border border-gray-100 flex flex-col",children:e.jsx(k,{lessonId:s,userRole:y,elements:w,activeSegmentId:j,onSegmentSync:t=>v(t),onElementAdd:async(t,n)=>{await fetch(`/api/lessons/${s}/whiteboard`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:t,data:n})}),i(s)},onElementUpdate:async(t,n)=>{await fetch(`/api/lessons/${s}/whiteboard/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:n})}),i(s)},onElementDelete:async t=>{await fetch(`/api/lessons/${s}/whiteboard/${t}`,{method:"DELETE"}),i(s)},onClearBoard:async()=>{await fetch(`/api/lessons/${s}/whiteboard`,{method:"DELETE"}),i(s)},onRefresh:()=>i(s)})}):e.jsxs("div",{className:"flex-grow flex-1 flex gap-4 min-h-0 w-full h-full",children:[e.jsxs("div",{className:"w-52 flex-shrink-0 bg-gray-50 border border-gray-250/70 rounded-xl p-3 flex flex-col min-h-0 h-full animate-none",children:[e.jsx("h4",{className:"text-xs font-bold uppercase tracking-wider text-gray-550 mb-2 border-b border-gray-200 pb-2",children:"Cloud Apps"}),e.jsxs("div",{className:"flex-1 overflow-y-auto space-y-1",children:[N!==null&&e.jsxs("button",{onClick:()=>x(null),className:"flex items-center gap-1 p-1.5 text-xs text-indigo-600 w-full hover:bg-gray-255 hover:bg-gray-200 rounded-lg mb-1 font-semibold",children:[e.jsx(E,{className:"rotate-180",size:14})," Back to Root"]}),l.filter(t=>t.type==="dir").map(t=>e.jsxs("button",{onClick:()=>x(t.id),className:"w-full text-left p-1.5 rounded-lg text-xs text-gray-700 hover:bg-gray-250 hover:bg-gray-200 flex items-center gap-2 group truncate cursor-pointer font-medium",title:t.name,children:[e.jsx(T,{size:14,className:"text-indigo-400 shrink-0 group-hover:text-indigo-600"}),e.jsx("span",{className:"truncate",children:t.name})]},t.id)),l.filter(t=>t.type==="file"&&(t.name.endsWith(".html")||t.name.endsWith(".htm")||t.content?.includes("<html"))).length===0?e.jsx("div",{className:"text-xs text-center text-gray-400 italic py-4",children:"No interactive HTML apps found."}):l.filter(t=>t.type==="file"&&(t.name.endsWith(".html")||t.name.endsWith(".htm")||t.content?.includes("<html"))).map(t=>e.jsxs("button",{onClick:()=>h(t.id),className:`w-full text-left p-2 rounded-lg text-xs flex items-center gap-2 truncate transition-colors cursor-pointer font-medium ${m===t.id?"bg-indigo-100 text-indigo-700 font-semibold shadow-xs":"text-gray-600 hover:bg-gray-100"}`,title:t.name,children:[e.jsx(F,{size:14,className:"shrink-0 text-indigo-500"}),e.jsx("span",{className:"truncate",children:t.name})]},t.id))]}),e.jsx("div",{className:"mt-2 text-[10px] text-gray-400 leading-tight",children:"Note: Showing HTML courseware from current OS drive directory."})]}),e.jsx("div",{className:"flex-1 relative bg-white border border-gray-100 rounded-xl overflow-hidden min-h-0 h-full shadow-inner flex flex-col",children:e.jsx(C,{coursewareId:m,onClose:()=>h(null)})})]})})]})]})]})})})}export{H as StudentPreviewModal};
|