PageSourceSearch

https://www.faithassembly.org.uk/assets/QuizManager-CTCTdEh4.js

js faithassembly.org.uk collected 2026-09-25 13:55:48 UTC 3,405 bytes, 1 lines download raw bytes

1import{r,j as e,ad as a}from"./vendor-BFIOfVip.js";import{m as p}from"./index-CKRbob3g.js";import{ae as g,bz as y,eT as b,dz as f,ax as j}from"./vendor-icons-BjlO8Ivt.js";import"./vendor-motion-C4-LgF0B.js";import"./vendor-firebase-dJP658Hw.js";const q=()=>{const{getQuizzes:d,createSession:l,deleteQuiz:c}=p(),[i,x]=r.useState([]),[m,o]=r.useState(!0);r.useEffect(()=>{n()},[]);const n=async()=>{o(!0);try{const t=await d();x(t)}catch(t){console.error("Failed to load quizzes",t)}finally{o(!1)}},u=async t=>{if(confirm("Start this quiz session?"))try{const s=await l(t);window.open(`/admin/quiz/host/${s}`,"_blank")}catch{alert("Error starting quiz")}},h=async t=>{if(confirm("Are you sure you want to delete this quiz? This action cannot be undone."))try{await c(t),n()}catch{alert("Error deleting quiz")}};return e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex justify-between items-center mb-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Quiz Manager"}),e.jsx("p",{className:"text-gray-500",children:"Create and host interactive quizzes"})]}),e.jsxs(a,{to:"/admin/quiz/create",className:"bg-purple-600 hover:bg-purple-700 text-white px-4 py-2 rounded-lg flex items-center gap-2 font-medium transition-colors",children:[e.jsx(g,{})," New Quiz"]})]}),m?e.jsx("div",{className:"text-center py-12 text-gray-400",children:"Loading quizzes..."}):e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[i.length===0&&e.jsxs("div",{className:"col-span-full text-center py-12 bg-gray-50 rounded-xl border-2 border-dashed border-gray-200",children:[e.jsx(y,{className:"mx-auto text-4xl text-gray-300 mb-4"}),e.jsx("h3",{className:"text-gray-900 font-medium",children:"No Quizzes Yet"}),e.jsx("p",{className:"text-gray-500 mb-4",children:"Create your first quiz to get started"}),e.jsx(a,{to:"/admin/quiz/create",className:"text-purple-600 font-bold hover:underline",children:"Create Quiz"})]}),i.map(t=>e.jsx("div",{className:"bg-white border border-gray-200 rounded-xl shadow-sm overflow-hidden hover:shadow-md transition-shadow",children:e.jsxs("div",{className:"p-5",children:[e.jsxs("div",{className:"flex justify-between items-start mb-4",children:[e.jsx("span",{className:"px-2 py-1 bg-purple-100 text-purple-700 rounded-lg text-xs font-bold uppercase tracking-wider",children:t.category}),e.jsxs("span",{className:"text-gray-400 text-xs font-mono",children:[t.questions.length," Qs"]})]}),e.jsx("h3",{className:"text-lg font-bold text-gray-900 mb-2",children:t.title}),e.jsx("p",{className:"text-sm text-gray-500 mb-6 line-clamp-2",children:t.description||"No description provided."}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:()=>u(t.id),className:"flex-1 bg-gradient-to-r from-purple-600 to-indigo-600 text-white py-2 rounded-lg text-sm font-bold flex items-center justify-center gap-2 hover:opacity-90 transition-opacity",children:[e.jsx(b,{})," Host Live"]}),e.jsx(a,{to:`/admin/quiz/edit/${t.id}`,className:"px-3 py-2 border border-gray-200 text-gray-600 rounded-lg hover:bg-gray-50 transition-colors",title:"Edit Quiz",children:e.jsx(f,{})}),e.jsx("button",{onClick:()=>h(t.id),className:"px-3 py-2 border border-gray-200 text-red-600 rounded-lg hover:bg-red-50 transition-colors",title:"Delete Quiz",children:e.jsx(j,{})})]})]})},t.id))]})]})};export{q 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.