PageSourceSearch

https://sendunlimitedemail.com/sue/mod-CMHwuwZm.js

js sendunlimitedemail.com collected 2026-10-05 06:25:24 UTC 5,082 bytes, 1 lines download raw bytes

1import{r as a,j as e,C as _,e as b,t as m}from"./edge-BOITG1XR.js";import{M as f}from"./mod-CKTOf4qU.js";import{R as S}from"./mod-RPxq32x0.js";import{C as j}from"./mod-B33gStZf.js";import{C as N}from"./mod-gbHpssdV.js";import{C as A}from"./mod-qF7UVkYF.js";const R=["pending","approved","rejected"];function P(){const[s,v]=a.useState("pending"),[x,p]=a.useState([]),[i,y]=a.useState(null),[l,c]=a.useState(1),[w,h]=a.useState(!1),[n,g]=a.useState(null),u=async(t=s,d=l)=>{h(!0);try{const r=await b.get(`/admin/blog-comments?status=${t}&page=${d}`);p(r.data.data||r.data),y(r.data.meta||r.data)}catch{m.error("Failed to load comments")}finally{h(!1)}};a.useEffect(()=>{u(s,l)},[s,l]);const C=t=>{v(t),c(1)},o=async(t,d)=>{g(t);try{await b.put(`/admin/blog-comments/${t}`,{status:d}),m.success(`Comment ${d}`),p(r=>r.filter(k=>k.id!==t))}catch{m.error("Failed to update comment")}finally{g(null)}};return e.jsxs("div",{className:"p-6 max-w-5xl mx-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(f,{className:"h-6 w-6 text-violet-600"}),e.jsx("h1",{className:"text-2xl font-bold text-slate-900",children:"Blog Comments"})]}),e.jsxs("button",{onClick:()=>u(s,l),className:"flex items-center gap-2 text-sm text-slate-500 hover:text-violet-600 transition-colors",children:[e.jsx(S,{className:"h-4 w-4"})," Refresh"]})]}),e.jsx("div",{className:"flex gap-1 mb-6 bg-slate-100 p-1 rounded-xl w-fit",children:R.map(t=>e.jsx("button",{onClick:()=>C(t),className:`px-4 py-1.5 rounded-lg text-sm font-medium capitalize transition-all ${s===t?"bg-white text-violet-700 shadow-sm":"text-slate-500 hover:text-slate-700"}`,children:t},t))}),w?e.jsx("div",{className:"flex justify-center py-16",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-violet-200 border-t-violet-600"})}):x.length===0?e.jsxs("div",{className:"text-center py-16 text-slate-400",children:[e.jsx(f,{className:"h-12 w-12 mx-auto mb-3 opacity-30"}),e.jsxs("p",{children:["No ",s," comments"]})]}):e.jsx("div",{className:"space-y-3",children:x.map(t=>e.jsx("div",{className:"bg-white border border-slate-200 rounded-2xl p-4 shadow-sm",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-1",children:[e.jsx("span",{className:"font-semibold text-sm text-slate-900",children:t.user_name||"User"}),e.jsx("span",{className:"text-xs text-slate-400",children:t.user_email}),e.jsx("span",{className:"text-xs text-slate-300",children:"·"}),e.jsx("a",{href:`/blog/${t.post_slug}`,target:"_blank",rel:"noreferrer",className:"text-xs text-violet-600 hover:underline truncate max-w-[200px]",children:t.post_title}),e.jsx("span",{className:"text-xs text-slate-400 ml-auto",children:new Date(t.created_at).toLocaleDateString("en-AE",{year:"numeric",month:"short",day:"numeric"})})]}),e.jsx("p",{className:"text-sm text-slate-700 leading-relaxed",children:t.comment})]}),s==="pending"&&e.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[e.jsxs("button",{onClick:()=>o(t.id,"approved"),disabled:n===t.id,className:"flex items-center gap-1.5 px-3 py-1.5 bg-emerald-50 hover:bg-emerald-100 text-emerald-700 text-xs font-medium rounded-lg transition-colors disabled:opacity-50",children:[e.jsx(j,{className:"h-3.5 w-3.5"})," Approve"]}),e.jsxs("button",{onClick:()=>o(t.id,"rejected"),disabled:n===t.id,className:"flex items-center gap-1.5 px-3 py-1.5 bg-red-50 hover:bg-red-100 text-red-600 text-xs font-medium rounded-lg transition-colors disabled:opacity-50",children:[e.jsx(N,{className:"h-3.5 w-3.5"})," Reject"]})]}),s==="approved"&&e.jsxs("button",{onClick:()=>o(t.id,"rejected"),disabled:n===t.id,className:"flex items-center gap-1.5 px-3 py-1.5 bg-red-50 hover:bg-red-100 text-red-600 text-xs font-medium rounded-lg transition-colors disabled:opacity-50 flex-shrink-0",children:[e.jsx(N,{className:"h-3.5 w-3.5"})," Reject"]}),s==="rejected"&&e.jsxs("button",{onClick:()=>o(t.id,"approved"),disabled:n===t.id,className:"flex items-center gap-1.5 px-3 py-1.5 bg-emerald-50 hover:bg-emerald-100 text-emerald-700 text-xs font-medium rounded-lg transition-colors disabled:opacity-50 flex-shrink-0",children:[e.jsx(j,{className:"h-3.5 w-3.5"})," Approve"]})]})},t.id))}),i?.last_page>1&&e.jsxs("div",{className:"flex items-center justify-center gap-3 mt-6",children:[e.jsx("button",{onClick:()=>c(t=>Math.max(1,t-1)),disabled:l===1,className:"p-2 rounded-lg border border-slate-200 disabled:opacity-40 hover:bg-slate-50 transition-colors",children:e.jsx(A,{className:"h-4 w-4"})}),e.jsxs("span",{className:"text-sm text-slate-600",children:["Page ",i.current_page," of ",i.last_page]}),e.jsx("button",{onClick:()=>c(t=>Math.min(i.last_page,t+1)),disabled:l===i.last_page,className:"p-2 rounded-lg border border-slate-200 disabled:opacity-40 hover:bg-slate-50 transition-colors",children:e.jsx(_,{className:"h-4 w-4"})})]})]})}export{P 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.