PageSourceSearch

https://whatsmyip.com/assets/AdminArticleList-e1K1vB8j.js

js whatsmyip.com collected 2026-10-02 15:24:13 UTC 3,320 bytes, 1 lines download raw bytes

1import{m as y,q as C,j as e,H as S,B as a,I as k}from"./index-DMDmnVwu.js";import{d as L,r as s,L as r}from"./vendor-Bd9hyaYX.js";function $(){const d=L(),[l,j]=s.useState([]),[c,g]=s.useState(""),[i,b]=s.useState("all"),[v,o]=s.useState(!0),[u,h]=s.useState(""),[w,N]=s.useState(0);s.useEffect(()=>{let t=!1;return(async()=>{o(!0),h("");try{const{user:n}=await y();if((n==null?void 0:n.role)!=="admin"){d("/auth",{replace:!0});return}const x=[];for(let p=1;;p++){const f=await C({page:p,page_size:100});if(t)return;if(x.push(...f.articles),f.articles.length<100)break}j(x)}catch{t||h("Could not load articles. Check that you are signed in as an administrator, then retry.")}finally{t||o(!1)}})(),()=>{t=!0}},[d,w]);const m=l.filter(t=>(i==="all"||(Number(t.published)===1?"published":"draft")===i)&&`${t.title} ${t.slug}`.toLowerCase().includes(c.toLowerCase()));return e.jsxs("main",{className:"container max-w-5xl mx-auto px-4 py-10",children:[e.jsxs(S,{children:[e.jsx("title",{children:"Manage articles – WhatsMyIP"}),e.jsx("meta",{name:"robots",content:"noindex,nofollow"})]}),e.jsxs("div",{className:"flex flex-wrap justify-between gap-4 mb-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold",children:"Manage articles"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"Your drafts and published articles. Drafts are only available to administrators."})]}),e.jsx(a,{asChild:!0,children:e.jsx(r,{to:"/admin/articles/new",children:"New article"})})]}),e.jsxs("div",{className:"flex flex-wrap gap-3 mb-6",children:[e.jsx(k,{className:"sm:max-w-sm","aria-label":"Search articles",placeholder:"Search title or slug…",value:c,onChange:t=>g(t.target.value)}),e.jsxs("select",{className:"border rounded-md bg-background p-2","aria-label":"Article status",value:i,onChange:t=>b(t.target.value),children:[e.jsxs("option",{value:"all",children:["All articles (",l.length,")"]}),e.jsxs("option",{value:"draft",children:["Drafts (",l.filter(t=>Number(t.published)!==1).length,")"]}),e.jsxs("option",{value:"published",children:["Published (",l.filter(t=>Number(t.published)===1).length,")"]})]})]}),v?e.jsx("p",{role:"status",children:"Loading articles…"}):u?e.jsxs("div",{role:"alert",children:[e.jsx("p",{children:u}),e.jsx(a,{onClick:()=>N(t=>t+1),children:"Retry"}),e.jsx(a,{variant:"link",asChild:!0,children:e.jsx(r,{to:"/auth",children:"Sign in"})})]}):e.jsxs("div",{className:"space-y-3",children:[!m.length&&e.jsx("p",{children:"No articles match this view."}),m.map(t=>e.jsxs("div",{className:"border rounded-lg p-4 flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(r,{className:"font-semibold break-words hover:underline",to:`/admin/articles/edit/${t.id}`,children:t.title||"Untitled"}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:[Number(t.published)===1?"Published":"Draft"," · ",t.category_name||"Uncategorized"]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(a,{asChild:!0,variant:"outline",children:e.jsx(r,{to:`/admin/articles/preview/${t.id}`,target:"_blank",rel:"noopener",children:"Preview"})}),e.jsx(a,{asChild:!0,variant:"outline",children:e.jsx(r,{to:`/admin/articles/edit/${t.id}`,children:"Edit article"})})]})]},t.id))]})]})}export{$ 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.