PageSourceSearch

https://consequential.io/assets/blog-admin.index-DCAyJlq8.js

js consequential.io collected 2026-09-28 05:53:04 UTC 4,222 bytes, 1 lines download raw bytes

1import{c as d,u as h,r as a,w as p,t as b,j as e,L as m,x as j,a as N}from"./index-4GX1WOFb.js";import{u as v}from"./useAuth-BYCZxUgf.js";const y=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],x=d("external-link",y);const w=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],k=d("log-out",w);const _=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],E=d("plus",_);function $(){const{user:t,isEditor:r,loading:n}=v(),o=h(),[l,g]=a.useState([]),[c,f]=a.useState(!0);return a.useEffect(()=>{!n&&!t&&o({to:"/blog-login"})},[n,t,o]),a.useEffect(()=>{r&&p().then(g).catch(s=>b.error(s.message)).finally(()=>f(!1))},[r]),n?e.jsx(i,{children:e.jsx("p",{className:"text-muted-foreground",children:"Loading…"})}):t&&!r?e.jsxs(i,{children:[e.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:"No access yet"}),e.jsxs("p",{className:"mt-3 max-w-md text-sm text-muted-foreground",children:["Your account (",t.email,") is signed in but has not been granted writer access. Ask an admin to add you as an editor."]}),e.jsx(u,{})]}):e.jsxs(i,{children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:"Blog posts"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Drafts stay private. Published posts appear on /blog instantly."})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(u,{}),e.jsxs(m,{to:"/blog-admin/$id",params:{id:"new"},className:"inline-flex items-center gap-2 rounded-sm bg-brand px-4 py-2 text-sm font-semibold text-brand-foreground",children:[e.jsx(E,{className:"h-4 w-4"})," New post"]})]})]}),e.jsxs("div",{className:"mt-8 divide-y divide-border rounded-sm border border-border",children:[c&&e.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"Loading posts…"}),!c&&l.length===0&&e.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"No posts yet. Create your first one."}),l.map(s=>e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 p-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:`rounded-sm px-2 py-0.5 font-semibold uppercase tracking-wide ${s.status==="published"?"bg-brand/15 text-brand":"bg-muted text-muted-foreground"}`,children:s.status}),e.jsx("span",{className:"text-muted-foreground",children:s.category}),s.published_at&&e.jsxs("span",{className:"text-muted-foreground",children:["· ",j(s.published_at)]})]}),e.jsx("p",{className:"mt-1 truncate font-medium",children:s.title}),e.jsxs("p",{className:"truncate text-xs text-muted-foreground",children:["/blog/",s.slug]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[s.status!=="published"&&e.jsxs("a",{href:`/blog/${s.slug}?preview=1`,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground",children:["Preview ",e.jsx(x,{className:"h-3.5 w-3.5"})]}),s.status==="published"&&e.jsxs("a",{href:`/blog/${s.slug}`,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground",children:["View ",e.jsx(x,{className:"h-3.5 w-3.5"})]}),e.jsx(m,{to:"/blog-admin/$id",params:{id:s.id},className:"rounded-sm border border-input px-3 py-1.5 text-sm font-medium hover:bg-card",children:"Edit"})]})]},s.id))]})]})}function u(){const t=h();return e.jsxs("button",{onClick:async()=>{await N.auth.signOut(),t({to:"/blog-login"})},className:"inline-flex items-center gap-2 rounded-sm border border-input px-3 py-2 text-sm text-muted-foreground hover:text-foreground",children:[e.jsx(k,{className:"h-4 w-4"})," Sign out"]})}function i({children:t}){return e.jsx("div",{className:"min-h-screen bg-background px-6 py-12 text-foreground",children:e.jsx("div",{className:"mx-auto max-w-4xl",children:t})})}
1export{$ 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.