1import{a as e}from"./rolldown-runtime-DOG2APjf.js";import{i as s,t}from"./react-core-CchioXwE.js";import{t as a}from"./queryKeys-IU4Wi3pN.js";import{t as l}from"./useQuery-CS559GLG.js";import{n}from"./api-Bo2_vrwo.js";import{r as i}from"./Skeleton-C7RXEkZz.js";import{N as r,Q as o,S as m,at as d,gt as c,h as x,k as u,p,rt as h,ut as j,z as f}from"./index-hmhQZAEy.js";import{t as g}from"./PageHeader-DzkpeGVa.js";import{r as y,t as b}from"./hooks-CKc9ymoO.js";import{t as N}from"./examinationLookup-C99lgOoc.js";var v=e(s(),1),_=t(),E={Scheduled:{variant:"info",label:"Scheduled"},Completed:{variant:"success",label:"Completed"},Cancelled:{variant:"neutral",label:"Cancelled"}};function C(){const{user:e}=x(),s=b(),{data:t,isLoading:C}=l({queryKey:a.enrollments.list({status:"CONFIRMED"}),queryFn:()=>n.listEnrollments({status:"CONFIRMED",limit:100}),enabled:!!e?.user_id,staleTime:p.MEDIUM}),{data:k}=l({queryKey:a.enrollments.list({status:"COMPLETED"}),queryFn:()=>n.listEnrollments({status:"COMPLETED",limit:100}),enabled:!!e?.user_id,staleTime:p.MEDIUM}),M=(0,v.useMemo)(()=>{const e=t?.enrollments?.map(e=>e.enrollment_id)??[],s=k?.enrollments?.map(e=>e.enrollment_id)??[];return[...new Set([...e,...s])]},[t,k]),S=l({queryKey:a.examinations.lookup({enrollment_ids:M}),queryFn:()=>N(M),enabled:M.length>0,staleTime:p.SHORT}),w=S.data??[],q=C||S.isLoading,D=S.error,F=w.filter(e=>"Scheduled"===e.status),T=w.filter(e=>"Completed"===e.status),L=w.filter(e=>"Cancelled"===e.status),O=e=>{const t=E[e.status]??E.Cancelled;return(0,_.jsx)(c,{variant:"dark",className:"p-6",children:(0,_.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,_.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,_.jsx)("p",{className:"text-text-on-dark font-serif text-lg font-semibold",children:e.course_title||"Examination"}),(0,_.jsxs)("div",{className:"text-text-muted flex items-center gap-2 text-sm",children:[(0,_.jsx)(j,{className:"h-4 w-4"}),(0,_.jsx)("span",{children:y(e.examination_date,s)})]}),e.examiner_google_meet_link&&"Scheduled"===e.status&&(0,_.jsxs)("a",{href:e.examiner_google_meet_link,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 rounded-lg border border-blue-500/30 bg-blue-500/10 px-3 py-1.5 text-sm text-blue-400 hover:bg-blue-500/20 hover:text-blue-300",children:[(0,_.jsx)(f,{className:"h-4 w-4"}),"Join Google Meet"]}),"Completed"===e.status&&e.decision&&(0,_.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:["Pass"===e.decision?(0,_.jsx)(d,{className:"h-4 w-4 text-green-400"}):(0,_.jsx)(h,{className:"h-4 w-4 text-red-400"}),(0,_.jsx)("span",{className:"text-text-on-dark font-semibold",children:e.decision})]})]}),(0,_.jsx)(r,{variant:t.variant,size:"sm",dot:!0,children:t.label})]})},e.examination_id)},P=(e,s)=>0===s.length?null:(0,_.jsxs)("div",{className:"space-y-4",children:[(0,_.jsx)("h2",{className:"text-text-on-dark font-serif text-xl font-bold",children:e}),(0,_.jsx)("div",{className:"space-y-4",children:s.map(O)})]});return(0,_.jsxs)("div",{children:[(0,_.jsx)(g,{title:"My Examinations",description:"View your scheduled, completed, and cancelled examinations."}),D&&(0,_.jsx)(u,{message:D.message||"Failed to load examinations."}),q&&(0,_.jsx)(i,{}),!q&&0===w.length&&!D&&(0,_.jsx)(m,{icon:o,title:"No Examinations",description:"You don't have any examinations yet. Schedule an exam from the Schedule Exam page."}),!q&&w.length>0&&(0,_.jsxs)("div",{className:"space-y-8",children:[P("Upcoming",F),P("Past",T),P("Cancelled",L)]})]})}export{C as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.