1import{r as e,j as n}from"./vendor-react-BH6F5oQJ.js";import{H as t,C as s,M as a,N as i,m as o,f as r,D as c}from"./index-C_oSc_qP.js";import{A as d}from"./AdminLayout-DnnQLcVN.js";import{u as l}from"./usePages-DATyJ6bv.js";import{T as m,a as j,b as h,c as u}from"./tabs-m_pU4RZL.js";import{L as x}from"./LazyRichTextEditor-CXLEt1G2.js";import{u as p}from"./useActivityLogger-C6jwQw68.js";import{u as v}from"./useAdminActivityNotifications-COZyAecB.js";import"./vendor-ui-B4WC06Sp.js";import"./vendor-icons-CaI5__By.js";import"./vendor-query-CC4VRGyP.js";import"./vendor-supabase-COwyE4EW.js";import"./separator-Cc2qsRsv.js";import"./index-CCdGLatk.js";import"./Combination-DzDAyqvK.js";import"./index-B3FPD4RS.js";import"./en-US-DUAJ-5Wt.js";import"./index-D5Ei2fSx.js";const g=()=>{const{pages:g,loading:f,updatePage:C,refetch:N}=l({realtime:!0}),{logActivity:w}=p();v();const[y,b]=e.useState("news-media"),M=g.find(e=>"news-media"===e.slug),S=g.find(e=>"partners"===e.slug),A=g.find(e=>"contact"===e.slug),P=g.find(e=>"audio-video"===e.slug),V=e=>e?"string"==typeof e?e:e.html?e.html:"":"",[k,D]=e.useState(V(null==M?void 0:M.content)),[L,T]=e.useState(V(null==S?void 0:S.content)),[W,E]=e.useState(V(null==A?void 0:A.content)),[O,R]=e.useState(V(null==P?void 0:P.content)),U=async(e,n)=>{const t=g.find(n=>n.slug===e);if(!t)return void c({title:"Error",description:"Page not found",variant:"destructive"});const s=V(t.content),a="object"==typeof t.content&&null!==t.content?{...t.content,html:n}:n;await C(t.id,{content:a}),await N(),await w({activityType:"page_update",entityType:"page",entityId:t.id,entityName:t.title,actionDescription:`Updated page content: ${t.title}`,oldValues:{content:s},newValues:{content:n}})};return f?n.jsx("div",{className:"flex h-screen items-center justify-center",children:n.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):n.jsxs(d,{children:[n.jsxs(t,{children:[n.jsx("meta",{name:"robots",content:"noindex,nofollow"}),n.jsx("title",{children:"Manage Pages - Admin - Delphi Global Research Center"})]}),n.jsx("div",{className:"p-6",children:n.jsxs("div",{className:"max-w-7xl mx-auto",children:[n.jsx("h1",{className:"text-3xl font-bold mb-6",children:"Manage Pages"}),n.jsxs(m,{value:y,onValueChange:b,children:[n.jsxs(j,{className:"mb-6",children:[n.jsx(h,{value:"news-media",children:"News & Media"}),n.jsx(h,{value:"partners",children:"Our Partners"}),n.jsx(h,{value:"contact",children:"Contact"}),n.jsx(h,{value:"audio-video",children:"Audio/Video"})]}),n.jsx(u,{value:"news-media",forceMount:!0,className:"news-media"!==y?"hidden":"",children:n.jsxs(s,{children:[n.jsx(a,{children:n.jsx(i,{children:"News & Media Content"})}),n.jsxs(o,{children:[n.jsx(x,{content:k,onChange:D,placeholder:"Write news and media content..."}),n.jsx(r,{onClick:()=>U("news-media",k),className:"mt-4",children:"Save Changes"})]})]})}),n.jsx(u,{value:"partners",forceMount:!0,className:"partners"!==y?"hidden":"",children:n.jsxs(s,{children:[n.jsx(a,{children:n.jsx(i,{children:"Our Partners Content"})}),n.jsxs(o,{children:[n.jsx(x,{content:L,onChange:T,placeholder:"Write our partners content..."}),n.jsx(r,{onClick:()=>U("partners",L),className:"mt-4",children:"Save Changes"})]})]})}),n.jsx(u,{value:"contact",forceMount:!0,className:"contact"!==y?"hidden":"",children:n.jsxs(s,{children:[n.jsx(a,{children:n.jsx(i,{children:"Contact Content"})}),n.jsxs(o,{children:[n.jsx(x,{content:W,onChange:E,placeholder:"Write contact content..."}),n.jsx(r,{onClick:()=>U("contact",W),className:"mt-4",children:"Save Changes"})]})]})}),n.jsx(u,{value:"audio-video",forceMount:!0,className:"audio-video"!==y?"hidden":"",children:n.jsxs(s,{children:[n.jsx(a,{children:n.jsx(i,{children:"Audio/Video Content"})}),n.jsxs(o,{children:[n.jsx(x,{content:O,onChange:R,placeholder:"Write audio/video content..."}),n.jsx(r,{onClick:()=>U("audio-video",O),className:"mt-4",children:"Save Changes"})]})]})})]})]})})]})};export{g 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.