PageSourceSearch

https://article-directory-submit.com/assets/admin.claims-Bnatqke-.js

js article-directory-submit.com collected 2026-10-05 22:36:48 UTC 4,254 bytes, 1 lines download raw bytes

1import{ak as g,r as j,j as e,L as v}from"./index-W94u19Kp.js";import{u as b}from"./useServerFn-Bx7zQdsG.js";import{u as c}from"./useQuery-JqDDEl5i.js";import{B as x}from"./button-DExCtMpr.js";import{l as N,r as y}from"./claims.functions-BrD-rJ2S.js";import{L as w}from"./loader-circle-C0tOnoZ8.js";import{C as k}from"./check-DSt__0Us.js";import{X as C}from"./x-DXEk6uws.js";import"./createLucideIcon-CQEpjOzL.js";function E(){const s=c({queryKey:["admin-status"],queryFn:()=>g()}),r=c({queryKey:["all-claims"],queryFn:async()=>await N(),enabled:!!s.data?.isAdmin}),a=b(y),[i,l]=j.useState(null);if(s.isLoading||r.isLoading)return e.jsx("div",{className:"grid min-h-screen place-items-center",children:e.jsx(w,{className:"h-6 w-6 animate-spin"})});if(!s.data?.isAdmin)return e.jsx("div",{className:"mx-auto max-w-md p-8 text-center",children:e.jsx("h1",{className:"text-xl font-semibold",children:"Admins only"})});const m=async(t,f)=>{l(t);try{await a({data:{claim_id:t,action:f}}),await r.refetch()}finally{l(null)}},o=r.data?.claims??[],n=o.filter(t=>t.status==="pending"),d=o.filter(t=>t.status!=="pending");return e.jsxs("div",{className:"mx-auto max-w-5xl px-4 py-10 sm:px-6",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"font-display text-3xl font-semibold tracking-tight",children:"Listing Claims"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Approve to verify the listing and grant ownership."})]}),e.jsx(v,{to:"/admin/submissions",className:"text-sm text-muted-foreground hover:text-foreground",children:"← Admin"})]}),e.jsx(u,{title:`Pending (${n.length})`,children:n.length===0?e.jsx(p,{children:"No pending claims."}):n.map(t=>e.jsx(h,{c:t,busy:i===t.id,onAction:m},t.id))}),e.jsx(u,{title:`Reviewed (${d.length})`,children:d.length===0?e.jsx(p,{children:"No reviewed claims yet."}):d.map(t=>e.jsx(h,{c:t,readonly:!0,busy:!1,onAction:m},t.id))})]})}function u({title:s,children:r}){return e.jsxs("section",{className:"mb-8",children:[e.jsx("h2",{className:"mb-3 text-sm font-semibold uppercase tracking-wide text-muted-foreground",children:s}),e.jsx("div",{className:"space-y-3",children:r})]})}function p({children:s}){return e.jsx("div",{className:"rounded-2xl border border-dashed border-border p-6 text-center text-sm text-muted-foreground",children:s})}function h({c:s,busy:r,readonly:a,onAction:i}){return e.jsxs("div",{className:"rounded-2xl border border-border bg-card p-5",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsxs("a",{href:`/${s.listing_slug}`,target:"_blank",rel:"noreferrer",className:"font-semibold text-primary hover:underline",children:["/",s.listing_slug]}),e.jsxs("div",{className:"mt-1 text-sm",children:[e.jsx("strong",{children:s.claimant_name}),s.role?e.jsxs("span",{className:"text-muted-foreground",children:[" · ",s.role]}):null]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[e.jsx("a",{href:`mailto:${s.email}`,className:"hover:underline",children:s.email}),s.phone?e.jsxs(e.Fragment,{children:[" · ",s.phone]}):null,e.jsxs(e.Fragment,{children:[" · ",new Date(s.created_at).toLocaleString()]})]})]}),e.jsx(A,{status:s.status})]}),s.proof&&e.jsxs("div",{className:"mt-3 rounded-md bg-muted/40 p-3 text-sm",children:[e.jsx("div",{className:"mb-1 text-xs uppercase tracking-wide text-muted-foreground",children:"Proof"}),e.jsx("div",{className:"whitespace-pre-wrap",children:s.proof})]}),!a&&s.status==="pending"&&e.jsxs("div",{className:"mt-4 flex gap-2",children:[e.jsxs(x,{size:"sm",onClick:()=>i(s.id,"approve"),disabled:r,children:[e.jsx(k,{className:"mr-1 h-4 w-4"})," Approve"]}),e.jsxs(x,{size:"sm",variant:"outline",onClick:()=>i(s.id,"reject"),disabled:r,children:[e.jsx(C,{className:"mr-1 h-4 w-4"})," Reject"]})]})]})}function A({status:s}){const r={pending:"bg-amber-500/15 text-amber-700 dark:text-amber-400",approved:"bg-emerald-500/15 text-emerald-700 dark:text-emerald-400",rejected:"bg-destructive/15 text-destructive"};return e.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs font-medium ${r[s]??"bg-muted text-muted-foreground"}`,children:s})}export{E as component};

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.