PageSourceSearch

https://www.faithassembly.org.uk/assets/KingsMenQAModerator-BQjU6OKs.js

js faithassembly.org.uk collected 2026-10-03 19:01:07 UTC 4,404 bytes, 1 lines download raw bytes

1import{r as h,j as e,bg as p,ag as n}from"./vendor-BFIOfVip.js";import{S as N,c as l}from"./index-BWk9MH7v.js";import{r as c,o as w,W as v,Z as Q}from"./vendor-firebase-IWWIlHC2.js";import{bZ as A,eS as b,bL as M,ax as j}from"./vendor-icons-BjlO8Ivt.js";import"./vendor-motion-C4-LgF0B.js";const R=()=>{const[x,m]=h.useState([]);h.useEffect(()=>{const s=c(l,"KingsMen2026Questions"),t=w(s,a=>{const d=a.val();if(d){const f=Object.keys(d).map(r=>({id:r,...d[r]})).sort((r,y)=>y.timestamp-r.timestamp);m(f)}else m([])});return()=>t()},[]);const u=async(s,t)=>{try{const a=c(l,`KingsMen2026Questions/${s}`);await v(a,{answered:!t}),n.success(t?"Marked as unanswered":"Marked as answered")}catch(a){n.error("Failed to update status"),console.error(a)}},g=async s=>{if(window.confirm("Are you sure you want to delete this question?"))try{const t=c(l,`KingsMen2026Questions/${s}`);await Q(t),n.success("Question deleted")}catch(t){n.error("Failed to delete question"),console.error(t)}},i=x.filter(s=>!s.answered),o=x.filter(s=>s.answered);return e.jsxs("div",{className:"bg-gray-50 min-h-screen p-8",children:[e.jsx(N,{defaultTitle:"Moderate Q&A - King's Men 2026"}),e.jsxs("div",{className:"max-w-5xl mx-auto",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-8",children:[e.jsx(A,{className:"text-4xl text-blue-600"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900",children:"King's Men 2026 Q&A Moderator"}),e.jsx("p",{className:"text-gray-600",children:"Review, moderate, and mark questions as answered."})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-xl font-bold text-gray-800 mb-4 border-b pb-2 flex justify-between",children:["Pending Questions",e.jsx("span",{className:"bg-blue-100 text-blue-800 text-sm py-1 px-3 rounded-full",children:i.length})]}),e.jsx("div",{className:"space-y-4",children:i.length===0?e.jsx("p",{className:"text-gray-500 italic",children:"No pending questions."}):i.map(s=>e.jsxs("div",{className:"bg-white p-5 rounded-xl shadow-sm border border-gray-200",children:[e.jsx("p",{className:"text-gray-800 text-lg mb-3",children:s.text}),e.jsxs("div",{className:"flex justify-between items-center text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 text-gray-500",children:[s.isAnonymous?e.jsx(b,{className:"text-gray-400"}):e.jsx("span",{className:"font-semibold",children:s.author}),s.isAnonymous&&"Anonymous"," • ",p(s.timestamp,{addSuffix:!0})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:()=>u(s.id,s.answered),className:"bg-green-100 text-green-700 hover:bg-green-200 px-3 py-1.5 rounded-lg font-medium transition-colors flex items-center gap-1",children:[e.jsx(M,{})," Mark Answered"]}),e.jsx("button",{onClick:()=>g(s.id),className:"bg-red-50 text-red-600 hover:bg-red-100 p-2 rounded-lg transition-colors",title:"Delete Question",children:e.jsx(j,{})})]})]})]},s.id))})]}),e.jsxs("div",{children:[e.jsxs("h2",{className:"text-xl font-bold text-gray-800 mb-4 border-b pb-2 flex justify-between",children:["Answered Questions",e.jsx("span",{className:"bg-green-100 text-green-800 text-sm py-1 px-3 rounded-full",children:o.length})]}),e.jsx("div",{className:"space-y-4",children:o.length===0?e.jsx("p",{className:"text-gray-500 italic",children:"No answered questions yet."}):o.map(s=>e.jsxs("div",{className:"bg-gray-50 p-5 rounded-xl border border-gray-200 opacity-75 hover:opacity-100 transition-opacity",children:[e.jsx("p",{className:"text-gray-600 text-lg mb-3 line-through decoration-gray-300",children:s.text}),e.jsxs("div",{className:"flex justify-between items-center text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 text-gray-500",children:[s.isAnonymous?e.jsx(b,{className:"text-gray-400"}):e.jsx("span",{className:"font-semibold",children:s.author}),s.isAnonymous&&"Anonymous"," • ",p(s.timestamp,{addSuffix:!0})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>u(s.id,s.answered),className:"bg-gray-200 text-gray-700 hover:bg-gray-300 px-3 py-1.5 rounded-lg font-medium transition-colors",children:"Unmark"}),e.jsx("button",{onClick:()=>g(s.id),className:"bg-red-50 text-red-600 hover:bg-red-100 p-2 rounded-lg transition-colors",title:"Delete Question",children:e.jsx(j,{})})]})]})]},s.id))})]})]})]})]})};export{R 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.