2 lines
3.3 KiB
JavaScript
2 lines
3.3 KiB
JavaScript
import{u as h,r as j,bV as g,j as e,k as u,A as m,bY as f,bZ as N,b_ as b,b$ as w}from"./vendor-BKmmeuxg.js";import{T as C}from"./table-header-DVkEnG6Y.js";import{B as y}from"./badge-AQfLLMpR.js";import{C as l,a as R,c as v,b as T}from"./card-D9_SJYq6.js";import{T as S,a as M,b as n,c as x}from"./table-DWOXv4Pu.js";import B from"./exam-attempt-columns-DvReECYM.js";import"./index-WW_1X1qx.js";import"./utils-DxSsnXxD.js";import"./button-BpNwv2aE.js";import"./dropdown-menu-DO-po5c1.js";import"./route-B4ZMN77y.js";const Z=()=>{var c;const{exam:d,attempts:a,bestAttempt:s}=h().props,[i,p]=j.useState([]),r=g({data:a||[],columns:B((d==null?void 0:d.id)??0,s==null?void 0:s.id),onSortingChange:p,getCoreRowModel:w(),getSortedRowModel:b(),getFilteredRowModel:N(),state:{sorting:i}});return!a||a.length===0?e.jsx("div",{className:"flex h-full items-center justify-center rounded-lg border border-dashed text-center",children:e.jsxs("div",{className:"space-y-2 p-10",children:[e.jsx(u,{className:"text-muted-foreground mx-auto h-10 w-10"}),e.jsx("h2",{className:"text-xl font-semibold",children:"No attempts yet"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Your exam attempts will appear here once you start the exam."})]})}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[e.jsx(l,{className:"p-4",children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Total Attempts"}),e.jsx("p",{className:"text-2xl font-bold",children:a.length})]})}),e.jsx(l,{className:"p-4",children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Completed"}),e.jsx("p",{className:"text-2xl font-bold text-green-600",children:a.filter(t=>t.status==="completed").length})]})}),e.jsx(l,{className:"p-4",children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"In Progress"}),e.jsx("p",{className:"text-2xl font-bold text-blue-600",children:a.filter(t=>t.status==="in_progress").length})]})}),e.jsx(l,{className:"p-4",children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Best Score"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-2xl font-bold text-purple-600",children:s==null?void 0:s.obtained_marks}),s&&e.jsx(m,{className:"h-5 w-5 text-amber-500"})]})]})})]}),e.jsxs(l,{children:[e.jsxs(R,{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[e.jsx(v,{className:"text-xl font-semibold",children:"Exam Attempts"}),s&&e.jsxs(y,{variant:"secondary",className:"flex items-center gap-1 bg-amber-100 text-amber-700",children:[e.jsx(m,{className:"h-4 w-4"}),"Best Score ",s.obtained_marks]})]}),e.jsx(T,{className:"p-0",children:e.jsxs(S,{className:"border-border border-y",children:[e.jsx(C,{table:r}),e.jsx(M,{children:(c=r.getRowModel().rows)!=null&&c.length?r.getRowModel().rows.map(t=>e.jsx(n,{"data-state":t.getIsSelected()&&"selected",children:t.getVisibleCells().map(o=>e.jsx(x,{children:f(o.column.columnDef.cell,o.getContext())},o.id))},t.id)):e.jsx(n,{children:e.jsx(x,{colSpan:r.getAllColumns().length,className:"h-24 text-center",children:"No exam attempts found."})})})]})})]})]})};export{Z as default};
|