PageSourceSearch

https://healthserve.ae/assets/AdminBlog-Dsp2YTZZ.js

js healthserve.ae collected 2026-10-04 02:40:16 UTC 4,695 bytes, 6 lines download raw bytes

1import{e as C,r as a,j as e,L as i,U as k,k as _,a4 as L,y as n,aO as l}from"./index-CzMEFmtw.js";import{P as S,a as A,C as p}from"./ui-BklIU2Vp.js";import{s as F,a as B}from"./blog-DP5q8ac2.js";import{P as f}from"./plus-DZqQktxt.js";import{T as D}from"./trash-2-gzkfqCHP.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const P=C("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);function H(){const[d,b]=a.useState([]),[y,c]=a.useState(!0),[o,j]=a.useState(""),[r,N]=a.useState("all"),m=async()=>{c(!0);const{data:t,error:s}=await n.from("blog_posts").select("id,title,slug,status,published_at,updated_at,category_id,author_id").order("updated_at",{ascending:!1});s&&l.error(s.message),b(t??[]),c(!1)};a.useEffect(()=>{m()},[]);const x=async()=>{var h;const t=(h=prompt("New post title:"))==null?void 0:h.trim();if(!t)return;const s=B(t),{data:v,error:u}=await n.from("blog_posts").insert({title:t,slug:s,status:"draft"}).select("id").single();if(u)return l.error(u.message);window.location.href=`/admin/blog/${v.id}`},w=async t=>{if(!confirm("Delete this post permanently?"))return;const{error:s}=await n.from("blog_posts").delete().eq("id",t);if(s)return l.error(s.message);l.success("Deleted"),m()},g=a.useMemo(()=>{const t=o.trim().toLowerCase();return d.filter(s=>r!=="all"&&s.status!==r?!1:t?s.title.toLowerCase().includes(t)||s.slug.toLowerCase().includes(t):!0)},[d,o,r]);return e.jsxs(S,{children:[e.jsx(A,{title:"Blog",description:"Create articles, schedule publishing, and manage authors & categories.",actions:e.jsxs(e.Fragment,{children:[e.jsxs(i,{to:"/admin/blog/authors",className:"h-9 px-3 rounded-lg border border-gray-300 text-sm font-semibold flex items-center gap-1.5 hover:bg-gray-50",children:[e.jsx(k,{className:"w-4 h-4"})," Authors"]}),e.jsxs(i,{to:"/admin/blog/categories",className:"h-9 px-3 rounded-lg border border-gray-300 text-sm font-semibold flex items-center gap-1.5 hover:bg-gray-50",children:[e.jsx(P,{className:"w-4 h-4"})," Categories"]}),e.jsxs("button",{onClick:x,className:"h-9 px-3 rounded-lg bg-[#F9A01B] text-white text-sm font-semibold flex items-center gap-1.5 hover:brightness-105",children:[e.jsx(f,{className:"w-4 h-4"})," New post"]})]})}),e.jsxs(p,{className:"p-4 mb-4 flex flex-col sm:flex-row gap-3 sm:items-center",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(_,{size:15,className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),e.jsx("input",{value:o,onChange:t=>j(t.target.value),placeholder:"Search title or slug…",className:"w-full h-9 pl-9 pr-3 rounded-lg border border-gray-200 text-sm bg-white text-gray-900 placeholder:text-gray-400"})]}),e.jsx("div",{className:"flex gap-1.5",children:["all","draft","scheduled","published"].map(t=>e.jsx("button",{onClick:()=>N(t),className:`h-9 px-3 rounded-lg text-xs font-semibold capitalize border ${r===t?"bg-gray-900 text-white border-gray-900":"bg-white text-gray-700 border-gray-200 hover:bg-gray-50"}`,children:t},t))})]}),e.jsx(p,{children:y?e.jsx("div",{className:"p-10 text-sm text-gray-500",children:"Loading…"}):g.length===0?e.jsxs("div",{className:"p-10 text-center",children:[e.jsx("div",{className:"text-sm text-gray-500 mb-3",children:"No posts yet."}),e.jsxs("button",{onClick:x,className:"h-9 px-3 rounded-lg bg-[#F9A01B] text-white text-sm font-semibold inline-flex items-center gap-1.5",children:[e.jsx(f,{className:"w-4 h-4"})," Create your first post"]})]}):e.jsx("div",{className:"divide-y divide-gray-100",children:g.map(t=>e.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 hover:bg-gray-50",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx(i,{to:`/admin/blog/${t.id}`,className:"text-sm font-semibold text-gray-900 hover:text-[#F9A01B] truncate block",children:t.title||"(untitled)"}),e.jsxs("div",{className:"text-xs text-gray-500 truncate",children:["/blog/",t.slug]})]}),e.jsx("span",{className:`text-[11px] font-semibold uppercase tracking-wider px-2 py-1 rounded border ${F(t.status)}`,children:t.status}),t.published_at&&e.jsxs("div",{className:"text-xs text-gray-500 hidden sm:flex items-center gap-1",children:[e.jsx(L,{size:11})," ",new Date(t.published_at).toLocaleDateString()]}),e.jsx("button",{onClick:()=>w(t.id),className:"text-gray-400 hover:text-red-600 p-1",title:"Delete",children:e.jsx(D,{className:"w-4 h-4"})})]},t.id))})})]})}export{H 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.