PageSourceSearch

https://whenmomsrise.com/assets/PagesPage-DrUtwBtD.js

js whenmomsrise.com collected 2026-10-09 22:02:55 UTC 4,958 bytes, 6 lines download raw bytes

1import{c as f,H as h,r as g,A as y,j as e,a6 as j,E as v,a4 as d,s as n}from"./index-CXn659ZF.js";import{P as N,T as k}from"./trash-2-BZnp54jS.js";import{E as w}from"./eye-off-DgG5KHLT.js";import{E as C}from"./eye-CgebItAx.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=f("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]),D=()=>{const o=h(),[m,l]=g.useState(!1),[s,i]=g.useState({slug:"",title:""}),{data:u=[]}=y({queryKey:["admin-pages"],queryFn:async()=>{const{data:t}=await n.from("pages").select("*").order("updated_at",{ascending:!1});return t??[]}}),x=async t=>{t.preventDefault();const r=s.slug.trim().toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/^-|-$/g,"");if(!r||!s.title.trim())return d.error("Slug and title required");const{error:a}=await n.from("pages").insert([{slug:r,title:s.title.trim(),status:"draft"}]);if(a)return d.error(a.message);d.success("Page created"),i({slug:"",title:""}),l(!1),o.invalidateQueries({queryKey:["admin-pages"]})},p=async(t,r)=>{const a=r==="published"?"draft":"published",{error:c}=await n.from("pages").update({status:a,published_at:a==="published"?new Date().toISOString():null}).eq("id",t);if(c)return d.error(c.message);await n.from("page_blocks").update({status:a}).eq("page_id",t),d.success(a==="published"?"Published":"Unpublished"),o.invalidateQueries({queryKey:["admin-pages"]})},b=async t=>{if(!confirm("Delete this page and all its blocks?"))return;const{error:r}=await n.from("pages").delete().eq("id",t);if(r)return d.error(r.message);d.success("Deleted"),o.invalidateQueries({queryKey:["admin-pages"]})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"font-heading text-3xl text-foreground",children:"Pages"}),e.jsx("p",{className:"text-muted-foreground text-sm font-body mt-1",children:"Build any page by stacking content blocks."})]}),e.jsxs("button",{onClick:()=>l(t=>!t),className:"inline-flex items-center gap-2 px-4 py-2 bg-primary text-primary-foreground rounded-lg text-sm font-body",children:[e.jsx(N,{size:16})," New page"]})]}),m&&e.jsxs("form",{onSubmit:x,className:"bg-card border border-border rounded-xl p-5 space-y-3",children:[e.jsxs("div",{className:"grid sm:grid-cols-2 gap-3",children:[e.jsx("input",{className:"w-full px-3 py-2 text-sm bg-background border border-border rounded-lg font-body",placeholder:"Title",value:s.title,onChange:t=>i({...s,title:t.target.value})}),e.jsx("input",{className:"w-full px-3 py-2 text-sm bg-background border border-border rounded-lg font-body",placeholder:"slug (e.g. about, home, book)",value:s.slug,onChange:t=>i({...s,slug:t.target.value})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{className:"px-4 py-2 bg-primary text-primary-foreground rounded-lg text-sm font-body",children:"Create draft"}),e.jsx("button",{type:"button",onClick:()=>l(!1),className:"px-4 py-2 bg-muted text-foreground rounded-lg text-sm font-body",children:"Cancel"})]})]}),e.jsxs("div",{className:"space-y-2",children:[u.map(t=>e.jsxs("div",{className:"flex items-center gap-4 p-4 bg-card border border-border rounded-xl",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:`text-[10px] px-2 py-0.5 rounded-full font-body ${t.status==="published"?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"}`,children:t.status==="published"?"Live":"Draft"}),e.jsxs("span",{className:"text-xs font-body text-muted-foreground",children:["/",t.slug]})]}),e.jsx("p",{className:"font-heading text-base text-foreground truncate",children:t.title})]}),e.jsx(j,{to:`/admin/pages/${t.id}`,className:"p-2 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground",title:"Edit",children:e.jsx(P,{size:16})}),e.jsx("a",{href:`/${t.slug==="home"?"":t.slug}`,target:"_blank",rel:"noopener noreferrer",className:"p-2 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground",title:"View",children:e.jsx(v,{size:16})}),e.jsx("button",{onClick:()=>p(t.id,t.status),className:"p-2 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground",title:t.status==="published"?"Unpublish":"Publish",children:t.status==="published"?e.jsx(w,{size:16}):e.jsx(C,{size:16})}),e.jsx("button",{onClick:()=>b(t.id),className:"p-2 rounded-lg hover:bg-destructive/10 text-destructive",title:"Delete",children:e.jsx(k,{size:16})})]},t.id)),u.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground font-body py-8 text-center",children:"No pages yet. Create one to start building."})]})]})};export{D 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.