import{r,d as h,t as l,j as a,H as j,aj as f,f as p}from"./vendor-laZsiqLO.js";import{A as g}from"./AdminLayout-Cg-VwQ1I.js";import{S as y}from"./SettingsLayout-nVJO7Ep3.js";import{C as _,a as b,b as k,c as C,d as S,e as v}from"./card-BKDXjfy_.js";import{I as i}from"./input-CT5MkJwj.js";import{L as o}from"./label-BDbCc0wv.js";import{B as N}from"./button-B8f8jW4H.js";import"./utils-RgT4yCq8.js";import"./admin-D0dR58a0.js";import"./bootstrap-CBwglqL9.js";/* empty css            */import"./dropdown-menu-CpMN0BZ0.js";import"./sheet-Cp4V1hdh.js";import"./avatar-1RNhlzAH.js";import"./useFlashMessages-CQoLOBuv.js";import"./separator-DMopkgTA.js";function G(){const[c,u]=r.useState(!0),[n,d]=r.useState(!1),[s,m]=r.useState({social_facebook:"",social_twitter:"",social_instagram:"",social_youtube:"",social_tiktok:""});r.useEffect(()=>{h.get("/api/admin/settings/social").then(e=>m(e.data)).catch(()=>l.error("Failed to load settings")).finally(()=>u(!1))},[]);const t=e=>{m({...s,[e.target.id]:e.target.value})},x=async e=>{e.preventDefault(),d(!0);try{await h.post("/api/admin/settings/social",s),l.success("Social links updated!")}catch{l.error("Failed to update.")}finally{d(!1)}};return a.jsxs(g,{header:"Settings",children:[a.jsx(j,{title:"Social Media Settings"}),a.jsx(y,{children:a.jsxs(_,{children:[a.jsxs(b,{children:[a.jsxs(k,{className:"flex items-center gap-2",children:[a.jsx(f,{className:"w-5 h-5 text-primary"})," Social Connections"]}),a.jsx(C,{children:"Manage the links displayed in the footer and sidebar."})]}),a.jsx(S,{children:c?a.jsx("div",{className:"py-8 flex justify-center",children:a.jsx(p,{className:"animate-spin"})}):a.jsxs("form",{id:"social-form",onSubmit:x,className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(o,{htmlFor:"social_facebook",children:"Facebook URL"}),a.jsx(i,{id:"social_facebook",value:s.social_facebook||"",onChange:t,placeholder:"https://facebook.com/..."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(o,{htmlFor:"social_twitter",children:"X (Twitter) URL"}),a.jsx(i,{id:"social_twitter",value:s.social_twitter||"",onChange:t,placeholder:"https://x.com/..."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(o,{htmlFor:"social_instagram",children:"Instagram URL"}),a.jsx(i,{id:"social_instagram",value:s.social_instagram||"",onChange:t,placeholder:"https://instagram.com/..."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(o,{htmlFor:"social_youtube",children:"YouTube URL"}),a.jsx(i,{id:"social_youtube",value:s.social_youtube||"",onChange:t,placeholder:"https://youtube.com/..."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(o,{htmlFor:"social_tiktok",children:"TikTok URL"}),a.jsx(i,{id:"social_tiktok",value:s.social_tiktok||"",onChange:t,placeholder:"https://tiktok.com/..."})]})]})}),a.jsx(v,{className:"border-t px-6 py-4",children:a.jsxs(N,{type:"submit",form:"social-form",disabled:n||c,children:[n&&a.jsx(p,{className:"mr-2 h-4 w-4 animate-spin"}),"Save Changes"]})})]})})]})}export{G as default};
