PageSourceSearch

https://www.faithassembly.org.uk/assets/BlogManager-DkPkRgFo.js

js faithassembly.org.uk collected 2026-10-03 18:59:40 UTC 6,482 bytes, 1 lines download raw bytes

1import{r,ay as w,j as e,ad as m,bb as y,af as i}from"./vendor-BFIOfVip.js";import{F as v,H as k,m as D,L as P,N as S,w as h,M as C}from"./vendor-firebase-IWWIlHC2.js";import{d as n}from"./index-BWk9MH7v.js";import{bR as H,di as $,dj as M,dk as O,dl as F,dm as A}from"./vendor-icons-BjlO8Ivt.js";import"./vendor-motion-C4-LgF0B.js";const q=()=>{const[s,p]=r.useState([]),[u,b]=r.useState(!0),[d,g]=r.useState("all"),j=w();r.useEffect(()=>{const t=v(D(n,"blog_posts"),k("publishDate","desc")),a=P(t,l=>{const o=l.docs.map(x=>({id:x.id,...x.data()}));p(o),b(!1)});return()=>a()},[]);const f=async(t,a)=>{if(window.confirm(`Are you sure you want to delete "${a}"?`))try{await C(h(n,"blog_posts",t)),i.success("Post deleted successfully")}catch{i.error("Failed to delete post")}},N=async(t,a)=>{const l=a==="published"?"draft":"published";try{await S(h(n,"blog_posts",t),{status:l}),i.success(`Post marked as ${l}`)}catch{i.error("Failed to update status")}},c=s.filter(t=>d==="all"?!0:t.status===d);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-3xl font-black text-slate-900 flex items-center gap-3 uppercase tracking-tight",children:[e.jsx(H,{className:"text-indigo-600"}),"Blog Management"]}),e.jsx("p",{className:"text-slate-500 font-medium",children:"Create and manage Pastor's public articles"})]}),e.jsxs(m,{to:"/admin/super/blog/new",className:"flex items-center gap-2 px-6 py-3 bg-indigo-600 text-white rounded-2xl font-black uppercase tracking-widest text-xs hover:bg-indigo-500 transition shadow-xl shadow-indigo-500/20",children:[e.jsx($,{})," Create New Post"]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"bg-white p-6 rounded-3xl border border-slate-100 shadow-sm",children:[e.jsx("p",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest mb-1",children:"Total Posts"}),e.jsx("p",{className:"text-2xl font-black text-slate-900",children:s.length})]}),e.jsxs("div",{className:"bg-emerald-50 p-6 rounded-3xl border border-emerald-100 shadow-sm",children:[e.jsx("p",{className:"text-[10px] font-black text-emerald-600 uppercase tracking-widest mb-1",children:"Published"}),e.jsx("p",{className:"text-2xl font-black text-emerald-700",children:s.filter(t=>t.status==="published").length})]}),e.jsxs("div",{className:"bg-amber-50 p-6 rounded-3xl border border-amber-100 shadow-sm",children:[e.jsx("p",{className:"text-[10px] font-black text-amber-600 uppercase tracking-widest mb-1",children:"Drafts"}),e.jsx("p",{className:"text-2xl font-black text-amber-700",children:s.filter(t=>t.status==="draft").length})]}),e.jsxs("div",{className:"bg-indigo-50 p-6 rounded-3xl border border-indigo-100 shadow-sm",children:[e.jsx("p",{className:"text-[10px] font-black text-indigo-600 uppercase tracking-widest mb-1",children:"Scheduled"}),e.jsx("p",{className:"text-2xl font-black text-indigo-700",children:s.filter(t=>t.status==="scheduled").length})]})]}),e.jsxs("div",{className:"bg-white p-4 rounded-2xl border border-slate-100 flex items-center gap-2 overflow-x-auto",children:[e.jsx(M,{className:"text-slate-400 mr-2"}),["all","published","draft"].map(t=>e.jsx("button",{onClick:()=>g(t),className:`px-4 py-1.5 rounded-lg text-[10px] font-black uppercase tracking-widest transition ${d===t?"bg-slate-900 text-white":"text-slate-500 hover:bg-slate-50"}`,children:t},t))]}),e.jsx("div",{className:"bg-white rounded-[2.5rem] shadow-xl shadow-slate-200/50 border border-slate-100 overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-slate-50 text-[10px] font-black text-slate-500 uppercase tracking-widest border-b border-slate-100",children:[e.jsx("th",{className:"py-6 px-8",children:"Article"}),e.jsx("th",{className:"py-6 px-6",children:"Status"}),e.jsx("th",{className:"py-6 px-6",children:"Category"}),e.jsx("th",{className:"py-6 px-6",children:"Date"}),e.jsx("th",{className:"py-6 px-8 text-right",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-50",children:u?e.jsx("tr",{children:e.jsx("td",{colSpan:5,className:"py-20 text-center text-slate-400",children:"Loading articles..."})}):c.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:5,className:"py-20 text-center text-slate-400 font-medium",children:"No articles found."})}):c.map(t=>e.jsxs("tr",{className:"hover:bg-slate-50/50 transition group",children:[e.jsxs("td",{className:"py-6 px-8",children:[e.jsx("div",{className:"font-bold text-slate-900 group-hover:text-indigo-600 transition truncate max-w-xs",children:t.title}),e.jsxs("div",{className:"text-[10px] text-slate-400 font-mono",children:["/",t.slug]})]}),e.jsx("td",{className:"py-6 px-6",children:e.jsxs("button",{onClick:()=>N(t.id,t.status),className:`inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-[10px] font-black uppercase tracking-widest border ${t.status==="published"?"bg-emerald-50 text-emerald-600 border-emerald-100":"bg-amber-50 text-amber-600 border-amber-100"}`,children:[e.jsx("div",{className:`w-1.5 h-1.5 rounded-full ${t.status==="published"?"bg-emerald-500":"bg-amber-500"}`}),t.status]})}),e.jsx("td",{className:"py-6 px-6",children:e.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest text-slate-500 bg-slate-100 px-3 py-1 rounded-lg",children:t.category})}),e.jsx("td",{className:"py-6 px-6",children:e.jsx("div",{className:"text-sm font-medium text-slate-600",children:t.publishDate?y(t.publishDate.toDate(),"MMM d, yyyy"):"No date"})}),e.jsx("td",{className:"py-6 px-8 text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2 text-slate-400",children:[e.jsx(m,{to:`/blog/${t.slug}`,target:"_blank",className:"p-2 hover:text-indigo-600 hover:bg-indigo-50 rounded-xl transition",title:"View Publicly",children:e.jsx(O,{className:"w-5 h-5"})}),e.jsx("button",{onClick:()=>j(`/admin/super/blog/edit/${t.id}`),className:"p-2 hover:text-indigo-600 hover:bg-indigo-50 rounded-xl transition",title:"Edit",children:e.jsx(F,{className:"w-5 h-5"})}),e.jsx("button",{onClick:()=>f(t.id,t.title),className:"p-2 hover:text-red-600 hover:bg-red-50 rounded-xl transition",title:"Delete",children:e.jsx(A,{className:"w-5 h-5"})})]})})]},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.