openlearn-next 0.7.13 → 0.7.16
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/README.md +1 -1
- package/cli-data.mjs +2 -2
- package/cli-doctor.mjs +2 -1
- package/dist/assets/{AcademicYearFilter-Dm3no4Nb.js → AcademicYearFilter-pCzZgimU.js} +1 -1
- package/dist/assets/ActivityWorkspaceWidget-KJQdLnvf.js +1 -0
- package/dist/assets/AdminDirectoryView-DDxX8RO2.js +5 -0
- package/dist/assets/AssessmentCenter-D5cVUqvy.js +1 -0
- package/dist/assets/{AssignmentFilePreview-7fHtUuUL.js → AssignmentFilePreview-DK29gdpQ.js} +2 -2
- package/dist/assets/BatchPickerModal-Cw4OZqOJ.js +1 -0
- package/dist/assets/ClassesView-Czx7hU2V.js +32 -0
- package/dist/assets/ClassroomCountdownWidget-BeAM37Cq.js +2 -0
- package/dist/assets/CloudDriveModal-GNZzWVCP.js +1 -0
- package/dist/assets/ComputerLabView-C_0c7sjz.js +1 -0
- package/dist/assets/CourseManagement-DzLB0Xmp.js +1 -0
- package/dist/assets/CourseWizardModal-DmQu237c.js +3 -0
- package/dist/assets/CoursewareHubPanel-Xn5WbXg9.js +1 -0
- package/dist/assets/Dashboard-CX83FUeF.js +8 -0
- package/dist/assets/ExportWeightModal-C0SuUhHM.js +1 -0
- package/dist/assets/HelpTour-D8hVFA6N.js +1 -0
- package/dist/assets/HelpView-C0PP_51D.js +204 -0
- package/dist/assets/ImportLessonsModal-p8Uc1U_h.js +1 -0
- package/dist/assets/{ImportModal-CYU3aMYY.js → ImportModal-DNaPHV0I.js} +2 -2
- package/dist/assets/InteractiveCoursewareViewer-D9YTgasv.js +1 -0
- package/dist/assets/InteractiveWhiteboard-CHYQfRjR.js +19 -0
- package/dist/assets/LazyCourseware-dtuOSiyR.js +2 -0
- package/dist/assets/LazyWhiteboard-DuBKAh4-.js +2 -0
- package/dist/assets/LessonEditorView-BgI7C_FK.js +1 -0
- package/dist/assets/LiveClassroomView-CJK_WMqD.js +67 -0
- package/dist/assets/NotificationDetailModal-BVYuS4uR.js +1 -0
- package/dist/assets/PluginView-CpWjy0Xf.js +66 -0
- package/dist/assets/ProcessLogsModal-D-Ez_YZA.js +1 -0
- package/dist/assets/QuizGeneratorModal-Lf5QMvkq.js +1 -0
- package/dist/assets/RevealPresentationWrapper-Dnf4v72i.js +48 -0
- package/dist/assets/StudentAssignmentEvalPanel-C-7YSfEQ.js +1 -0
- package/dist/assets/StudentAssignmentView-LuMaNpq8.js +1 -0
- package/dist/assets/StudentLessonView-DUG8I1Zy.js +1 -0
- package/dist/assets/StudentView-mMwGPiiF.js +2 -0
- package/dist/assets/SystemResourceLibraryModal-LUDNOwgW.js +1 -0
- package/dist/assets/TeacherView-ofB-3SEJ.js +2 -0
- package/dist/assets/TimetableView-DrZbyCOQ.js +6 -0
- package/dist/assets/{UTIF-u3Ct70K4.js → UTIF-DbcUtUKZ.js} +1 -1
- package/dist/assets/index-CG-g_9my.css +1 -0
- package/dist/assets/index-CLtQGl25.js +169 -0
- package/dist/assets/{index.es-CcQ2kcDj.js → index.es-D1mLdmCj.js} +1 -1
- package/dist/assets/keyboard-Rs007iOv.js +1 -0
- package/dist/assets/{pluginParsers-BN3lQ7PJ.js → pluginParsers-C46aCYkl.js} +1 -1
- package/dist/assets/student-workspace-BFPfR77J.js +1 -0
- package/dist/assets/{vendor-charts-skggaP9D.js → vendor-charts-CK-CU_m7.js} +1 -1
- package/dist/assets/{vendor-icons-CqLdl4B_.js → vendor-icons-__JLt-CP.js} +2 -2
- package/dist/assets/{vendor-konva-BOuJWFuE.js → vendor-konva-DGELdczq.js} +1 -1
- package/dist/assets/{vendor-motion-BFAPOs-b.js → vendor-motion-DtyD8eRQ.js} +1 -1
- package/dist/assets/{vendor-pdf-BMEc_Clb.js → vendor-pdf-DNexfcCO.js} +3 -3
- package/dist/assets/{vendor-pptx-C0qaOH5T.js → vendor-pptx-ByQkJ0Xi.js} +4 -4
- package/dist/assets/{vendor-react-DHoBZpn2.js → vendor-react-lfWn1oGs.js} +1 -1
- package/dist/assets/{vendor-utils-BxOuk3id.js → vendor-utils-CsoI4M9x.js} +1 -1
- package/dist/cli-migrator.cjs +23 -7
- package/dist/index.html +10 -6
- package/dist/server.cjs +11139 -4094
- package/docs_plugin_guide.md +1023 -0
- package/migrations/046_logout_clear_site_data.sql +9 -0
- package/migrations/047_third_party_theme_system.sql +55 -0
- package/migrations/048_file_storage_extension.sql +63 -0
- package/migrations/049_ai_personas.sql +25 -0
- package/migrations/050_ai_persona_governance.sql +11 -0
- package/migrations/051_community_registry_url.sql +9 -0
- package/migrations/052_community_install_enabled.sql +12 -0
- package/migrations/053_runtime_admin_policies.sql +28 -0
- package/migrations/054_user_onboarding_tour_status.sql +10 -0
- package/migrations/055_classroom_collab_whiteboard.sql +27 -0
- package/migrations/056_public_student_lookup.sql +9 -0
- package/migrations/README.md +59 -48
- package/migrations/schema-golden.json +98 -2
- package/package.json +7 -6
- package/scripts/assert-node-runtime.mjs +4 -3
- package/dist/assets/ActivityWorkspaceWidget-9DeXkxGk.js +0 -1
- package/dist/assets/AdminDirectoryView-5gupeGAR.js +0 -5
- package/dist/assets/AssessmentCenter-CPaqy0Xa.js +0 -1
- package/dist/assets/BatchPickerModal-0yIe1DXi.js +0 -1
- package/dist/assets/ClassesView-CGpoW0IC.js +0 -32
- package/dist/assets/ClassroomCountdownWidget-B_5--dn_.js +0 -2
- package/dist/assets/CloudDriveModal-4Ts5Duh5.js +0 -1
- package/dist/assets/ComputerLabView-DAEaKTBj.js +0 -1
- package/dist/assets/CourseManagement-CxIBH7lA.js +0 -1
- package/dist/assets/CourseWizardModal-R0xpa_Aw.js +0 -3
- package/dist/assets/CoursewareHubPanel-CpHptmSa.js +0 -1
- package/dist/assets/Dashboard-DeBfP_Nc.js +0 -8
- package/dist/assets/ExportWeightModal-DlnCOBlL.js +0 -1
- package/dist/assets/HelpTour-Cztpqw_J.js +0 -1
- package/dist/assets/HelpView-LPLAY9bq.js +0 -204
- package/dist/assets/ImportLessonsModal-BopEHmU_.js +0 -1
- package/dist/assets/InteractiveCoursewareViewer-CGc3P4HF.js +0 -1
- package/dist/assets/InteractiveWhiteboard-DiyHrIGn.js +0 -19
- package/dist/assets/LazyCourseware-Bj1jm0nC.js +0 -2
- package/dist/assets/LazyWhiteboard-NPD1EoyO.js +0 -2
- package/dist/assets/LessonEditorView-DqreBtFx.js +0 -1
- package/dist/assets/LiveClassroomView-eTc6Fb9g.js +0 -64
- package/dist/assets/NotificationDetailModal-B7G7ra9a.js +0 -1
- package/dist/assets/PluginView-DP6s-L70.js +0 -77
- package/dist/assets/ProcessLogsModal-Dq5C4s7j.js +0 -1
- package/dist/assets/QuizGeneratorModal-CoX9f8Wp.js +0 -1
- package/dist/assets/RevealPresentationWrapper-wwlcfNWB.js +0 -48
- package/dist/assets/StudentAssignmentEvalPanel-DHb-asHQ.js +0 -1
- package/dist/assets/StudentAssignmentView-AJpjQK3f.js +0 -1
- package/dist/assets/StudentLessonView-Djd1T1QF.js +0 -1
- package/dist/assets/StudentView-D41z7GY5.js +0 -2
- package/dist/assets/SystemResourceLibraryModal-CxmQh1HA.js +0 -1
- package/dist/assets/TeacherView-DqSWaNuI.js +0 -2
- package/dist/assets/TimetableView-DrFs_xgc.js +0 -6
- package/dist/assets/index-7CK1B0tE.js +0 -131
- package/dist/assets/index-BaGZmpr6.css +0 -1
- package/dist/assets/student-workspace-DkTkcAGK.js +0 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import{r as n,j as e,b as Ce}from"./vendor-react-lfWn1oGs.js";import{P as Pe,i as re,a as Se,t as le,k as Fe}from"./vendor-pptx-ByQkJ0Xi.js";import{bl as ne,j as ae,b1 as ie,o as oe,r as Te,B as Le,J as $e,f as de,ah as Me,af as ze,v as Ae,O as Re,aE as Ee,C as De}from"./vendor-icons-__JLt-CP.js";import{M as ce}from"./index-CLtQGl25.js";import"./vendor-utils-CsoI4M9x.js";import"./vendor-pdf-DNexfcCO.js";import"./vendor-charts-CK-CU_m7.js";import"./vendor-motion-DtyD8eRQ.js";let R=null;const Xe=10;async function Be(){if(R!=null)return R;try{const x=await fetch("/api/site-settings");if(x.ok){const l=await x.json();typeof l.uploadMaxFileMb=="number"&&l.uploadMaxFileMb>0&&(R=l.uploadMaxFileMb)}}catch{}return R??Xe}const Ie={hiddenPanels:["inspector"]},Oe=[{code:"en",label:"English",nativeLabel:"English"},{code:"fr",label:"French",nativeLabel:"Français"},{code:"es",label:"Spanish",nativeLabel:"Español"},{code:"de",label:"German",nativeLabel:"Deutsch"},{code:"zh-CN",label:"Chinese (Simplified)",nativeLabel:"简体中文"}];re.isInitialized||re.use(Se).init({resources:{en:{translation:le},"zh-CN":{translation:le}},lng:"zh-CN",fallbackLng:"en",keySeparator:!1,nsSeparator:!1,interpolation:{escapeValue:!1},parseMissingKeyHandler:x=>Fe(x)});function Ze({elementId:x,data:l,userRole:H="teacher",onElementUpdate:o}){const[p,M]=n.useState("ppt"),[T,W]=n.useState(l.markdown||`# Title Slide
|
|
2
|
+
---
|
|
3
|
+
## Slide 2`),[r,y]=n.useState(l.slideX||0),v=n.useRef(r),w=n.useRef(null),L=n.useRef(l);L.current=l;const E=n.useRef(o);E.current=o;const[j,D]=n.useState(!1),[X,xe]=n.useState(4),[B,ue]=n.useState(!1),K=n.useRef(null),g=H==="teacher",d=H==="student",f=l.fileUrl||"",a=l.fileType||"md",N=l.fileName||"",U=!!f,[fe,J]=n.useState(!1),q=n.useRef(null),[G,I]=n.useState(null),[pe,k]=n.useState(!1),[Z,$]=n.useState(null),Q=n.useRef(null),Y=n.useRef(null),u=!!l.isFullscreenSynced,m=!!l.isFullscreenForced,i=B||d&&u&&m,C=T.split(/(?:\r?\n|^)---(?:\r?\n|$)/).map(t=>t.trim()).filter(t=>t.length>0),h=a==="md"?Math.max(1,C.length):l.slideCount||1;n.useEffect(()=>{a!=="md"&&p!=="ppt"&&M("ppt")},[a,p]),n.useEffect(()=>{l.slideX!==void 0&&l.slideX!==v.current&&(v.current=l.slideX,w.current=null,y(l.slideX))},[l.slideX]),n.useEffect(()=>{w.current=null},[f,a,i]),n.useEffect(()=>{l.markdown!==void 0&&l.markdown!==T&&W(l.markdown)},[l.markdown]);const me=t=>(k(!0),$(null),fetch(t).then(s=>{if(!s.ok)throw new Error(`无法获取课件文件 (HTTP ${s.status})`);return s.arrayBuffer()}).then(s=>{I(new Uint8Array(s)),k(!1)}).catch(s=>{console.error("[RevealPresentationWrapper] Fetch PPTX failed:",s),$(s.message||"课件文件加载失败"),k(!1)}));n.useEffect(()=>{if(a!=="pptx"||!f){I(null),k(!1),$(null);return}let t=!0;return k(!0),$(null),fetch(f).then(s=>{if(!s.ok)throw new Error(`无法获取课件文件 (HTTP ${s.status})`);return s.arrayBuffer()}).then(s=>{t&&(I(new Uint8Array(s)),k(!1))}).catch(s=>{t&&(console.error("[RevealPresentationWrapper] Fetch PPTX failed:",s),$(s.message||"课件文件加载失败"),k(!1))}),()=>{t=!1}},[f,a]),n.useEffect(()=>{if(a==="pptx"){const t=i?Y.current:Q.current;if(t)try{const s=t.getActiveSlideIndex?.();s!==void 0&&(s===r?w.current===r&&(w.current=null):t.setActiveSlideIndex?.(r))}catch(s){console.warn("[RevealPresentationWrapper] Failed to sync PPTX slide index:",s)}}},[r,a,i]);const he=n.useCallback(t=>{const s=w.current;if(s!==null){if(t!==s)return;w.current=null}if(t===v.current)return;v.current=t,y(t);const c=E.current;g&&c&&c(x,{...L.current,slideX:t})},[g,x]),be=n.useCallback(t=>{const s=E.current;t>0&&g&&s&&L.current.slideCount!==t&&s(x,{...L.current,slideCount:t})},[g,x]),ee=t=>pe?e.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center text-slate-500 gap-3 bg-slate-50 rounded-xl",children:[e.jsx(de,{className:"w-8 h-8 animate-spin text-indigo-600"}),e.jsx("span",{className:"text-sm font-medium",children:"正在解析 PPTX 课件..."})]}):Z?e.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center text-rose-500 gap-2 p-6 text-center bg-slate-50 rounded-xl",children:[e.jsx(De,{className:"w-8 h-8"}),e.jsx("p",{className:"text-sm font-medium",children:Z}),e.jsx("button",{onClick:()=>{f&&me(f)},className:"mt-2 px-3 py-1 text-xs bg-white border border-slate-200 hover:bg-slate-100 text-slate-700 rounded-md shadow-sm transition-colors",children:"重试加载"})]}):G?e.jsx("div",{className:"w-full h-full overflow-hidden rounded-xl bg-white border border-slate-100 shadow-md",children:e.jsx(Pe,{ref:t?Y:Q,content:G,fileName:N||"课件演示.pptx",canEdit:!1,showToolbar:!1,showThumbnails:t,showCompatibilityToasts:!1,customization:Ie,initialSlide:r,defaultLocale:"zh-CN",availableLocales:Oe,onActiveSlideChange:he,onSlideCountChange:be,className:"w-full h-full"},`${f}-${t?"fs":"card"}`)}):e.jsx("div",{className:"w-full h-full flex items-center justify-center text-slate-400 text-sm bg-slate-50 rounded-xl",children:"课件内容未就绪"});n.useEffect(()=>{if(!j||p!=="ppt"||a!=="md")return;const t=setInterval(()=>{y(s=>{const c=(s+1)%Math.max(1,C.length);return v.current=c,o&&o(x,{...L.current,slideX:c}),c})},X*1e3);return()=>clearInterval(t)},[j,X,C.length,p,a]),n.useEffect(()=>{const t=s=>{d&&u&&m||(s.key==="ArrowRight"||s.key===" "?(s.preventDefault(),P(r+1)):s.key==="ArrowLeft"?(s.preventDefault(),P(r-1)):s.key==="Escape"&&i&&(s.preventDefault(),z(!1)))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[r,i,d,u,m,h]);const P=t=>{if(d&&u&&m)return;const s=Math.min(Math.max(0,t),h-1);v.current=s,a==="pptx"&&(w.current=s),y(s),g&&o&&o(x,{...l,slideX:s})},te=t=>{W(t),o&&o(x,{...l,markdown:t})},ge=async t=>{const s=t.target.files?.[0];if(!s)return;const c=s.name.split(".").pop()?.toLowerCase();if(c!=="pdf"&&c!=="pptx"){alert("仅支持上传 PDF 或 PPTX 格式的课件文件!");return}J(!0);try{const b=await Be();if(s.size>b*1024*1024){alert(`课件文件超过 ${b}MB 上限,请压缩后再上传(上限可在管理后台 → 站点设置调整)。`);return}const _=(await new Promise((Ne,ye)=>{const V=new FileReader;V.onload=ke=>Ne(ke.target?.result??""),V.onerror=()=>ye(new Error("本地文件读取失败")),V.readAsDataURL(s)})).split(",")[1],F=await fetch("/api/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:s.name,base64Data:_})}),A=await F.json().catch(()=>({}));if(!F.ok)throw F.status===413?new Error("课件文件过大,超过服务器上传上限(10MB)。"):new Error(A.error||`上传失败(HTTP ${F.status})`);o&&(await o(x,{...l,fileUrl:A.fileUrl,fileName:s.name,fileType:A.fileType,slideX:0,slideCount:A.slideCount||1,isFullscreenSynced:l.isFullscreenSynced!==void 0?l.isFullscreenSynced:!0,isFullscreenForced:!1}),v.current=0,w.current=null,y(0))}catch(b){console.error("[RevealPresentation] upload failed:",b),alert(b?.message||"课件文件上传失败,请重试")}finally{J(!1)}},we=()=>{window.confirm("确定要清除已上传的课件并恢复为 Markdown 编辑模式吗?")&&o&&(o(x,{...l,fileUrl:"",fileName:"",fileType:"md",slideX:0,slideCount:0,isFullscreenForced:!1}),v.current=0,w.current=null,y(0))},z=t=>{ue(t),g&&o&&o(x,{...l,isFullscreenForced:t})},O=t=>{o&&o(x,{...l,isFullscreenSynced:t,isFullscreenForced:t?B:!1})},je=[{name:"基础通用课件",desc:"标准的课件 structure",content:`# 物理学原理与探究
|
|
4
|
+
---
|
|
5
|
+
## 课程介绍
|
|
6
|
+
1. 经典力学基础
|
|
7
|
+
2. 能量守恒定律
|
|
8
|
+
3. 万有引力应用
|
|
9
|
+
---
|
|
10
|
+
## 科学探究要素
|
|
11
|
+
- 观察与提问
|
|
12
|
+
- 制定计划与设计实验
|
|
13
|
+
- 进行实验与收集证据
|
|
14
|
+
- 交流、评估及得出结论
|
|
15
|
+
---
|
|
16
|
+
## 物理课后思考一
|
|
17
|
+
> 牛顿第一定律是否可以在地球上直接通过实验完全验证?请结合摩擦力阐述。`},{name:"英语词汇互动",desc:"交互式英文闪卡",content:`# Topic: Smart Education
|
|
18
|
+
---
|
|
19
|
+
## Key Vocabulary
|
|
20
|
+
- **Orchestration**: Arrangement or cooperation of system systems.
|
|
21
|
+
- **Heuristic**: Practical method not guaranteed to be perfect.
|
|
22
|
+
- **Applet**: Lightweight interactive program.
|
|
23
|
+
---
|
|
24
|
+
## Reading Passage
|
|
25
|
+
Modern class orchestration allows instructors to dispatch customized applets directly onto the virtual desk interfaces of student endpoints instantly!
|
|
26
|
+
---
|
|
27
|
+
## Fill in the Blank
|
|
28
|
+
The teacher used the virtual whiteboard to ___ classroom active learning slides.
|
|
29
|
+
*(Answer: orchestrate)*`},{name:"微课探究文档",desc:"一页式大纲微课",content:`# 探究牛顿第三定律
|
|
30
|
+
在本节微课中,我们将探讨作用力与反作用力的核心性质。
|
|
31
|
+
|
|
32
|
+
## 概念要点
|
|
33
|
+
- 作用力与反作用力**大小相等**
|
|
34
|
+
- 作用力与反作用力**方向相反**
|
|
35
|
+
- 作用力与反作用力作用在**不同的物体上**
|
|
36
|
+
- 它们伴随发生,同时消失。
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 经典实验设计
|
|
41
|
+
1. 准备两个完全相同的弹簧测力计 A 与 B。
|
|
42
|
+
2. 将它们对拉,观察两者的示数变化。
|
|
43
|
+
3. 会发现:不管拉力如何变化,A 的读数总是等于 B 的读数。
|
|
44
|
+
|
|
45
|
+
## 问题思考
|
|
46
|
+
当马拉着车在水平路面上加速前进时,马拉车的力与车拉马的力,哪一个更大?`}],se=(()=>{const t=T.split(`
|
|
47
|
+
`),s=[];return t.forEach((c,b)=>{const S=c.match(/^(#{1,3})\s+(.*)$/);S&&s.push({text:S[2].trim(),level:S[1].length,lineIndex:b})}),s})();if(a==="file"&&U){const t=(N.split(".").pop()||"file").toLowerCase();return e.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center gap-3 p-5 bg-gradient-to-br from-slate-50 to-white border border-slate-200 rounded-xl","data-testid":"course-package-file-card",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-indigo-50 border border-indigo-100 flex items-center justify-center",children:e.jsx(ne,{size:22,className:"text-indigo-600"})}),e.jsxs("div",{className:"text-center max-w-full",children:[e.jsx("p",{className:"text-sm font-bold text-slate-800 truncate",title:N||f,children:N||"课程附件"}),e.jsx("p",{className:"text-[11px] text-slate-400 mt-0.5 font-mono uppercase",children:t})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("a",{href:f,download:N||void 0,"data-testid":"course-package-file-download",className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-bold text-white bg-indigo-600 hover:bg-indigo-700 rounded-lg transition-colors",onClick:s=>s.stopPropagation(),children:[e.jsx(ne,{size:13}),"下载附件"]}),g&&o&&e.jsx("button",{onClick:s=>{s.stopPropagation(),window.confirm("确定要移除此附件引用吗?(不会删除已上传的文件)")&&o(x,{...l,fileUrl:"",fileName:"",fileType:"md",slideCount:0})},"data-testid":"course-package-file-clear",className:"px-3 py-1.5 text-xs font-bold text-slate-600 bg-white border border-slate-200 hover:bg-slate-50 rounded-lg transition-colors",children:"移除引用"})]}),e.jsx("p",{className:"text-[10px] text-slate-400 text-center leading-relaxed max-w-[240px]",children:"该类型没有白板内联渲染器,以附件形式提供下载。"})]})}if(i&&typeof document<"u")return e.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center bg-slate-900/10 text-slate-400 font-sans p-4",children:[e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(ae,{size:24,className:"text-indigo-500 animate-pulse"}),e.jsx("span",{className:"text-xs",children:"演示文稿正在全屏放映中"})]}),Ce.createPortal(e.jsxs("div",{className:"fixed inset-0 z-[99999] bg-neutral-950 flex flex-col items-center justify-center font-sans p-6",children:[e.jsxs("div",{className:"absolute top-4 left-4 right-4 flex items-center justify-between text-white/80 select-none z-[100001] px-4 py-2 bg-neutral-900/60 backdrop-blur-md rounded-xl border border-neutral-800",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-emerald-500 animate-pulse"}),e.jsxs("span",{className:"font-bold text-xs tracking-wider uppercase",children:[a==="md"?"Markdown Slides":`${a.toUpperCase()} Presentation`," ",d&&"(Synced)"]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{className:"text-xs font-mono text-white/50",children:["Slide ",r+1," / ",h]}),g&&e.jsxs(e.Fragment,{children:[a==="md"&&e.jsx("button",{onClick:()=>D(t=>!t),className:`px-2.5 py-1 rounded-md text-xs uppercase font-bold tracking-wider transition-colors border cursor-pointer ${j?"bg-emerald-50 border-emerald-400 text-white animate-pulse":"bg-transparent border-neutral-700 text-neutral-400 hover:bg-neutral-850"}`,children:j?"Autoplay Live":"Autoplay"}),e.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-white/70 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:u,onChange:t=>O(t.target.checked),className:"rounded border-neutral-700 bg-neutral-800 text-indigo-500 focus:ring-0 focus:ring-offset-0 cursor-pointer"}),e.jsx("span",{children:"同步学生全屏"})]})]}),(!d||!m||!u||B)&&e.jsx("button",{onClick:()=>z(!1),className:"p-1 px-2.5 bg-red-600 text-white text-xs font-bold rounded-lg transition-colors cursor-pointer border-0 hover:bg-red-700",title:"退出放映",children:"退出放映 (Esc)"})]})]}),e.jsx("div",{className:"w-full flex-1 min-h-0 flex items-center justify-center relative",children:a==="pdf"?e.jsx("div",{className:"w-full h-full flex items-center justify-center p-2 bg-slate-100 max-w-[90vw] max-h-[82vh] aspect-video rounded-2xl overflow-hidden shadow-2xl border border-neutral-850",children:e.jsx("iframe",{title:N||"Presentation PDF fullscreen preview",src:`${f}#page=${r+1}&toolbar=0&navpanes=0`,className:"w-full h-full border-0 rounded-xl"},`${f}-fs-${r}`)}):a==="pptx"?e.jsx("div",{className:"w-full h-full flex items-center justify-center p-2 bg-slate-900/5 max-w-[90vw] max-h-[82vh] aspect-video rounded-2xl overflow-hidden shadow-2xl border border-neutral-850",children:ee(!0)}):e.jsx("div",{className:"flex-1 w-full flex items-center justify-center max-w-[90vw] min-h-0",children:e.jsxs("div",{className:"w-full bg-white rounded-xl shadow-md border border-slate-100 flex flex-col overflow-y-auto p-6 md:p-8 aspect-video relative transition-all duration-300 hover:shadow-lg max-h-[82vh] max-w-none p-12 md:p-16 border-neutral-850 rounded-3xl shadow-2xl",children:[e.jsxs("div",{className:"flex justify-between items-center text-xs font-semibold text-slate-400 border-b border-slate-100 pb-2 mb-4 shrink-0",children:[e.jsx("span",{className:"tracking-wide uppercase text-indigo-650",children:"SMART CLASS SLIDE DECK"}),e.jsxs("span",{className:"font-mono",children:["SLIDE ",r+1," / ",h]})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto pr-1",children:e.jsx("div",{className:"markdown-body text-slate-800 leading-relaxed font-sans prose prose-neutral max-w-none text-xs",children:C[r]?e.jsx(ce,{children:C[r]}):e.jsx("div",{className:"text-center text-slate-400 italic py-8",children:"幻灯片没有内容,请在“编辑文档”中添加。"})})}),e.jsxs("div",{className:"mt-4 pt-2 border-t border-slate-50 flex items-center justify-between text-xs text-slate-400 shrink-0 font-sans",children:[e.jsx("span",{children:"智慧互动教室白板演示系统"}),e.jsxs("span",{children:["Page ",r+1]})]})]})})}),!(d&&u&&m)&&e.jsxs("div",{className:"absolute bottom-6 bg-neutral-900/80 backdrop-blur-md px-6 py-2.5 rounded-full border border-neutral-800 shadow-2xl z-[100001]",children:[e.jsx("button",{disabled:r===0||d,onClick:()=>P(r-1),className:`p-1.5 rounded-full border transition-colors cursor-pointer ${r===0||d?"border-neutral-800 text-neutral-600 bg-neutral-950/20 cursor-not-allowed":"border-neutral-700 text-neutral-300 hover:bg-neutral-800"}`,title:"上一张 (ArrowLeft)",children:e.jsx(ie,{size:18})}),e.jsxs("div",{className:"flex items-center gap-1.5 px-1 font-mono text-xs text-neutral-200",children:[e.jsx("span",{className:"font-bold text-white text-base",children:r+1}),e.jsx("span",{className:"text-neutral-600",children:"/"}),e.jsx("span",{children:h})]}),e.jsx("button",{disabled:r>=h-1||d,onClick:()=>P(r+1),className:`p-1.5 rounded-full border transition-colors cursor-pointer ${r>=h-1||d?"border-neutral-800 text-neutral-600 bg-neutral-950/20 cursor-not-allowed":"border-neutral-700 text-neutral-300 hover:bg-neutral-800"}`,title:"下一张 (ArrowRight)",children:e.jsx(oe,{size:18})})]})]}),document.body)]});const ve=i?"fixed inset-0 z-[99999] bg-neutral-950 flex flex-col items-center justify-center font-sans p-6":"flex-1 flex flex-col items-center justify-between p-4 bg-slate-900/5 relative min-w-0";return e.jsxs("div",{className:"w-full h-full flex flex-col bg-slate-50 text-slate-800 overflow-hidden text-xs relative font-sans",children:[!i&&e.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-slate-100 border-b border-slate-200 shrink-0 select-none relative z-10",children:[e.jsx("div",{className:"flex items-center gap-1",children:a==="md"?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>M("ppt"),className:`px-2 py-1 rounded flex items-center gap-1 font-medium transition-colors cursor-pointer ${p==="ppt"?"bg-indigo-600 text-white shadow-sm":"text-slate-600 hover:bg-slate-200"}`,title:"播放课件幻灯片 (PPT Mode)",children:[e.jsx(Te,{size:11}),e.jsx("span",{children:"PPT 播放"})]}),e.jsxs("button",{onClick:()=>M("doc"),className:`px-2 py-1 rounded flex items-center gap-1 font-medium transition-colors cursor-pointer ${p==="doc"?"bg-indigo-600 text-white shadow-sm":"text-slate-600 hover:bg-slate-200"}`,title:"以精美文档形式阅读 (Markdown Document mode)",children:[e.jsx(Le,{size:11}),e.jsx("span",{children:"文档阅读"})]}),e.jsxs("button",{onClick:()=>M("edit"),className:`px-2 py-1 rounded flex items-center gap-1 font-medium transition-colors cursor-pointer ${p==="edit"?"bg-indigo-600 text-white shadow-sm":"text-slate-600 hover:bg-slate-200"}`,title:"在线编辑 Markdown 内容",children:[e.jsx($e,{size:11}),e.jsx("span",{children:"编辑文档"})]})]}):e.jsxs("div",{className:"flex items-center gap-1 bg-indigo-50 border border-indigo-200/50 text-indigo-700 px-2 py-0.5 rounded text-xs font-semibold",children:[e.jsx(ae,{size:10}),e.jsxs("span",{children:[a.toUpperCase()," 课件演示中"]})]})}),e.jsxs("div",{className:"flex items-center gap-3",children:[g&&e.jsx("div",{className:"flex items-center gap-1.5 border-r border-slate-200 pr-3",children:fe?e.jsxs("div",{className:"flex items-center gap-1 text-xs text-slate-500 font-medium",children:[e.jsx(de,{size:10,className:"animate-spin"}),e.jsx("span",{children:"上传解析中..."})]}):U?e.jsxs("div",{className:"flex items-center gap-1.5 bg-slate-200/50 pl-2 pr-1.5 py-0.5 rounded border border-slate-300/30",children:[e.jsx("span",{className:"text-xs font-medium text-slate-600 max-w-[120px] truncate font-mono",title:N,children:N}),e.jsx("button",{onClick:we,className:"p-0.5 hover:bg-slate-300 rounded text-red-500 cursor-pointer border-0 bg-transparent",title:"清除并切换回 Markdown",children:e.jsx(Me,{size:10})})]}):e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>q.current?.click(),className:"px-2 py-1 rounded bg-indigo-50 border border-indigo-200 text-indigo-700 hover:bg-indigo-100 flex items-center gap-1 font-semibold text-xs cursor-pointer",title:"上传 PPTX 或 PDF 课件",children:[e.jsx(ze,{size:10}),e.jsx("span",{children:"上传课件"})]}),e.jsx("input",{type:"file",ref:q,onChange:ge,accept:".pdf,.pptx",className:"hidden"})]})}),p==="ppt"&&a==="md"&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("button",{onClick:()=>D(t=>!t),className:`p-1 rounded flex items-center gap-1 font-semibold text-xs transition-colors border cursor-pointer ${j?"bg-emerald-50 border-emerald-300 text-emerald-700":"bg-white border-slate-200 text-slate-500 hover:bg-slate-50"}`,title:"开启/关闭幻灯片自动播放",children:[j?e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500 animate-ping"}):null,e.jsx("span",{children:j?"自动播放中":"自动播放"})]}),j&&e.jsxs("select",{value:X,onChange:t=>xe(Number(t.target.value)),className:"bg-white border border-slate-200 rounded px-1 text-xs py-0.5 text-slate-700 font-medium",children:[e.jsx("option",{value:2,children:"2秒"}),e.jsx("option",{value:4,children:"4秒"}),e.jsx("option",{value:6,children:"6秒"}),e.jsx("option",{value:10,children:"10秒"})]})]}),g&&p==="ppt"&&e.jsxs("label",{className:"flex items-center gap-1 text-xs text-slate-500 font-medium cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:u,onChange:t=>O(t.target.checked),className:"rounded border-slate-300 text-indigo-650 focus:ring-0 focus:ring-offset-0 cursor-pointer"}),e.jsx("span",{children:"同步学生全屏"})]}),p==="ppt"&&(!d||!(u&&m))&&e.jsx("button",{onClick:()=>z(!0),className:"p-1 rounded-lg text-slate-655 hover:bg-slate-200 border border-slate-200 bg-white transition-colors cursor-pointer",title:"全屏放映",children:e.jsx(Ae,{size:11})})]})]}),e.jsxs("div",{className:"flex-1 min-h-0 relative flex flex-row overflow-hidden",children:[p==="ppt"&&e.jsxs("div",{className:ve,children:[i&&e.jsxs("div",{className:"absolute top-4 left-4 right-4 flex items-center justify-between text-white/80 select-none z-[100001] px-4 py-2 bg-neutral-900/60 backdrop-blur-md rounded-xl border border-neutral-800",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-emerald-500 animate-pulse"}),e.jsxs("span",{className:"font-bold text-xs tracking-wider uppercase",children:[a==="md"?"Markdown Slides":`${a.toUpperCase()} Presentation`," ",d&&"(Synced)"]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{className:"text-xs font-mono text-white/50",children:["Slide ",r+1," / ",h]}),g&&e.jsxs(e.Fragment,{children:[a==="md"&&e.jsx("button",{onClick:()=>D(t=>!t),className:`px-2.5 py-1 rounded-md text-xs uppercase font-bold tracking-wider transition-colors border cursor-pointer ${j?"bg-emerald-50 border-emerald-400 text-white animate-pulse":"bg-transparent border-neutral-700 text-neutral-400 hover:bg-neutral-850"}`,children:j?"Autoplay Live":"Autoplay"}),e.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-white/70 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:u,onChange:t=>O(t.target.checked),className:"rounded border-neutral-700 bg-neutral-800 text-indigo-500 focus:ring-0 focus:ring-offset-0 cursor-pointer"}),e.jsx("span",{children:"同步学生全屏"})]}),e.jsx("button",{onClick:()=>z(!1),className:"p-1 px-2.5 bg-red-655 text-white text-xs font-bold rounded-md transition-colors cursor-pointer border-0",title:"退出放映",children:"退出放映 (Esc)"})]})]})]}),e.jsx("div",{className:"w-full flex-1 min-h-0 flex items-center justify-center relative",children:a==="pdf"?e.jsx("div",{className:`w-full h-full flex items-center justify-center p-2 bg-slate-100 ${i?"max-w-5xl aspect-video rounded-2xl overflow-hidden shadow-2xl border border-neutral-850":""}`,children:e.jsx("iframe",{title:N||"Presentation PDF slide preview",src:`${f}#page=${r+1}&toolbar=0&navpanes=0`,className:"w-full h-full border-0 rounded-xl"},`${f}-${i?"fs":"card"}-${r}`)}):a==="pptx"?e.jsx("div",{className:`w-full h-full flex items-center justify-center p-2 bg-slate-900/5 ${i?"max-w-5xl aspect-video rounded-2xl overflow-hidden shadow-2xl border border-neutral-850":""}`,children:ee(!1)}):e.jsx("div",{className:"flex-1 w-full flex items-center justify-center max-w-2xl min-h-0",children:e.jsxs("div",{className:`w-full bg-white rounded-xl shadow-md border border-slate-100 flex flex-col overflow-y-auto p-6 md:p-8 aspect-video relative transition-all duration-300 hover:shadow-lg max-h-full ${i?"max-w-4xl p-12 md:p-16 border-neutral-850 rounded-3xl shadow-2xl":""}`,children:[e.jsxs("div",{className:"flex justify-between items-center text-xs font-semibold text-slate-400 border-b border-slate-100 pb-2 mb-4 shrink-0",children:[e.jsx("span",{className:"tracking-wide uppercase text-indigo-650",children:"SMART CLASS SLIDE DECK"}),e.jsxs("span",{className:"font-mono",children:["SLIDE ",r+1," / ",h]})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto pr-1",children:e.jsx("div",{className:"markdown-body text-slate-800 leading-relaxed font-sans prose prose-neutral max-w-none text-xs",children:C[r]?e.jsx(ce,{children:C[r]}):e.jsx("div",{className:"text-center text-slate-400 italic py-8",children:"幻灯片没有内容,请在“编辑文档”中添加。"})})}),e.jsxs("div",{className:"mt-4 pt-2 border-t border-slate-50 flex items-center justify-between text-xs text-slate-400 shrink-0 font-sans",children:[e.jsx("span",{children:"智慧互动教室白板演示系统"}),e.jsxs("span",{children:["Page ",r+1]})]})]})})}),!(d&&u&&m)&&e.jsxs("div",{className:`mt-4 flex items-center justify-center gap-3 select-none shrink-0 ${i?"absolute bottom-6 bg-neutral-900/80 backdrop-blur-md px-6 py-2.5 rounded-full border border-neutral-800 shadow-2xl z-[100001]":"bg-white px-4 py-2 rounded-full border border-slate-200/80 shadow-md relative z-10"}`,children:[e.jsx("button",{disabled:r===0||d&&u&&m,onClick:()=>P(r-1),className:`p-1.5 rounded-full border transition-colors cursor-pointer ${r===0||d&&u&&m?i?"border-neutral-800 text-neutral-600 bg-neutral-950/20 cursor-not-allowed":"border-slate-100 bg-slate-50 text-slate-300 cursor-not-allowed":i?"border-neutral-700 text-neutral-300 hover:bg-neutral-800":"border-slate-205 text-slate-655 hover:bg-slate-50"}`,title:"上一张 (ArrowLeft)",children:e.jsx(ie,{size:i?18:14})}),e.jsxs("div",{className:`flex items-center gap-1.5 px-1 font-mono text-xs ${i?"text-neutral-200":"text-slate-700"}`,children:[e.jsx("span",{className:`font-bold ${i?"text-white text-base":"text-slate-900"}`,children:r+1}),e.jsx("span",{className:i?"text-neutral-600":"text-slate-350",children:"/"}),e.jsx("span",{children:h})]}),e.jsx("button",{disabled:r>=h-1||d&&u&&m,onClick:()=>P(r+1),className:`p-1.5 rounded-full border transition-colors cursor-pointer ${r>=h-1||d&&u&&m?i?"border-neutral-800 text-neutral-600 bg-neutral-950/20 cursor-not-allowed":"border-slate-100 bg-slate-50 text-slate-300 cursor-not-allowed":i?"border-neutral-700 text-neutral-300 hover:bg-neutral-800":"border-slate-205 text-slate-655 hover:bg-slate-50"}`,title:"下一张 (ArrowRight)",children:e.jsx(oe,{size:i?18:14})})]})]}),p==="doc"&&a==="md"&&e.jsxs("div",{className:"flex-1 flex flex-row min-h-0 bg-white",children:[se.length>0&&e.jsxs("div",{className:"w-1/4 min-w-[120px] max-w-[200px] border-r border-slate-200 bg-slate-50/50 flex flex-col py-3 px-2 overflow-y-auto shrink-0 select-none",children:[e.jsxs("span",{className:"text-xs font-bold text-slate-400 uppercase tracking-widest px-2 mb-2 flex items-center gap-1",children:[e.jsx(Re,{size:10}),"文档大纲"]}),e.jsx("div",{className:"flex flex-col gap-0.5",children:se.map((t,s)=>e.jsx("button",{onClick:()=>{const c=K.current?.querySelector(`[data-line-index="${t.lineIndex}"]`);c&&c.scrollIntoView({behavior:"smooth",block:"start"})},className:"text-left text-xs py-1 px-2 rounded hover:bg-slate-100 text-slate-600 hover:text-slate-900 truncate cursor-pointer font-medium whitespace-nowrap border-0 bg-transparent",style:{paddingLeft:`${Math.max(8,t.level*6)}px`},title:t.text,children:t.text},s))})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-6 md:p-8",ref:K,children:e.jsx("div",{className:"markdown-body prose prose-neutral max-w-none text-xs leading-relaxed text-slate-700",children:T.split(`
|
|
48
|
+
`).map((t,s)=>{const c=t.match(/^(#{1,3})\s+(.*)$/);if(c){const b=c[1].length,S=c[2].trim(),_=b===1?"h1":b===2?"h2":"h3",F=b===1?"text-lg font-bold text-indigo-900 border-b pb-1 mt-4 mb-2":b===2?"text-base font-bold text-slate-800 mt-3 mb-1.5":"text-sm font-semibold text-slate-700 mt-2 mb-1";return e.jsx(_,{"data-line-index":s,className:F,children:S},s)}return t.trim()==="---"?e.jsx("hr",{className:"my-4 border-slate-200"},s):e.jsx("p",{className:"my-1.5 text-slate-600 antialiased leading-relaxed",children:t},s)})})})]}),p==="edit"&&a==="md"&&e.jsxs("div",{className:"flex-1 flex flex-col md:flex-row min-h-0 bg-white",children:[e.jsxs("div",{className:"w-full md:w-1/3 border-b md:border-b-0 md:border-r border-slate-100 bg-slate-50/40 p-3 flex flex-col overflow-y-auto shrink-0 select-none",children:[e.jsxs("span",{className:"text-xs font-bold text-slate-400 tracking-wider uppercase mb-2 flex items-center gap-1",children:[e.jsx(Ee,{size:10,className:"text-indigo-650"}),"推荐课件及文档模板"]}),e.jsx("div",{className:"flex flex-col gap-2",children:je.map((t,s)=>e.jsxs("button",{type:"button",onClick:()=>{window.confirm(`确定要加载模板 “${t.name}” 吗?这将会覆盖当前白板课件中的所有编辑内容。`)&&(te(t.content),v.current=0,w.current=null,y(0))},className:"w-full text-left p-2.5 rounded-lg border border-slate-200 bg-white hover:border-indigo-300 hover:shadow-sm transition-all focus:outline-none cursor-pointer group",children:[e.jsx("div",{className:"font-bold text-xs text-slate-800 group-hover:text-indigo-700 whitespace-nowrap overflow-hidden text-ellipsis",children:t.name}),e.jsx("div",{className:"text-xs text-slate-400 mt-0.5",children:t.desc})]},s))}),e.jsxs("div",{className:"mt-4 p-2 bg-amber-50 rounded border border-amber-100 text-xs text-amber-700 font-sans leading-relaxed",children:[e.jsx("strong",{children:"💡 使用提示"}),e.jsx("br",{}),"在任意位置插入一行 ",e.jsx("code",{children:"---"})," 即可分割出一个新的幻灯片(PPT)页面。"]})]}),e.jsxs("div",{className:"flex-1 flex flex-col p-3 min-h-[200px]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5 px-1",children:[e.jsx("span",{className:"font-bold text-slate-500 text-xs uppercase",children:"Markdown Source Code"}),e.jsx("span",{className:"text-xs text-slate-400",children:"实时自动同步到所有协同终端"})]}),e.jsx("textarea",{value:T,onChange:t=>te(t.target.value),placeholder:"在此输入 Markdown 文档。使用 '---' 来作为 PPT 页面分页符...",className:"flex-1 w-full p-3 font-mono text-xs bg-slate-50 border border-slate-200 rounded-lg focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:bg-white transition-all resize-none leading-relaxed text-slate-800"})]})]})]})]})}export{Ze as RevealPresentationWrapper};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as c,j as e}from"./vendor-react-lfWn1oGs.js";import{s as v,E as M}from"./index-CLtQGl25.js";import{A as Z}from"./AssignmentFilePreview-DK29gdpQ.js";import{R as w,af as O,bd as I,a7 as ee,d as se,C as te,u as ae,a1 as ie,c as ne,O as re,ab as le,x as oe}from"./vendor-icons-__JLt-CP.js";function de(i){if(!i)return"";const l=i.split("/");return l[l.length-1]||i}function H(i){const l=de(i?.file_path);if(l)return l;const x=Array.isArray(i?.files)?i.files:[];return x.length===1?x[0]?.name||"附件":x.length>1?`${x.length} 个附件`:i?.textContent?"文字作答":i?.linkUrl?"链接作答":"已提交(无附件)"}function B(i,l){return!l?.fileId||!i?.assignment_id?null:`/api/assignments/${i.assignment_id}/files/${l.fileId}`}function he({lessonId:i,studentId:l,lang:x,addToast:f}){const[T,S]=c.useState(!1),[V,R]=c.useState(!1),[N,W]=c.useState(null),[q,G]=c.useState([]),[y,J]=c.useState(""),[z,$]=c.useState(null),[F,P]=c.useState(!1),[k,A]=c.useState({}),[_,L]=c.useState({}),[Y,D]=c.useState({}),t=x==="zh",b=async(s=!1)=>{s?R(!0):S(!0);try{const r=await(await fetch(`/api/lessons/${i}/students/${l}/eval-status`)).json();W(r);const d=await(await fetch(`/api/lessons/${i}/eval-submissions`)).json();G(d)}catch(n){console.error("Error fetching eval data:",n),f(t?"数据加载失败":"Failed to Load Data",t?"请检查网络连接或刷新页面。":"Please check your connection and try again.","warning")}finally{S(!1),R(!1)}};c.useEffect(()=>{i&&l&&b()},[i,l]);const K=async s=>{s.preventDefault(),y.trim(),P(!0);try{const r=await(await fetch(`/api/lessons/${i}/eval-submissions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({studentId:l,filePath:y.trim()||void 0})})).json();if(r.success)f(t?"作业提交成功":"Assignment Submitted",t?`成功提交版本 ${r.version}!`:`Successfully submitted version ${r.version}!`,"success"),b(!0);else throw new Error(r.error||"Failed to submit assignment")}catch(n){f(t?"提交失败":"Submission Failed",n.message,"warning")}finally{P(!1)}},Q=async(s,n)=>{const r=k[s],h=_[s]||"";if(r===void 0||isNaN(r)||r<0||r>100){f(t?"评分无效":"Invalid Score",t?"分数必须在 0 到 100 之间!":"Score must be between 0 and 100!","warning");return}D(d=>({...d,[s]:!0}));try{const p=await(await fetch(`/api/lessons/${i}/eval-submissions/${s}/reviews`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({score:Number(r),comment:h})})).json();if(p.success)f(t?"互评提交成功":"Review Submitted",t?"成功对同学的作品完成了评价!":"Successfully completed review for classmate!","success"),L(j=>{const u={...j};return delete u[s],u}),b(!0);else throw new Error(p.error||"Failed to submit review")}catch(d){f(t?"评价提交失败":"Review Failed",d.message,"warning")}finally{D(d=>({...d,[s]:!1}))}};if(T)return e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center py-12 text-gray-500",children:[e.jsx(w,{className:"animate-spin text-indigo-500 mb-2",size:32}),e.jsx("p",{children:t?"正在读取作业互评状态...":"Loading assignment status..."})]});const a=N?.submission,E=v(a?.linkUrl),o=N?.grade,X=N?.reviewsWritten||[],U=q.filter(s=>s.student_id!==l);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-600"}),t?"我的作业提交":"My Assignment Submission"]}),e.jsx("button",{onClick:()=>b(!0),className:"p-1 hover:bg-slate-200/50 rounded transition-colors text-slate-550",title:t?"刷新数据":"Refresh Data",children:e.jsx(w,{size:14,className:V?"animate-spin":""})})]}),a?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(I,{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:H(a)})]}),e.jsxs("span",{className:"bg-indigo-100 text-indigo-700 text-xs font-bold px-2 py-0.5 rounded-full border border-indigo-200",children:["V",a.version]})]}),e.jsxs("div",{className:"border-t border-slate-100 pt-2.5 flex justify-between items-center text-xs text-slate-400",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ee,{size:11}),t?"更新时间:":"Updated At:"," ",new Date(a.updated_at).toLocaleString()]}),e.jsx("span",{className:"font-mono text-slate-350 select-all truncate max-w-[120px]",title:a.file_path||void 0,children:a.file_path||"—"})]}),(a.textContent||a.linkUrl||Array.isArray(a.files)&&a.files.length>0)&&e.jsxs("div",{className:"border-t border-slate-100 pt-2.5 space-y-1 text-xs text-slate-600",children:[a.textContent&&e.jsx("p",{className:"whitespace-pre-wrap break-all max-h-20 overflow-hidden",children:a.textContent}),E&&e.jsx("a",{href:E,target:"_blank",rel:"noopener noreferrer",className:"block truncate text-indigo-600 hover:underline",children:a.linkUrl}),Array.isArray(a.files)&&a.files.map((s,n)=>{const r=v(B(a,s)),h=!!(r&&a?.assignment_id&&s?.fileId);return e.jsxs("span",{className:"flex items-center gap-1.5",children:[h&&e.jsx("button",{onClick:()=>$({id:String(s.fileId),original_name:String(s.name??s.fileId),size:Number(s.size??0),mime:s.mime??null}),className:"p-0.5 rounded text-indigo-600 hover:bg-indigo-50 shrink-0",title:t?"预览":"Preview","aria-label":t?`预览 ${s.name}`:`Preview ${s.name}`,"data-testid":"student-assignment-file-preview",children:e.jsx(se,{size:11})}),r?e.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"block truncate text-indigo-600 hover:underline",children:s.name}):e.jsx("span",{className:"block truncate",children:s.name})]},s.fileId??n)})]}),e.jsx(M,{slot:"assignment.submission.preview",slotProps:{submission:a,studentId:l,lessonId:i,isSelf:!0,lang:x}})]}):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(te,{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:K,className:"space-y-3",children:e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs 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:y,onChange:s=>J(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:F,className:"bg-indigo-600 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:[F?e.jsx(w,{className:"animate-spin",size:13}):e.jsx(O,{size:13}),a?t?"重新提交":"Re-submit":t?"上传作品":"Submit"]})]})]})})]}),a&&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(ae,{size:16,className:"text-pink-650"}),t?"我的平时学习得分":"My Score & Feedback"]}),o?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-xs 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:[o.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-xs font-bold rounded-lg border ${o.status==="confirmed"?"bg-emerald-50 text-emerald-700 border-emerald-100":"bg-amber-50 text-amber-700 border-amber-100"}`,children:o.status==="confirmed"?t?"已确认同步":"Synced":t?"教师评分草稿":"Draft"}),e.jsx("p",{className:"text-xs text-slate-400 mt-1.5 font-medium",children:t?`教师分 ${o.teacher_score} (占 ${(o.teacher_weight*100).toFixed(0)}%)`:`Teacher ${o.teacher_score} (${(o.teacher_weight*100).toFixed(0)}%)`}),e.jsx("p",{className:"text-xs text-slate-400 mt-0.5 font-medium",children:t?`学生互评 (占 ${(o.peer_weight*100).toFixed(0)}%)`:`Peer Review (${(o.peer_weight*100).toFixed(0)}%)`})]})]}),o.teacher_comment&&e.jsxs("div",{className:"bg-slate-100/60 p-3 rounded-lg border border-slate-200 flex gap-2",children:[e.jsx(ie,{size:14,className:"text-slate-400 shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-bold text-slate-500",children:t?"教师寄语":"Teacher Comments"}),e.jsx("p",{className:"text-xs text-slate-650 mt-0.5",children:o.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(ne,{size:16,className:"text-teal-700"}),t?"同学作业互评公开板":"Classmate Submissions for Peer Review"]}),U.length===0?e.jsx("div",{className:"flex-grow flex items-center justify-center text-subtle 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:U.map(s=>{const n=X.find(m=>m.submission_id===s.id),r=k[s.id]!==void 0?k[s.id]:n?n.score:85,h=_[s.id]!==void 0?_[s.id]:n?n.comment:"",d=Y[s.id]||!1,p=Array.isArray(s.files)?s.files:[],j=v(s.file_path||B(s,p[0])||null),u=j||v(s.linkUrl)||null;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-xs text-slate-400 font-mono flex items-center gap-1 mt-0.5 truncate max-w-[200px]",title:s.file_path||void 0,children:[e.jsx(re,{size:11,className:"text-slate-350"}),H(s)," (V",s.version,")"]})]})]}),u?e.jsx("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:"text-xs font-bold text-indigo-600 hover:text-indigo-800 transition-colors border border-indigo-100 px-2 py-1 rounded bg-indigo-50/50 hover:bg-indigo-50 shrink-0",children:j?t?"下载查阅":"Download File":t?"打开链接":"Open Link"}):e.jsx("span",{className:"text-xs text-slate-400 px-2 py-1 border border-slate-200 rounded bg-white shrink-0",children:t?"无附件":"No File"})]}),s.textContent&&e.jsx("p",{className:"text-xs text-slate-600 whitespace-pre-wrap break-all max-h-24 overflow-auto bg-slate-50 border border-slate-100 rounded-lg p-2",children:s.textContent}),e.jsx(M,{slot:"assignment.submission.preview",slotProps:{submission:s,studentId:s.student_id,lessonId:i,isSelf:!1,lang:x}}),n&&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(le,{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?`我已评分:${n.score} 分`:`My Score: ${n.score} pts`}),n.comment&&e.jsxs("p",{className:"text-xs text-emerald-700/80 mt-0.5 italic",children:['"',n.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-xs 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:r,onChange:m=>{const g=Math.min(100,Math.max(0,parseInt(m.target.value)||0));A(C=>({...C,[s.id]:g}))},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-xs text-slate-400 font-bold",children:t?"分":"pts"})]})]}),e.jsx("input",{type:"range",min:"0",max:"100",value:r,onChange:m=>{const g=parseInt(m.target.value);A(C=>({...C,[s.id]:g}))},className:"w-full h-1.5 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-indigo-600"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("textarea",{rows:1,value:h,onChange:m=>{L(g=>({...g,[s.id]:m.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 field-sizing-auto transition-colors"}),e.jsxs("button",{onClick:()=>Q(s.id,s.student_id),disabled:d,className:"bg-indigo-600 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:[d?e.jsx(w,{className:"animate-spin",size:13}):e.jsx(oe,{size:13}),e.jsx("span",{className:"ml-1 shrink-0",children:n?t?"修改评分":"Update":t?"确认提交":"Submit"})]})]})]})]},s.id)})})]}),z&&a?.assignment_id&&e.jsx(Z,{assignmentId:String(a.assignment_id),file:z,lang:x,onClose:()=>$(null)})]})}export{he as S};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,r as N}from"./vendor-react-lfWn1oGs.js";import{E as z,v as T,M as q}from"./index-CLtQGl25.js";import{o as _,aE as C,k as A,q as S,T as E,X as R}from"./vendor-icons-__JLt-CP.js";import{L as O}from"./LazyWhiteboard-DuBKAh4-.js";import"./vendor-utils-CsoI4M9x.js";import"./vendor-pptx-ByQkJ0Xi.js";import"./vendor-pdf-DNexfcCO.js";import"./vendor-charts-CK-CU_m7.js";import"./vendor-motion-DtyD8eRQ.js";function I(x){const{setStudentViewStatus:s,setSelectedAssignment:i,selectedAssignment:o}=x;return e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[e.jsxs("button",{onClick:()=>{s("dashboard"),i(null)},className:"flex items-center gap-2 text-indigo-600 hover:text-indigo-800 transition-colors font-medium text-sm",children:[e.jsx(_,{className:"rotate-180",size:16})," Back to Dashboard"]}),e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("h2",{className:"text-xl font-bold text-gray-800",children:["Assignment: ",o.title]}),e.jsx(z,{slot:"student.assignment.toolbar.action",slotProps:{assignment:o}})]})]})}function Q(x){const{selectedAssignment:s,quizStudentAnswers:i,setQuizStudentAnswers:o,submitQuizAssignment:d}=x,m=T.match(s?.content);if(m){const n=m.config,r={assignment:s,answers:i,setAnswers:t=>o?.(t),lang:"zh"};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-indigo-500 bg-indigo-50 border border-indigo-100 p-2.5 rounded-lg flex items-center gap-1.5 w-full",children:n.label})}),n.render(r),!s.submission_status&&e.jsx("div",{className:"mt-6 border-t border-gray-100 pt-4",children:e.jsx("button",{onClick:async()=>{if(n.validate){const t=n.validate(r);if(t){window.alert(t);return}}n.buildSubmission&&o?.(n.buildSubmission(r)),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"})})]})}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:s?.content&&s.content.startsWith('{"quizType":"mcq_learning_objectives"')?"Assessment":"Question"})}),s?.content&&s.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(C,{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 n=JSON.parse(s.content);return e.jsxs("div",{className:"space-y-2 font-sans",children:[e.jsx("div",{className:"text-xs font-bold text-gray-400 uppercase tracking-wider",children:"Lesson Learning Objectives:"}),e.jsx("ul",{className:"space-y-1.5",children:(n.learningObjectives||[]).map((r,t)=>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:r})]},t))})]})}catch{return null}})()]}):e.jsx("div",{className:"prose prose-sm prose-indigo max-w-none mb-6",children:e.jsx(q,{children:s.content||""})}),!s.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:s?.content&&s.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 n=s?.content&&s.content.startsWith('{"quizType":"mcq_learning_objectives"');if(n&&JSON.stringify(i),n)try{const r=JSON.parse(s.content),t=Object.keys(i).length;if(t<r.questions.length&&!window.confirm(`You have only answered ${t}/${r.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"})]}),s.submission_status==="graded"&&s.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: ",s.score,"%"]}),e.jsx("div",{className:"text-xs text-green-700 whitespace-pre-wrap leading-relaxed font-sans",children:s.feedback})]})]})}function W({assignmentId:x,timeLimitMinutes:s,onTimeUp:i,isSubmitted:o}){const[d,m]=N.useState(null);if(N.useEffect(()=>{if(o||!s||s<=0){m(null);return}const a=`quiz_timer_start_${x}`;let u=sessionStorage.getItem(a),g=u?parseInt(u,10):null;g||(g=Date.now(),sessionStorage.setItem(a,g.toString()));const l=s*60,c=()=>{const j=Math.floor((Date.now()-g)/1e3),h=l-j;h<=0?(m(0),i()):m(h)};c();const b=setInterval(c,1e3);return()=>clearInterval(b)},[x,s,o,i]),!s||s<=0)return null;if(o)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: ",s," mins (Completed)"]})]});if(d===null)return null;const n=Math.floor(d/60),r=d%60,t=d<60;return e.jsxs("div",{className:`flex items-center gap-3 font-sans px-4 py-2.5 rounded-xl border transition-all ${t?"bg-red-50 text-red-700 border-red-200 animate-pulse font-bold":d<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:t?"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:[n.toString().padStart(2,"0"),":",r.toString().padStart(2,"0")]})]}),t&&e.jsxs("span",{className:"flex items-center gap-1 text-xs uppercase tracking-wider text-red-600 font-bold animate-pulse",children:[e.jsx(E,{size:12})," Time is almost up!"]})]})]})}function P(x){const{selectedAssignment:s,subAssignmentTab:i,setSubAssignmentTab:o,quizStudentAnswers:d,setQuizStudentAnswers:m,submitQuizAssignment:n,elements:r,activeRole:t,activeStudentId:a,fetchElements:u}=x;return e.jsx("div",{className:"flex-1 relative flex flex-col min-h-0",children:(()=>{const g=s?.content&&s.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:g&&i==="quiz"?"Evaluation Sheet":"Live Canvas"}),g&&e.jsxs("div",{className:"flex bg-gray-100 p-0.5 rounded-lg border border-gray-200 text-xs",children:[e.jsx("button",{onClick:()=>o("quiz"),className:`px-2.5 py-0.5 rounded text-xs font-bold transition-all ${i==="quiz"?"bg-white text-indigo-700 shadow-sm":"text-gray-500 hover:text-gray-900"}`,children:"Interactive Test"}),e.jsx("button",{onClick:()=>o("whiteboard"),className:`px-2.5 py-0.5 rounded text-xs font-bold transition-all ${i==="whiteboard"?"bg-white text-indigo-700 shadow-sm":"text-gray-500 hover:text-gray-900"}`,children:"Sketch Whiteboard"})]})]}),s.submission_status&&e.jsx("div",{className:"text-xs uppercase font-bold text-gray-400 bg-gray-100 px-2 py-0.5 rounded",children:"Read Only"})]}),g&&i==="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 l=JSON.parse(s.content);return e.jsxs(e.Fragment,{children:[l.timeLimit>0&&e.jsx(W,{assignmentId:s.id,timeLimitMinutes:l.timeLimit,onTimeUp:()=>n(!0),isSubmitted:!!s.submission_status}),l.questions.map((c,b)=>{const j=d[b],h=!!s.submission_status,v=d[b]===c.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:b+1}),e.jsxs("span",{className:"text-xs font-semibold text-teal-700 bg-teal-50 px-2.5 py-0.5 rounded-full border border-teal-100",children:["evaluates: ",c.objective]})]}),h&&e.jsx("span",{className:`text-xs font-bold px-2.5 py-0.5 rounded-full ${v?"bg-green-100 text-green-800":"bg-red-100 text-red-800"}`,children:v?"Correct ✓":`Incorrect (Correct Option: ${c.correctAnswer})`})]}),e.jsx("div",{className:"font-semibold text-gray-800 text-sm",children:c.question}),e.jsx("div",{className:"grid grid-cols-2 gap-3 text-xs pt-1",children:c.options.map((f,k)=>{const y=j===f,w=f===c.correctAnswer;let p="border-gray-200 hover:border-gray-300 bg-white text-gray-700 hover:bg-gray-50/50 cursor-pointer";return h?y?p=w?"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":w?p="border-green-400 bg-green-50/20 text-green-900":p="border-gray-200 opacity-60 text-gray-400":y&&(p="border-indigo-600 bg-indigo-50/30 text-indigo-900 ring-2 ring-indigo-100 font-medium cursor-pointer"),e.jsxs("div",{onClick:()=>{h||m($=>({...$,[b]:f}))},className:`p-3 rounded-xl border transition-all duration-150 flex items-center justify-between ${p}`,children:[e.jsx("span",{children:f}),y&&(h?w?e.jsx(A,{size:14,className:"text-green-600 shrink-0"}):e.jsx(R,{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"}))]},k)})})]},b)})]})}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 ${s.submission_status?"opacity-90 pointer-events-none filter grayscale-[0.2]":""}`,children:e.jsx(O,{lessonId:`assignment-${s.id}-student-${a}`,elements:r,userRole:t,enableAutoAI:t==="student"&&!s.submission_status,onElementAdd:async(l,c)=>{await fetch(`/api/lessons/assignment-${s.id}-student-${a}/whiteboard`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:l,data:c})}),u(`assignment-${s.id}-student-${a}`)},onElementUpdate:async(l,c)=>{await fetch(`/api/lessons/assignment-${s.id}-student-${a}/whiteboard/${l}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:c})}),u(`assignment-${s.id}-student-${a}`)},onElementDelete:async l=>{await fetch(`/api/lessons/assignment-${s.id}-student-${a}/whiteboard/${l}`,{method:"DELETE"}),u(`assignment-${s.id}-student-${a}`)},onClearBoard:async()=>{await fetch(`/api/lessons/assignment-${s.id}-student-${a}/whiteboard`,{method:"DELETE"}),u(`assignment-${s.id}-student-${a}`)},onRefresh:()=>u(`assignment-${s.id}-student-${a}`)})})]})})()})}function K(x){const{selectedAssignment:s,setStudentViewStatus:i,setSelectedAssignment:o,quizStudentAnswers:d,submitQuizAssignment:m,subAssignmentTab:n,setSubAssignmentTab:r,setQuizStudentAnswers:t,elements:a,activeRole:u,activeStudentId:g,fetchElements:l}=x;return e.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[e.jsx(I,{setStudentViewStatus:i,setSelectedAssignment:o,selectedAssignment:s}),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(Q,{selectedAssignment:s,quizStudentAnswers:d,setQuizStudentAnswers:t,submitQuizAssignment:m}),e.jsx(P,{selectedAssignment:s,subAssignmentTab:n,setSubAssignmentTab:r,quizStudentAnswers:d,setQuizStudentAnswers:t,submitQuizAssignment:m,elements:a,activeRole:u,activeStudentId:g,fetchElements:l})]})]})}export{K as StudentAssignmentView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as v,j as e}from"./vendor-react-lfWn1oGs.js";import{i as de}from"./keyboard-Rs007iOv.js";import{u as ee}from"./StudentView-mMwGPiiF.js";import{L as V,o as te,B as se,M as ne,v as re,y as q,b7 as ce,av as me,X as ue,ab as xe,f as he,aM as be,bc as ge,h as fe}from"./vendor-icons-__JLt-CP.js";import{E as A,M as pe,q as G}from"./index-CLtQGl25.js";import{L as ke}from"./LazyWhiteboard-DuBKAh4-.js";import{L as ve}from"./LazyCourseware-dtuOSiyR.js";import{S as ye}from"./StudentAssignmentEvalPanel-C-7YSfEQ.js";import"./vendor-utils-CsoI4M9x.js";import"./vendor-pdf-DNexfcCO.js";import"./vendor-motion-DtyD8eRQ.js";import"./vendor-charts-CK-CU_m7.js";import"./vendor-pptx-ByQkJ0Xi.js";import"./AssignmentFilePreview-DK29gdpQ.js";function je({lessonId:m,lang:t,addToast:c}){const[i,x]=v.useState(""),[s,l]=v.useState("idle"),[h,b]=v.useState("");if(v.useEffect(()=>{x(""),l("idle"),b("")},[m]),!m)return null;const a=async()=>{const n=i.trim();if(!n){l("error"),b(t==="zh"?"请先输入签到码":"Enter the check-in code first");return}l("submitting"),b("");try{const p=await fetch(`/api/classroom/sessions/${encodeURIComponent(m)}/checkin`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:n})}),u=await p.json().catch(()=>({}));if(!p.ok||!u.success){l("error");const d=u.error==="Invalid checkin code"?t==="zh"?"签到码不正确,请核对大屏后重试":"Wrong code, check the stage display and retry":u.error||(t==="zh"?"签到失败,请稍后重试":"Check-in failed, retry later");b(d);return}l("done");const y=u.attendanceScheduled!==!1;b(y?t==="zh"?"签到成功,出勤已记录":"Checked in, attendance recorded":t==="zh"?"签到成功(本课节未关联排课,未计入正式出勤)":"Checked in (no schedule linked; not counted in official attendance)"),c(t==="zh"?"签到成功":"Checked in",y?t==="zh"?"出勤已记录":"Attendance recorded":t==="zh"?"会话级签到,未计入正式出勤":"Session-level check-in only","success")}catch{l("error"),b(t==="zh"?"网络异常,请稍后重试":"Network error, retry later")}};return e.jsxs("div",{className:"flex flex-wrap items-center gap-2 bg-surface border border-theme rounded-xl px-3 py-2 shadow-sm text-main",children:[e.jsx("span",{className:"text-xs font-bold",children:t==="zh"?"课堂签到":"Check-in"}),s==="done"?e.jsxs("span",{className:"text-xs font-bold text-emerald-600",children:["✓ ",h]}):e.jsxs(e.Fragment,{children:[e.jsx("input",{value:i,onChange:n=>x(n.target.value.replace(/\s/g,"").slice(0,12)),onKeyDown:n=>{de(n)&&(n.preventDefault(),a())},placeholder:t==="zh"?"输入大屏 4 位签到码":"4-digit code on stage display",inputMode:"numeric","aria-label":t==="zh"?"课堂签到码":"Class check-in code",className:"w-44 px-2 py-1 text-sm font-mono tracking-widest border border-theme rounded-lg bg-transparent"}),e.jsx("button",{type:"button",onClick:()=>void a(),disabled:s==="submitting",className:"px-3 py-1 text-xs font-bold rounded-lg bg-indigo-600 text-white hover:bg-indigo-700 disabled:opacity-50 cursor-pointer",children:s==="submitting"?t==="zh"?"提交中…":"Submitting…":t==="zh"?"签到":"Check in"})]}),s==="error"&&h&&e.jsx("span",{className:"text-xs text-rose-600",children:h})]})}function we(m){const{students:t,activeStudentId:c,isStudentLocked:i=!1,lockMode:x,setStudentViewStatus:s,setSelectedLesson:l,lessons:h,selectedLesson:b,lang:a="zh",addToast:n,onOpenIcebreaker:p}=m,u=ee(w=>w.activeSession),y=t.find(w=>w.id===c),d=i||!!y?.locked_lesson_id,k=(x||y?.lock_mode||"full")==="navigation";return e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[d?k?e.jsxs("div",{className:"text-amber-800 font-semibold text-sm flex items-center gap-2 px-3 py-1.5 rounded-lg bg-amber-50 border border-amber-200 shadow-3xs select-none",role:"status",title:a==="zh"?"答题锁定中 · 请完成作答后提交,暂时无法离开本页":"Answer Locked · Complete and submit your work before leaving",children:[e.jsx(V,{size:15,className:"text-amber-600 shrink-0"}),a==="zh"?"答题锁定中 · 请完成作答后提交,暂时无法离开本页":"Answer Locked · Complete and submit work"]}):e.jsxs("div",{className:"text-indigo-700 font-semibold text-sm flex items-center gap-2 px-3 py-1.5 rounded-lg bg-indigo-50 border border-indigo-200 shadow-3xs select-none",role:"status",title:a==="zh"?"老师已开启全班专注锁定,您暂时无法切换页面":"The teacher locked the class focus. Navigating away is disabled.",children:[e.jsx(V,{size:15,className:"text-indigo-600 shrink-0"}),a==="zh"?"全班专注锁定 · 跟随教师授课":"Class Focus Locked · Following Teacher"]}):e.jsxs("button",{onClick:()=>{s("dashboard"),l(null),u&&n?.(a==="zh"?"课堂仍在进行":"Class still in progress",a==="zh"?`可随时从看板顶部的「${u.lessonTitle} · 返回课堂」回到课堂。`:"You can return anytime via the banner at the top of your dashboard.","info")},className:"flex items-center gap-2 text-indigo-600 hover:text-indigo-800 transition-colors font-medium text-sm cursor-pointer",children:[e.jsx(te,{className:"rotate-180",size:16})," Back to Dashboard"]}),e.jsxs("div",{className:"flex items-center gap-3",children:[p&&e.jsxs("button",{type:"button","data-testid":"open-icebreaker-btn",onClick:p,className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-amber-200 dark:border-amber-800/60 bg-amber-50/80 hover:bg-amber-100/80 dark:bg-amber-950/30 dark:hover:bg-amber-950/50 text-amber-900 dark:text-amber-200 text-xs font-semibold shadow-3xs transition-colors cursor-pointer",title:a==="zh"?"课前破冰心情打卡":"Pre-class Icebreaker Check-in",children:[e.jsx("span",{children:"✨"}),e.jsx("span",{children:a==="zh"?"心情打卡":"Mood Check-in"})]}),e.jsx("h2",{className:"text-xl font-bold text-gray-800 dark:text-gray-100",children:h.find(w=>w.id===b)?.title})]})]})}function Ne(m){const{students:t,activeStudentId:c,isStudentLocked:i=!1,studentFullscreenPanel:x,setStudentFullscreenPanel:s,timelineSegments:l,lang:h,activeSegmentId:b,localProgressPercent:a,setLocalProgressPercent:n,updateStudentProgress:p,selectedLesson:u,lessons:y,isStudentLessonContentCollapsed:d,addToast:g,segmentAccess:k}=m,w=r=>{if(!r?.id||b===r.id)return;g?.(h==="zh"?"请跟随课堂":"Follow the class",h==="zh"?"请跟随课堂当前环节":"Please follow the current class segment","warning")};return e.jsxs("div",{className:`${d?"hidden":x==="left"?"w-full":"w-1/3 md:block hidden"} border-gray-100 pr-4 overflow-y-auto ${x==="right"?"hidden":""} ${x==="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(se,{size:14,className:"text-indigo-500"})," Lesson Content (课程内容)"]}),e.jsx("button",{onClick:()=>s(r=>r==="left"?"none":"left"),className:"p-1 hover:bg-gray-100 text-subtle hover:text-main rounded transition-colors cursor-pointer flex items-center gap-1",title:x==="left"?"退出全屏":"全屏",children:x==="left"?e.jsxs(e.Fragment,{children:[e.jsx(ne,{size:13}),e.jsx("span",{className:"text-xs font-medium",children:"退出全屏"})]}):e.jsxs(e.Fragment,{children:[e.jsx(re,{size:13}),e.jsx("span",{className:"text-xs font-medium",children:"全屏"})]})})]}),e.jsxs("div",{className:"prose prose-sm prose-indigo max-w-none",children:[!i&&!t.find(r=>r.id===c)?.locked_lesson_id&&l.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:r=>r.stopPropagation(),children:[e.jsxs("div",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider flex items-center gap-1.5 mb-1 select-none",children:[e.jsx(q,{size:12,className:"text-indigo-500"}),h==="zh"?"教学环节 (点击切换)":"Timeline Segments"]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:l.map((r,f)=>{const j=b===r.id,S=j&&k?.status==="locked";return e.jsxs("button",{onClick:()=>w(r),title:S?k?.reason||"未满足进入条件":void 0,className:`px-2.5 py-1 text-xs font-semibold rounded-lg border transition-all cursor-pointer shadow-3xs flex items-center gap-1.5 ${r.color} ${j?"ring-2 ring-indigo-500 scale-[1.02] shadow-sm border-indigo-400 font-bold":"opacity-85 hover:opacity-100"}`,children:[S&&e.jsx(V,{size:11,className:"text-amber-600 shrink-0"}),e.jsxs("span",{children:[r.title," (",r.duration,")"]}),e.jsx(A,{slot:"student.segment.badge",slotProps:{segment:r,idx:f,isActive:j,isLocked:!!S,studentId:c,lessonId:u,lang:h}})]},r.id||f)})})]}),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-xs font-bold text-gray-500",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(q,{size:12,className:"text-indigo-500 animate-pulse"}),h==="zh"?"自主学习进度(教师确认后计入成绩)":"Learning Progress (graded after teacher verification)"]}),e.jsxs("span",{className:"font-mono text-indigo-600 font-extrabold",children:[a,"%"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"range",min:"0",max:"100",value:a,onChange:r=>{const f=parseInt(r.target.value);n(f)},onMouseUp:()=>p(a),onTouchEnd:()=>p(a),className:"flex-grow h-1.5 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-indigo-600"}),e.jsx("button",{onClick:()=>{n(100),p(100)},className:`text-xs font-bold rounded-lg px-2 py-1 transition-all ${a===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:h==="zh"?"已完成":"Done"})]})]}),e.jsx(pe,{children:y.find(r=>r.id===u)?.content||""})]})]})}function Se(m){const{isStudentLocked:t=!1,isNavigationLocked:c,isInteractionLocked:i,lockMode:x,studentLessonTab:s,setStudentLessonTab:l,isStudentLessonContentCollapsed:h,setIsStudentLessonContentCollapsed:b,lang:a,studentFullscreenPanel:n,setStudentFullscreenPanel:p,selectedLesson:u,elements:y,activeRole:d,activeSegmentId:g,contentSegmentId:k,blockSegmentContent:w=!1,setActiveSegmentId:r,fetchElements:f,currentVfsParent:j,setCurrentVfsParent:S,vfsNodes:z,studentSelectedCourseware:F,setStudentSelectedCourseware:B,activeStudentId:P,studentName:H,classId:W,addToast:R}=m,$=c??t,C=i??(x==="navigation"?!1:t),E=(x||(!C&&$?"navigation":"full"))==="navigation",I=o=>{if($){o!==s&&R(a==="zh"?E?"🔒 答题锁定":"🔒 全班专注锁定":E?"🔒 Answer Locked":"🔒 Class Focus Locked",a==="zh"?E?"答题锁定中,请在当前页面完成作答并提交。":"锁定期间无法切换标签页,请跟随教师当前授课内容。":E?"Answer lock active. Complete your work on this page.":"Switching tabs is disabled while the class is locked.","warning");return}l(o)},N=k||g,M=w,_=o=>`px-3 py-1.5 text-xs font-medium rounded-md transition-colors ${s===o?"bg-primary-theme/10 text-primary-theme shadow-sm font-bold":"text-muted hover:bg-surface-secondary"} ${$&&s!==o?"opacity-50 cursor-not-allowed":"cursor-pointer"}`;return e.jsxs("div",{className:`${h||n==="right"?"w-full flex-grow":"flex-grow flex-1"} relative flex flex-col min-h-0 ${n==="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:()=>b(!h),className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-bold bg-primary-theme/10 text-primary-theme rounded-lg hover:bg-primary-theme/20 transition-colors border border-primary-theme/20 cursor-pointer shadow-3xs",title:h?"展开课程内容":"折叠课程内容",children:[e.jsx(se,{size:13,className:"text-primary-theme"}),e.jsx("span",{children:h?a==="zh"?"展开课程内容":"Expand Content":a==="zh"?"折叠课程内容":"Collapse Content"})]}),e.jsxs("button",{onClick:()=>I("whiteboard"),className:_("whiteboard"),title:C&&a==="zh"?"锁定中:白板为只读跟随模式":$&&a==="zh"?"答题锁定中:请在此页面完成作答":void 0,children:["Interactive Whiteboard",C&&s==="whiteboard"&&e.jsxs("span",{className:"ml-1.5 text-xs font-bold text-indigo-500",children:["🔒 ",a==="zh"?"只读":"RO"]}),!C&&$&&s==="whiteboard"&&e.jsxs("span",{className:"ml-1.5 text-xs font-bold text-amber-600",children:["✏️ ",a==="zh"?"答题锁定":"Answering"]})]}),e.jsx("button",{onClick:()=>I("courseware"),className:_("courseware"),children:"Interactive Courseware Viewer"}),e.jsx("button",{onClick:()=>I("assignment"),className:_("assignment"),children:a==="zh"?"作业提交与互评":"Assignments & Peer Reviews"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(A,{slot:"student.lesson.tool",slotProps:{lessonId:u,studentId:P,activeSegmentId:g,lang:a},locked:C}),e.jsx("button",{onClick:()=>p(o=>o==="right"?"none":"right"),className:"p-1 hover:bg-gray-100 text-subtle hover:text-main rounded transition-colors cursor-pointer flex items-center gap-1",title:n==="right"?"退出全屏":"全屏",children:n==="right"?e.jsxs(e.Fragment,{children:[e.jsx(ne,{size:13}),e.jsx("span",{className:"text-xs font-medium",children:"退出全屏"})]}):e.jsxs(e.Fragment,{children:[e.jsx(re,{size:13}),e.jsx("span",{className:"text-xs font-medium",children:"全屏"})]})})]})]}),M?e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-6 text-amber-800 bg-amber-50/60 rounded-xl border border-amber-200 gap-3",children:[e.jsxs("div",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-500 animate-pulse"}),e.jsx("span",{children:a==="zh"?"本教学环节尚未解锁":"This segment is not unlocked yet"})]}),e.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-400 max-w-md text-center",children:a==="zh"?"您尚未满足本教学环节的进入门禁条件,请完成前置任务或等待教师统一推进。":"You have not met the gate conditions for this segment yet. Please complete prerequisites or wait for the teacher."}),e.jsx(A,{slot:"student.segment.gate_fallback",slotProps:{lessonId:u,activeSegmentId:g,studentId:P,contentSegmentId:k,lang:a}})]}):null,!M&&s==="whiteboard"&&e.jsx(ke,{lessonId:u,classId:W??null,studentId:P,studentName:H??null,elements:y,userRole:d,readOnly:C,followRemoteFullscreen:!0,activeSegmentId:N,onSegmentSync:o=>{k!==void 0&&k!==g||r(o)},onElementUpdate:async()=>{},onElementDelete:async o=>{C||u&&(await fetch(`/api/lessons/${u}/whiteboard/${o}`,{method:"DELETE"}),f(u))},onClearBoard:async()=>{C||u&&(await fetch(`/api/lessons/${u}/whiteboard`,{method:"DELETE"}),f(u))},onElementAdd:async()=>{},onRefresh:()=>{u&&f(u)}}),!M&&s==="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:[j!==null&&e.jsxs("button",{onClick:()=>S(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(te,{className:"rotate-180",size:14})," Back to Root"]}),z.filter(o=>o.type==="dir").map(o=>e.jsxs("button",{onClick:()=>S(o.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:o.name,children:[e.jsx(ce,{size:14,className:"text-indigo-400 shrink-0 group-hover:text-indigo-600"}),e.jsx("span",{className:"truncate",children:o.name})]},o.id)),z.filter(o=>o.type==="file"&&(o.name.endsWith(".html")||o.name.endsWith(".htm")||o.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."}):z.filter(o=>o.type==="file"&&(o.name.endsWith(".html")||o.name.endsWith(".htm")||o.content?.includes("<html"))).map(o=>e.jsxs("button",{onClick:()=>B(o.id),className:`w-full text-left p-2 rounded text-xs flex items-center gap-2 truncate transition-colors ${F===o.id?"bg-indigo-100 text-indigo-700 font-medium":"text-gray-600 hover:bg-gray-100"}`,title:o.name,children:[e.jsx(me,{size:14,className:"shrink-0"}),e.jsx("span",{className:"truncate",children:o.name})]},o.id))]}),e.jsx("div",{className:"mt-2 text-xs 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(ve,{coursewareId:F,onClose:()=>B(null)})})]}),!M&&s==="assignment"&&u&&P&&e.jsx(ye,{lessonId:u,studentId:P,lang:a,addToast:R})]})}function Ce({access:m,lang:t}){if(!m.segmentId)return null;if(m.status==="loading"||m.status==="idle")return e.jsx("div",{className:"rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-xs text-slate-600",role:"status",children:t==="zh"?"正在核对进入条件":"Checking entry conditions"});if(m.status!=="locked")return null;const c=m.gates.filter(i=>!i.allowed);return e.jsx("div",{"data-testid":"segment-gate-lock",role:"status",className:"rounded-xl border border-amber-300 bg-amber-50 px-3 py-2.5 text-xs text-amber-900",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(V,{size:14,className:"mt-0.5 shrink-0 text-amber-700"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"font-bold",children:t==="zh"?"本环节尚未解锁":"This segment is locked"}),e.jsx("p",{className:"mt-0.5 leading-snug",children:m.reason||(t==="zh"?"未满足进入条件":"Conditions not met")}),c.length>0&&e.jsx("ul",{className:"mt-1.5 space-y-0.5",children:c.map(i=>e.jsxs("li",{children:[i.reason||i.type,i.progress?`(${i.progress.current}/${i.progress.target}${i.progress.unit||""})`:""]},`${i.type}-${i.reason||""}`))})]})]})})}const X={status:"idle",allowed:!0,gates:[],visibleSegmentId:null,segmentId:null};function Z(m,t){return{status:"locked",allowed:!1,reason:t,gates:[],visibleSegmentId:null,segmentId:m}}function ze(m,t){const[c,i]=v.useState(X),x=v.useCallback(async()=>{if(!m||!t){i(X);return}i(s=>s.segmentId===t&&(s.status==="open"||s.status==="locked")?s:{...s,status:"loading",segmentId:t});try{const s=await fetch(`/api/lessons/${encodeURIComponent(m)}/segment-access`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({targetSegmentId:t})}),l=await s.json().catch(()=>null);if(typeof l?.allowed=="boolean"){const h=Array.isArray(l.gates)?l.gates:[];i({status:l.allowed?"open":"locked",allowed:l.allowed,reason:typeof l.reason=="string"?l.reason:void 0,progress:l.progress,gates:h,visibleSegmentId:typeof l.visibleSegmentId=="string"?l.visibleSegmentId:l.allowed?t:null,segmentId:t});return}i(Z(t,s.ok?"进入条件返回了无法识别的结果":`进入条件暂时无法核对(HTTP ${s.status})`))}catch{i(Z(t,"进入条件服务不可达,已暂时锁定"))}},[m,t]);return v.useEffect(()=>{x()},[x]),v.useEffect(()=>{const s=()=>{x()};window.addEventListener("openlearn:segment-gate-changed",s);const l=G.subscribe("QuizSubmitted",s),h=G.subscribe("assignment.submitted",s);return()=>{window.removeEventListener("openlearn:segment-gate-changed",s),l(),h()}},[x]),v.useEffect(()=>{if(c.status!=="locked"||!m||!t)return;const s=window.setInterval(()=>{x()},5e3);return()=>window.clearInterval(s)},[c.status,m,t,x]),c}function Ie({isOpen:m,onClose:t,classId:c,lessonId:i,studentId:x,lang:s="zh",onCheckinSuccess:l,addToast:h}){const[b,a]=v.useState(null),[n,p]=v.useState(!1),[u,y]=v.useState(null),d=s==="zh";if(v.useEffect(()=>{m&&y(null)},[m]),!m)return null;const g=async r=>{const f=b;if(f){if(!c){y(d?"未检测到当前班级信息,暂时无法打卡":"No class found, unable to check in");return}p(!0),y(null);try{const j=await fetch(`/api/classes/${encodeURIComponent(c)}/checkin/icebreaker`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({mood:f,lessonId:i||void 0})});if(!j.ok){const z=await j.json().catch(()=>({}));throw new Error(z.error||`HTTP ${j.status}`)}const S=await j.json();try{const z=`icebreaker_checked_${x||"cur"}_${c}_${i||"today"}`;sessionStorage.setItem(z,f)}catch{}h&&h(d?"打卡成功!":"Check-in successful!",d?"老师已收到你的课前心态,祝本节课收获满满~":"Your mood has been shared with teacher.","success"),l&&l(S.stats),t()}catch(j){y(j.message||(d?"打卡失败,请重试":"Check-in failed, please retry"))}finally{p(!1)}}},k=()=>{try{const r=`icebreaker_skipped_${x||"cur"}_${c}_${i||"today"}`;sessionStorage.setItem(r,"1")}catch{}t()},w=[{id:"fullPower",label:d?"充满电":"Full Power",sub:d?"精力充沛,准备好迎接挑战!":"Energetic and ready to learn!",icon:e.jsx(be,{className:"w-6 h-6 text-amber-500 animate-pulse"}),color:"hover:border-amber-400 hover:bg-amber-50/50 dark:hover:bg-amber-950/20",activeBorder:"border-amber-500 ring-2 ring-amber-400/30",activeBg:"bg-amber-50/80 dark:bg-amber-950/40"},{id:"needCoffee",label:d?"需要咖啡":"Need Coffee",sub:d?"稍显疲倦,需要唤醒状态~":"A bit tired, getting warmed up~",icon:e.jsx(ge,{className:"w-6 h-6 text-amber-700 dark:text-amber-300"}),color:"hover:border-amber-600 hover:bg-amber-50/50 dark:hover:bg-amber-950/20",activeBorder:"border-amber-600 ring-2 ring-amber-600/30",activeBg:"bg-amber-50/80 dark:bg-amber-950/40"},{id:"needHelp",label:d?"需要帮助":"Need Help",sub:d?"有点吃力,希望老师重点关照!":"Need support, please guide me!",icon:e.jsx(fe,{className:"w-6 h-6 text-rose-500"}),color:"hover:border-rose-400 hover:bg-rose-50/50 dark:hover:bg-rose-950/20",activeBorder:"border-rose-500 ring-2 ring-rose-400/30",activeBg:"bg-rose-50/80 dark:bg-rose-950/40"}];return e.jsx("div",{"data-testid":"student-icebreaker-modal",className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-xs animate-in fade-in duration-200",role:"dialog","aria-modal":"true","aria-labelledby":"icebreaker-title",children:e.jsxs("div",{className:"relative w-full max-w-md rounded-2xl bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-800 shadow-2xl p-6 overflow-hidden",children:[e.jsx("div",{className:"absolute -top-16 -right-16 w-36 h-36 bg-amber-400/10 rounded-full blur-2xl pointer-events-none"}),e.jsx("div",{className:"absolute -bottom-16 -left-16 w-36 h-36 bg-indigo-500/10 rounded-full blur-2xl pointer-events-none"}),e.jsxs("div",{className:"flex items-start justify-between pb-3 border-b border-gray-100 dark:border-gray-800/80",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xl",children:"✨"}),e.jsx("h2",{id:"icebreaker-title",className:"text-lg font-bold text-gray-900 dark:text-gray-100",children:d?"课前破冰心情打卡":"Pre-Class Icebreaker"})]}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:d?"分享你此刻的心态,帮助老师更好地调整上课节奏":"Share your status so the teacher can tailor the lesson"})]}),e.jsx("button",{type:"button",onClick:k,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 p-1 rounded-lg transition-colors cursor-pointer","aria-label":d?"跳过":"Skip",children:e.jsx(ue,{size:18})})]}),u&&e.jsxs("div",{className:"mt-3 p-2.5 rounded-lg bg-rose-50 dark:bg-rose-950/40 border border-rose-200 dark:border-rose-900/50 text-rose-700 dark:text-rose-300 text-xs flex items-center gap-2",children:[e.jsx("span",{className:"shrink-0",children:"⚠️"}),e.jsx("span",{children:u})]}),e.jsx("div",{className:"mt-4 space-y-2.5",children:w.map(r=>{const f=b===r.id;return e.jsxs("button",{type:"button","data-testid":`mood-option-${r.id}`,onClick:()=>a(r.id),className:`w-full text-left p-3.5 rounded-xl border transition-all cursor-pointer flex items-center justify-between gap-3 ${f?`${r.activeBorder} ${r.activeBg}`:`border-gray-200 dark:border-gray-800 bg-gray-50/50 dark:bg-gray-800/40 ${r.color}`}`,children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"shrink-0 p-2 rounded-lg bg-white dark:bg-gray-800 shadow-2xs border border-gray-100 dark:border-gray-700",children:r.icon}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:r.label}),e.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate mt-0.5",children:r.sub})]})]}),f&&e.jsx(xe,{size:18,className:"shrink-0 text-indigo-600 dark:text-indigo-400"})]},r.id)})}),e.jsxs("div",{className:"mt-6 pt-3 border-t border-gray-100 dark:border-gray-800/80 flex items-center justify-between gap-3",children:[e.jsx("button",{type:"button","data-testid":"icebreaker-skip-btn",onClick:k,className:"text-xs text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 px-3 py-2 rounded-lg transition-colors cursor-pointer",children:d?"稍后再说 / 跳过":"Skip for now"}),e.jsx("button",{type:"button","data-testid":"icebreaker-submit-btn",disabled:!b||n,onClick:()=>g(),className:`inline-flex items-center justify-center gap-1.5 px-5 py-2 rounded-xl text-xs font-bold transition-all shadow-xs cursor-pointer ${!b||n?"bg-gray-200 dark:bg-gray-800 text-gray-400 cursor-not-allowed":"bg-indigo-600 hover:bg-indigo-700 text-white shadow-indigo-500/20"}`,children:n?e.jsxs(e.Fragment,{children:[e.jsx(he,{size:14,className:"animate-spin"}),e.jsx("span",{children:d?"提交中...":"Submitting..."})]}):e.jsx("span",{children:d?"确认打卡":"Check In"})})]})]})})}function He(m){const{students:t,activeStudentId:c,isStudentLocked:i=!1,isNavigationLocked:x,isInteractionLocked:s,lockMode:l,setStudentViewStatus:h,setSelectedLesson:b,lessons:a,selectedLesson:n,studentFullscreenPanel:p,setStudentFullscreenPanel:u,timelineSegments:y,lang:d,activeSegmentId:g,setActiveSegmentId:k,localProgressPercent:w,setLocalProgressPercent:r,updateStudentProgress:f,isStudentLessonContentCollapsed:j,setIsStudentLessonContentCollapsed:S,studentLessonTab:z,setStudentLessonTab:F,elements:B,activeRole:P,fetchElements:H,currentVfsParent:W,setCurrentVfsParent:R,vfsNodes:$,studentSelectedCourseware:C,setStudentSelectedCourseware:E,addToast:I}=m,N=ze(n,g),_=!!g&&(N.status==="idle"||N.status==="loading")||N.status==="locked"&&!N.visibleSegmentId,o=N.status==="locked"&&N.visibleSegmentId?N.visibleSegmentId:g,[ae,U]=v.useState(!1),[oe,ie]=v.useState(null),K=ee(L=>L.activeSession),T=oe||(K?.lessonId===n?K.classId:null);return v.useEffect(()=>{if(!(!T||!n))try{const L=`icebreaker_checked_${c||"cur"}_${T}_${n}`,O=`icebreaker_skipped_${c||"cur"}_${T}_${n}`;!sessionStorage.getItem(L)&&!sessionStorage.getItem(O)&&U(!0)}catch{}},[T,n,c]),v.useEffect(()=>{if(!n||typeof fetch!="function")return;let L=!1;const O=async()=>{try{const Q=await fetch(`/api/classroom/sessions/${encodeURIComponent(n)}`,{credentials:"same-origin"});if(!Q.ok||L)return;const Y=await Q.json(),D=Y?.session?.current_segment_id,J=Y?.session?.class_id;J&&typeof J=="string"&&ie(J),typeof D=="string"&&D&&D!==g&&k(D)}catch{}};O();const le=window.setInterval(()=>{O()},2500);return()=>{L=!0,window.clearInterval(le)}},[n,g,k]),e.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[e.jsx(we,{students:t,activeStudentId:c,isStudentLocked:x??i,lockMode:l,setStudentViewStatus:h,setSelectedLesson:b,lessons:a,selectedLesson:n,addToast:I,lang:d,onOpenIcebreaker:()=>U(!0)}),e.jsx(je,{lessonId:n,lang:d,addToast:I}),e.jsx(Ce,{access:N,lang:d}),e.jsxs("div",{className:"flex-1 flex gap-6 min-h-0 bg-surface border border-theme rounded-xl p-4 shadow-sm text-main",children:[e.jsx(Ne,{students:t,activeStudentId:c,isStudentLocked:i,studentFullscreenPanel:p,setStudentFullscreenPanel:u,timelineSegments:y,lang:d,activeSegmentId:g,setActiveSegmentId:k,localProgressPercent:w,setLocalProgressPercent:r,updateStudentProgress:f,selectedLesson:n,lessons:a,isStudentLessonContentCollapsed:j,addToast:I,segmentAccess:N}),e.jsx(Se,{isStudentLocked:i,isNavigationLocked:x,isInteractionLocked:s,lockMode:l,studentLessonTab:z,setStudentLessonTab:F,isStudentLessonContentCollapsed:j,setIsStudentLessonContentCollapsed:S,lang:d,studentFullscreenPanel:p,setStudentFullscreenPanel:u,selectedLesson:n,elements:B,activeRole:P,activeSegmentId:g,contentSegmentId:o,blockSegmentContent:_,setActiveSegmentId:k,fetchElements:H,currentVfsParent:W,setCurrentVfsParent:R,vfsNodes:$,studentSelectedCourseware:C,setStudentSelectedCourseware:E,activeStudentId:c,studentName:t.find(L=>L.id===c)?.name??null,classId:T,addToast:I})]}),e.jsx(A,{slot:"student.lesson.notes_addon",slotProps:{lessonId:n,studentId:c,activeSegmentId:g,lang:d}}),e.jsx(A,{slot:"student.lesson.toolbox",slotProps:{lessonId:n,studentId:c,lang:d}}),e.jsx(Ie,{isOpen:ae,onClose:()=>U(!1),classId:T,lessonId:n,studentId:c,lang:d,addToast:I})]})}export{He as StudentLessonView};
|