module.exports=[14548,a=>{"use strict";let b=(0,a.i(70106).default)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);a.s(["Save",()=>b],14548)},85669,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(10849),e=a.i(14548);function f(){let[a,f]=(0,c.useState)([]),[g,h]=(0,c.useState)(!0),[i,j]=(0,c.useState)(!1),[k,l]=(0,c.useState)("");(0,c.useEffect)(()=>{!async function(){let{data:a}=await d.supabase.from("carousel_slides").select("*").order("order"),b=a||[];f([0,1,2,3].map(a=>b[a]||{title:"",image_url:"",link:"/catalog",order:a+1})),h(!1)}()},[]);let m=async()=>{for(let b of(j(!0),a)){let a={title:b.title,image_url:b.image_url,link:b.link,order:b.order};b.id?await d.supabase.from("carousel_slides").update(a).eq("id",b.id):await d.supabase.from("carousel_slides").insert(a)}l("Carousel saved successfully!"),j(!1),setTimeout(()=>l(""),3e3)},n=(a,b,c)=>{f(d=>d.map((d,e)=>e===a?{...d,[b]:c}:d))};return(0,b.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,b.jsxs)("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h1",{className:"text-2xl font-bold text-gray-900 tracking-tight",children:"Hero Carousel"}),(0,b.jsx)("p",{className:"text-gray-500 text-sm mt-1",children:"Manage the 4 homepage hero slides"})]}),(0,b.jsx)("button",{onClick:m,disabled:i,className:"flex items-center justify-center gap-2 bg-brand-primary hover:bg-brand-primary/90 text-white font-semibold px-5 py-2.5 rounded-xl text-sm transition-all shadow-sm hover:shadow-md hover:scale-105 disabled:opacity-50 w-full sm:w-auto",children:i?(0,b.jsx)("div",{className:"w-5 h-5 border-2 border-white/30 border-t-white rounded-full animate-spin"}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(e.Save,{className:"w-5 h-5"})," Save Changes"]})})]}),k&&(0,b.jsxs)("div",{className:"bg-green-50 border border-green-200 rounded-xl px-5 py-4 text-green-700 font-medium text-sm flex items-center gap-2",children:[(0,b.jsx)("div",{className:"w-2 h-2 rounded-full bg-green-500 animate-pulse"}),k]}),g?(0,b.jsx)("p",{className:"text-gray-500",children:"Loading carousel data..."}):(0,b.jsx)("div",{className:"flex flex-col gap-6",children:a.map((a,c)=>(0,b.jsxs)("div",{className:"bg-white border border-gray-200 rounded-2xl p-6 sm:p-8 shadow-sm",children:[(0,b.jsxs)("h3",{className:"text-sm font-bold mb-5 text-gray-900 uppercase tracking-wider flex items-center gap-2",children:[(0,b.jsx)("span",{className:"w-6 h-6 rounded-full bg-brand-primary/10 text-brand-primary flex items-center justify-center text-xs",children:c+1}),"Slide ",c+1]}),(0,b.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-5",children:[{label:"Title",key:"title",placeholder:"Modern.\nConvenient.\nPractical"},{label:"Image URL",key:"image_url",placeholder:"https://..."},{label:"Button Link",key:"link",placeholder:"/catalog"}].map(({label:d,key:e,placeholder:f})=>(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-sm font-medium text-gray-700 block mb-1.5",children:d}),"title"===e?(0,b.jsx)("textarea",{value:a[e],onChange:a=>n(c,e,a.target.value),placeholder:f,rows:2,className:"w-full bg-white border border-gray-200 rounded-xl px-4 py-3 text-sm text-gray-900 outline-none focus:border-brand-primary focus:ring-1 focus:ring-brand-primary transition-all placeholder:text-gray-400 resize-none h-[46px]"}):(0,b.jsx)("input",{type:"text",value:a[e],onChange:a=>n(c,e,a.target.value),placeholder:f,className:"w-full bg-white border border-gray-200 rounded-xl px-4 py-3 text-sm text-gray-900 outline-none focus:border-brand-primary focus:ring-1 focus:ring-brand-primary transition-all placeholder:text-gray-400"})]},e))}),a.image_url&&(0,b.jsxs)("div",{className:"mt-6 relative h-40 sm:h-48 rounded-xl overflow-hidden border border-gray-200 group",children:[(0,b.jsx)("img",{src:a.image_url,alt:"preview",className:"w-full h-full object-cover transition-transform duration-500 group-hover:scale-105",onError:a=>a.currentTarget.style.display="none"}),(0,b.jsx)("div",{className:"absolute inset-0 bg-gradient-to-t from-black/60 to-transparent flex items-end p-4",children:(0,b.jsx)("span",{className:"text-white text-xs font-medium uppercase tracking-wider backdrop-blur-md bg-white/20 px-3 py-1 rounded-full border border-white/20",children:"Preview Live"})})]})]},c))})]})}a.s(["default",()=>f])}];

//# sourceMappingURL=_974ffc35._.js.map