1import{r as a,j as e}from"./react-vendor-DDlTsOEd.js";import{d as N,k as w,C as g,s as v,af as z,j as C}from"./index-dMYrr1t8.js";import{A as S}from"./AdminLayout-C0t6TWD9.js";import{S as p}from"./skeleton-DXQeB_cl.js";import"./megaphone-CG_Y22E9.js";import"./clipboard-check-H9MOfMyT.js";import"./database-BMcpOIuo.js";import"./tag-CsU2rQcC.js";import"./credit-card-CV_Lm4ZC.js";function D(){const[o,h]=a.useState([]),[d,f]=a.useState(!0),[c,b]=a.useState(""),[y,j]=a.useState(null);a.useEffect(()=>{N.get("/admin/quizzes-all").then(s=>h(s.data??[])).finally(()=>f(!1))},[]);const x=o.filter(s=>{const t=c.toLowerCase();return!t||s.question.toLowerCase().includes(t)||s.courseTitle.toLowerCase().includes(t)||s.lessonTitle.toLowerCase().includes(t)}),i={};for(const s of x){const t=s.courseTitle;i[t]||(i[t]=[]),i[t].push(s)}return e.jsx(S,{children:e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Quizzes"}),e.jsx("p",{className:"text-sm text-gray-900 mt-0.5",children:d?"â¦":`${o.length} questions across all courses`})]}),e.jsx(w,{href:"/admin/courses",children:e.jsxs("button",{className:"flex items-center gap-2 bg-indigo-600 hover:bg-indigo-700 text-white text-sm font-medium px-4 py-2 rounded-lg transition-colors",children:[e.jsx(g,{size:15})," Add Quiz in Builder"]})})]}),e.jsxs("div",{className:"relative max-w-md",children:[e.jsx(v,{size:15,className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-900"}),e.jsx("input",{value:c,onChange:s=>b(s.target.value),placeholder:"Search questions...",className:"w-full pl-9 pr-4 py-2 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-indigo-200"})]}),d?e.jsx("div",{className:"space-y-3",children:Array.from({length:5}).map((s,t)=>e.jsxs("div",{className:"bg-white rounded-xl p-4 shadow-sm border border-gray-100",children:[e.jsx(p,{className:"h-4 w-3/4 bg-gray-100 mb-2"}),e.jsx(p,{className:"h-3 w-1/3 bg-gray-100"})]},t))}):x.length===0?e.jsxs("div",{className:"bg-white rounded-xl p-12 text-center shadow-sm border border-gray-100",children:[e.jsx(g,{size:36,className:"text-gray-900 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-900 text-sm",children:"No quiz questions found"})]}):Object.entries(i).map(([s,t])=>e.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden",children:[e.jsxs("div",{className:"px-5 py-3.5 border-b border-gray-100 bg-gray-50 flex items-center justify-between",children:[e.jsx("span",{className:"font-semibold text-gray-900 text-sm",children:s}),e.jsxs("span",{className:"text-xs text-gray-900 bg-white border border-gray-200 px-2.5 py-1 rounded-full",children:[t.length," questions"]})]}),e.jsx("div",{className:"divide-y divide-gray-50",children:t.map(r=>{let m=[];try{m=JSON.parse(r.options)}catch{}const n=y===r.id;return e.jsxs("div",{className:"px-5 py-3.5",children:[e.jsxs("button",{onClick:()=>j(n?null:r.id),className:"w-full text-left flex items-start justify-between gap-3 group",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900 group-hover:text-indigo-700 transition-colors",children:r.question}),e.jsx("p",{className:"text-xs text-gray-900 mt-1",children:r.lessonTitle})]}),n?e.jsx(z,{size:14,className:"text-gray-900 shrink-0 mt-0.5"}):e.jsx(C,{size:14,className:"text-gray-900 shrink-0 mt-0.5"})]}),n&&e.jsxs("div",{className:"mt-3 space-y-1.5",children:[m.map((l,u)=>e.jsxs("div",{className:`flex items-center gap-2.5 px-3 py-2 rounded-lg text-sm ${l===r.correctAnswer?"bg-emerald-50 border border-emerald-200 text-emerald-800":"bg-gray-50 text-gray-900"}`,children:[e.jsx("span",{className:`w-5 h-5 rounded-full flex items-center justify-center text-[11px] font-bold shrink-0 ${l===r.correctAnswer?"bg-emerald-500 text-white":"bg-gray-200 text-gray-900"}`,children:String.fromCharCode(65+u)}),l]},u)),r.explanation&&e.jsxs("div",{className:"mt-2 px-3 py-2 bg-blue-50 rounded-lg text-xs text-blue-700 border border-blue-100",children:[e.jsx("span",{className:"font-semibold",children:"Explanation: "}),r.explanation]})]})]},r.id)})})]},s))]})})}export{D 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.