"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[69344],{69344:(e,s,a)=>{a.r(s),a.d(s,{default:()=>o});var t=a(95155),l=a(12115),r=a(30571),i=a(30313),n=a(75560),m=a(2581);let d={PENDING:"Pending",SUBMITTED:"Submitted",CHECKED:"Checked",LATE:"Late",MISSING:"Missing"},c={PENDING:"bg-slate-100 text-slate-700",SUBMITTED:"bg-sky-50 text-sky-800",CHECKED:"bg-emerald-50 text-emerald-800",LATE:"bg-amber-50 text-amber-800",MISSING:"bg-rose-50 text-rose-800"};function o(){let[e,s]=(0,l.useState)([]),[a,o]=(0,l.useState)(!0);return(0,l.useEffect)(()=>{let e=!1;return(0,n.aA)().then(a=>{e||s(a)}).catch(s=>{e||(0,m.Qg)(s instanceof Error?s.message:"Failed to load homework")}).finally(()=>{e||o(!1)}),()=>{e=!0}},[]),(0,t.jsx)(r.o,{title:"Homework",description:"Assignments for your class, with your evaluation status.",children:a?(0,t.jsx)("div",{className:"space-y-3 animate-pulse",children:Array.from({length:3}).map((e,s)=>(0,t.jsx)("div",{className:"h-28 rounded-lg bg-slate-100"},s))}):0===e.length?(0,t.jsx)(i.i0,{title:"No homework yet",description:"When teachers assign work to your class, it will appear here."}):(0,t.jsx)("ul",{className:"space-y-3",children:e.map(e=>(0,t.jsx)("li",{children:(0,t.jsxs)("div",{className:"rounded-lg border border-slate-100 bg-white p-4 shadow-sm sm:p-5",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("p",{className:"font-semibold text-slate-900",children:e.title}),(0,t.jsxs)("p",{className:"mt-1 text-xs text-slate-500",children:[e.subject?.name||"General",e.assignedDate?` \xb7 Assigned ${e.assignedDate}`:"",e.dueDate?` \xb7 Due ${e.dueDate}`:"",null!=e.maxMarks?` \xb7 Max ${e.maxMarks}`:""]})]}),(0,t.jsxs)("span",{className:`rounded-md px-2 py-0.5 text-xs font-semibold ${c[e.myEvaluation.status]||c.PENDING}`,children:[d[e.myEvaluation.status]||e.myEvaluation.status,null!=e.myEvaluation.marks?` \xb7 ${e.myEvaluation.marks}`:""]})]}),e.description?(0,t.jsx)("p",{className:"mt-3 whitespace-pre-wrap text-sm text-slate-600",children:e.description}):null,e.myEvaluation.remarks?(0,t.jsxs)("p",{className:"mt-2 text-sm text-slate-800",children:["Teacher remark: ",e.myEvaluation.remarks]}):null]})},e.id))})})}}}]);