1import{j as e}from"./app-C1iegf7Q.js";import{h as y,b as g,H as S,f as n}from"./inertia-BpyZy4w-.js";import{B as r}from"./button-BE4q1_FS.js";import{S as _,e as C,f as w,a as P,c as o}from"./select-Bn8hgKYl.js";import{a as H}from"./admin-layout-BhXWbUlP.js";import{a as p}from"./utils-BiuKVCuu.js";import{C as j}from"./circle-check-big-AJlsIacq.js";import{E as z}from"./eye-off-MvQ-AuyG.js";import{T as A}from"./trash-2-CrI9a2Po.js";import{S as R}from"./star-C_kjJuSS.js";/* empty css */import"./index-CGXdj8xB.js";import"./index-BdQq_4o_.js";import"./index-Dc_FVRD7.js";import"./index-B0NHTN87.js";import"./index-C48dRAib.js";import"./index-BDqbV96p.js";import"./index-Cja0wFUH.js";import"./index-CL12STDK.js";import"./Combination-Cr5kvm8y.js";import"./index-C_n-C52S.js";import"./index-D4vO54bj.js";import"./index-BRU_LjHB.js";import"./index-XydtsrKA.js";import"./index-Cs5D2gCo.js";import"./index-DyGg2PJd.js";import"./chevron-down-B1YaU0K5.js";import"./createLucideIcon-wqc1LSWg.js";import"./check-0O-UND6N.js";import"./chevron-up-CLp5HMgA.js";import"./app-logo-Dz0wogSq.js";import"./logo-light-DU4bWymm.js";import"./flash-toast-C6O0iVL1.js";import"./info-D2ZN_yLm.js";import"./triangle-alert-C7AVwNi-.js";import"./circle-x-Bp6Mbpgt.js";import"./circle-check-BMWvzPMx.js";import"./x-DQSeRCcH.js";import"./arrow-left-DCX0fhKH.js";import"./menu-BR3Nc3Gr.js";import"./users-BCcupCXV.js";import"./folder-open-I72SPUVk.js";import"./pound-sterling-D16GLaAZ.js";import"./book-open-DVFlG_9t.js";const E={pending:{label:"Pending",tint:"bg-amber/12 text-amber-ink"},published:{label:"Published",tint:"bg-green/10 text-green-ink"},hidden:{label:"Hidden",tint:"bg-ink/8 text-ink-3"}};function B({rating:c}){return e.jsx("div",{className:"flex items-center gap-0.5",children:[1,2,3,4,5].map(s=>e.jsx(R,{className:p("h-3.5 w-3.5",s<=c?"fill-amber text-amber":"fill-none text-ink-3")},s))})}function _e(){const{props:c}=y(),{reviews:s,stats:a,filters:l}=c,[f,m]=g.useState(null),[x,u]=g.useState(""),h=(t,i)=>{n.get("/admin/reviews",{...l,[t]:i||void 0},{preserveState:!0,preserveScroll:!0})},b=t=>{n.post(`/admin/reviews/${t}/publish`,{},{preserveScroll:!0})},k=t=>{n.post(`/admin/reviews/${t}/hide`,{notes:x},{preserveScroll:!0,onSuccess:()=>{m(null),u("")}})},N=t=>{confirm("Delete this review permanently?")&&n.delete(`/admin/reviews/${t}`,{preserveScroll:!0})};return e.jsxs(H,{children:[e.jsx(S,{title:"Reviews"}),e.jsxs("div",{className:"mx-auto max-w-5xl space-y-6 px-4 py-8 sm:px-6",children:[e.jsxs("div",{children:[e.jsx("div",{className:"mb-1 text-2xs font-semibold tracking-eyebrow text-ink-3 uppercase",children:"Admin"}),e.jsx("h1",{className:"font-serif text-3xl font-normal tracking-display text-ink",children:"Reviews"}),e.jsx("p",{className:"mt-1 text-sm text-ink-2",children:"Moderate provider and platform reviews."})]}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[[{key:"",label:"All",count:a.pending+a.published+a.hidden},{key:"pending",label:"Pending",count:a.pending},{key:"published",label:"Published",count:a.published},{key:"hidden",label:"Hidden",count:a.hidden}].map(({key:t,label:i,count:d})=>e.jsxs("button",{onClick:()=>h("status",t),className:p("rounded-full border px-3 py-1 text-xs font-medium transition-colors",l.status===t?"border-ink bg-ink text-white":"border-line bg-white text-ink-2 hover:border-ink-2 hover:text-ink"),children:[i," ",e.jsx("span",{className:"ml-1 font-normal tabular-nums",children:d})]},i)),e.jsxs(_,{value:l.type||"all",onValueChange:t=>h("type",t==="all"?"":t),children:[e.jsx(C,{className:"h-7 w-36 text-xs",children:e.jsx(w,{placeholder:"All types"})}),e.jsxs(P,{children:[e.jsx(o,{value:"all",children:"All types"}),e.jsx(o,{value:"provider",children:"Provider"}),e.jsx(o,{value:"tool",children:"Tool"}),e.jsx(o,{value:"event",children:"Event"}),e.jsx(o,{value:"resource",children:"Resource"})]})]})]}),s.data.length===0?e.jsx("div",{className:"rounded-card border border-dashed border-line-strong bg-white px-6 py-10 text-center",children:e.jsx("p",{className:"text-sm text-ink-2",children:"No reviews match these filters."})}):e.jsx("div",{className:"space-y-3",children:s.data.map(t=>{const i=E[t.status],d=f===t.uuid;return e.jsx("div",{className:"overflow-hidden rounded-card border border-line bg-white",children:e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(B,{rating:t.rating}),e.jsx("span",{className:p("rounded-full px-1.5 py-0.5 text-2xs uppercase tracking-pill",i.tint),children:i.label}),e.jsx("span",{className:"rounded-full border border-line px-1.5 py-0.5 text-2xs text-ink-3 uppercase tracking-pill",children:t.type}),t.is_verified&&e.jsxs("span",{className:"flex items-center gap-0.5 text-2xs text-teal",children:[e.jsx(j,{className:"h-3 w-3"})," Verified"]})]}),e.jsxs("p",{className:"text-xs text-ink-2",children:["For"," ",e.jsx("span",{className:"font-medium text-ink",children:t.reviewable_title}),t.user&&e.jsxs(e.Fragment,{children:[" · by ",e.jsx("span",{className:"font-medium text-ink",children:t.user.name})," (",t.user.email,")"]}),e.jsxs("span",{className:"text-ink-3",children:[" · ",new Date(t.created_at).toLocaleDateString("en-GB",{dateStyle:"medium"})]})]}),t.title&&e.jsx("p",{className:"text-sm font-semibold text-ink",children:t.title}),t.body&&e.jsx("p",{className:"text-sm text-ink-2 whitespace-pre-wrap",children:t.body}),t.admin_notes&&e.jsxs("p",{className:"mt-1 text-xs text-ink-3 italic",children:["Admin note: ",t.admin_notes]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.status!=="published"&&e.jsxs(r,{size:"sm",variant:"outline",onClick:()=>b(t.uuid),className:"text-green-ink hover:text-green-ink",children:[e.jsx(j,{className:"mr-1 h-3.5 w-3.5"}),"Publish"]}),t.status!=="hidden"&&e.jsxs(r,{size:"sm",variant:"outline",onClick:()=>m(d?null:t.uuid),className:"text-ink-2",children:[e.jsx(z,{className:"mr-1 h-3.5 w-3.5"}),"Hide"]}),e.jsx(r,{size:"sm",variant:"outline",onClick:()=>N(t.uuid),className:"text-red hover:text-red",children:e.jsx(A,{className:"h-3.5 w-3.5"})})]})]}),d&&e.jsxs("div",{className:"mt-3 flex items-start gap-2 border-t border-line pt-3",children:[e.jsx("input",{autoFocus:!0,value:x,onChange:v=>u(v.target.value),placeholder:"Reason for hiding (optional)",className:"min-w-0 flex-1 rounded border border-line px-2.5 py-1.5 text-sm text-ink placeholder:text-ink-3 focus:border-ink focus:outline-none"}),e.jsx(r,{size:"sm",onClick:()=>k(t.uuid),children:"Confirm hide"}),e.jsx(r,{size:"sm",variant:"outline",onClick:()=>m(null),children:"Cancel"})]})]})},t.uuid)})}),s.last_page>1&&e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsx(r,{variant:"outline",size:"sm",onClick:()=>s.current_page>1&&n.get("/admin/reviews",{...l,page:s.current_page-1}),disabled:s.current_page<=1,children:"Previous"}),e.jsxs("span",{className:"text-sm text-ink-2",children:["Page ",s.current_page," of ",s.last_page]}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>s.current_page<s.last_page&&n.get("/admin/reviews",{...l,page:s.current_page+1}),disabled:s.current_page>=s.last_page,children:"Next"})]})]})]})}export{_e 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.