PageSourceSearch

https://outreachfox.ai/assets/admin.authors-C32wgaOt.js

js outreachfox.ai collected 2026-10-05 14:13:25 UTC 4,760 bytes, 1 lines download raw bytes

1import{I as f,D as d,at as v,au as j,av as N,r as l,j as t}from"./index-DBKklgJg.js";import{u as y}from"./useQuery-BgJ0pvkj.js";import{A as k}from"./AdminHeader-BhKW5nNM.js";import"./useBaseQuery-C3OIK63l.js";function E(){const o=f(),c=d(v),m=d(j),h=d(N),s=y({queryKey:["authors"],queryFn:()=>c()}),[n,i]=l.useState(null),[r,a]=l.useState({id:"",slug:"",name:"",designation:"",bio:"",avatar_url:"",twitter:"",linkedin:""}),[u,x]=l.useState(null);l.useEffect(()=>{if(!n){a({id:null,slug:"",name:"",designation:"",bio:"",avatar_url:"",twitter:"",linkedin:""});return}const e=(s.data?.authors??[]).find(b=>b.id===n);e&&a({id:e.id,slug:e.slug,name:e.name,designation:e.designation??"",bio:e.bio??"",avatar_url:e.avatar_url??"",twitter:e.social_links?.twitter??"",linkedin:e.social_links?.linkedin??""})},[n,s.data]);async function g(){x(null);try{await m({data:{id:r.id,slug:r.slug,name:r.name,designation:r.designation,bio:r.bio,avatar_url:r.avatar_url,social_links:{...r.twitter?{twitter:r.twitter}:{},...r.linkedin?{linkedin:r.linkedin}:{}}}}),o.invalidateQueries({queryKey:["authors"]}),i(null)}catch(e){x(e instanceof Error?e.message:String(e))}}async function p(e){confirm("Delete this author?")&&(await h({data:{id:e}}),o.invalidateQueries({queryKey:["authors"]}))}return t.jsxs("div",{className:"min-h-screen bg-background",children:[t.jsx(k,{}),t.jsxs("main",{className:"max-w-6xl mx-auto px-4 md:px-6 py-10 grid gap-8 lg:grid-cols-[1fr_360px]",children:[t.jsxs("section",{children:[t.jsx("h1",{className:"text-2xl font-semibold text-ink",children:"Authors"}),t.jsx("div",{className:"mt-6 rounded-2xl border border-border bg-card overflow-hidden",children:s.isLoading?t.jsx("p",{className:"p-10 text-sm text-center text-muted-foreground",children:"Loading…"}):(s.data?.authors??[]).length===0?t.jsx("p",{className:"p-10 text-sm text-center text-muted-foreground",children:"No authors yet."}):t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{className:"bg-secondary/50 text-xs uppercase tracking-wide text-muted-foreground",children:t.jsxs("tr",{children:[t.jsx("th",{className:"text-left px-4 py-3",children:"Name"}),t.jsx("th",{className:"text-left px-4 py-3",children:"Slug"}),t.jsx("th",{className:"text-left px-4 py-3",children:"Designation"}),t.jsx("th",{className:"px-4 py-3"})]})}),t.jsx("tbody",{children:(s.data?.authors??[]).map(e=>t.jsxs("tr",{className:"border-t border-border",children:[t.jsx("td",{className:"px-4 py-3 font-medium text-ink",children:e.name}),t.jsx("td",{className:"px-4 py-3 text-muted-foreground font-mono text-xs",children:e.slug}),t.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:e.designation??"—"}),t.jsxs("td",{className:"px-4 py-3 text-right",children:[t.jsx("button",{onClick:()=>i(e.id),className:"text-xs underline text-ink mr-3",children:"Edit"}),t.jsx("button",{onClick:()=>p(e.id),className:"text-xs text-destructive hover:underline",children:"Delete"})]})]},e.id))})]})})]}),t.jsxs("aside",{className:"rounded-2xl border border-border bg-card p-5 space-y-3 h-fit",children:[t.jsx("h2",{className:"text-sm font-semibold text-ink",children:n?"Edit author":"New author"}),t.jsx("input",{value:r.name,onChange:e=>a({...r,name:e.target.value}),placeholder:"Full name",className:"w-full rounded-lg border border-border px-3 py-2 text-sm"}),t.jsx("input",{value:r.slug,onChange:e=>a({...r,slug:e.target.value}),placeholder:"slug-like-this",className:"w-full rounded-lg border border-border px-3 py-2 text-sm font-mono"}),t.jsx("input",{value:r.designation,onChange:e=>a({...r,designation:e.target.value}),placeholder:"Designation / role",className:"w-full rounded-lg border border-border px-3 py-2 text-sm"}),t.jsx("input",{value:r.avatar_url,onChange:e=>a({...r,avatar_url:e.target.value}),placeholder:"Avatar URL",className:"w-full rounded-lg border border-border px-3 py-2 text-xs"}),t.jsx("textarea",{value:r.bio,onChange:e=>a({...r,bio:e.target.value}),placeholder:"Short bio",rows:4,className:"w-full rounded-lg border border-border px-3 py-2 text-sm"}),t.jsx("input",{value:r.twitter,onChange:e=>a({...r,twitter:e.target.value}),placeholder:"Twitter URL",className:"w-full rounded-lg border border-border px-3 py-2 text-xs"}),t.jsx("input",{value:r.linkedin,onChange:e=>a({...r,linkedin:e.target.value}),placeholder:"LinkedIn URL",className:"w-full rounded-lg border border-border px-3 py-2 text-xs"}),u&&t.jsx("p",{className:"text-xs text-destructive",children:u}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("button",{onClick:g,className:"flex-1 rounded-lg bg-ink text-white text-sm py-2 hover:bg-ink/90",children:"Save"}),n&&t.jsx("button",{onClick:()=>i(null),className:"text-xs text-muted-foreground",children:"Cancel"})]})]})]})]})}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.