1import{r as o,j as e,af as V,dh as R,a7 as U}from"./react-core-DVe2fPV4.js";import{av as W,bT as O,n as k,L as t,S as w,T as $,bU as G,I as r,E as S,G as B,H as T,J as F,K as A,bV as v,B as E}from"./index-8r96zH5D.js";import{C as c,d as i,a as x,b as m,c as L}from"./card--hZxmG4s.js";import"./papaparse-C5j8C8UW.js";import"./dates-BQtghWqJ.js";import"./supabase-DKkXTfsT.js";import"./dompurify-C5KSVp3G.js";const y=500,H=[{value:"accent",label:"Accent (Orange)",color:"#F7941D"},{value:"primary",label:"Primary (Blue)",color:"#1B365D"},{value:"success",label:"Success (Green)",color:"#16a34a"},{value:"warning",label:"Warning (Yellow)",color:"#eab308"},{value:"danger",label:"Danger (Red)",color:"#dc2626"},{value:"dark",label:"Dark",color:"#111827"}],q=[{value:"white",label:"White"},{value:"black",label:"Black"}],z=[{value:"none",label:"No Icon"},{value:"megaphone",label:"Megaphone"},{value:"bell",label:"Bell"},{value:"star",label:"Star"},{value:"alert-circle",label:"Alert Circle"},{value:"info",label:"Info"},{value:"calendar",label:"Calendar"},{value:"sparkles",label:"Sparkles"}],J=[{value:"none",label:"None",description:"Static banner"},{value:"scroll",label:"Scroll (Marquee)",description:"Text scrolls horizontally"},{value:"pulse",label:"Pulse",description:"Subtle pulsing effect"},{value:"fade-cycle",label:"Fade Cycle",description:"Alternates between primary and secondary text"}];function K(){const{data:n,isLoading:M}=W(),j=O(),[s,l]=o.useState({}),[d,_]=o.useState(!1),[u,b]=o.useState(!1),[h,g]=o.useState("#F7941D"),[p,f]=o.useState("#ffffff");o.useEffect(()=>{if(n){l({is_enabled:n.is_enabled,content_primary:n.content_primary,content_secondary:n.content_secondary,link_url:n.link_url,link_text:n.link_text,background_color:n.background_color,text_color:n.text_color,animation_type:n.animation_type,scroll_speed:n.scroll_speed,fade_speed:n.fade_speed,pulse_speed:n.pulse_speed,icon:n.icon,maintenance_enabled:n.maintenance_enabled,maintenance_message:n.maintenance_message});const a=n.background_color.startsWith("#");_(a),a&&g(n.background_color);const C=n.text_color.startsWith("#");b(C),C&&f(n.text_color)}},[n]);const D=()=>{if(!n)return;const a={...s,background_color:d?h:s.background_color,text_color:u?p:s.text_color};j.mutate({id:n.id,updates:a})},P=()=>{n&&l({is_enabled:n.is_enabled,content_primary:n.content_primary,content_secondary:n.content_secondary,link_url:n.link_url,link_text:n.link_text,background_color:n.background_color,text_color:n.text_color,animation_type:n.animation_type,scroll_speed:n.scroll_speed,fade_speed:n.fade_speed,pulse_speed:n.pulse_speed,icon:n.icon,maintenance_enabled:n.maintenance_enabled,maintenance_message:n.maintenance_message})};if(M)return e.jsxs("div",{className:"space-y-6",children:[e.jsx(k,{className:"h-12 w-full"}),e.jsx(k,{className:"h-64 w-full"})]});if(!n)return e.jsx(c,{children:e.jsx(i,{className:"p-6",children:e.jsx("p",{className:"text-muted-foreground",children:"No banner configuration found."})})});const I={is_enabled:s.is_enabled??!0,content_primary:s.content_primary??"",content_secondary:s.content_secondary??null,link_url:s.link_url??null,link_text:s.link_text??null,background_color:d?h:s.background_color??"accent",text_color:u?p:s.text_color??"white",animation_type:s.animation_type??"none",scroll_speed:s.scroll_speed??5,fade_speed:s.fade_speed??5,pulse_speed:s.pulse_speed??5,icon:s.icon??null,maintenance_enabled:s.maintenance_enabled??!1,maintenance_message:s.maintenance_message??""},N=s.maintenance_message??"";return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(c,{className:"border-yellow-500/40",children:[e.jsxs(x,{children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(V,{className:"w-5 h-5 text-yellow-600"}),"Maintenance Notice"]}),e.jsx(L,{children:"Displays a yellow alert strip above the regular banner. Use during deploys or when features may be intermittently broken."})]}),e.jsxs(i,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(t,{htmlFor:"maintenance_enabled",children:"Enable Maintenance Notice"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Shows independently of the main banner toggle."})]}),e.jsx(w,{id:"maintenance_enabled",checked:s.maintenance_enabled??!1,onCheckedChange:a=>l({...s,maintenance_enabled:a})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(t,{htmlFor:"maintenance_message",children:"Message"}),e.jsx($,{id:"maintenance_message",value:N,maxLength:y,rows:3,onChange:a=>l({...s,maintenance_message:a.target.value.slice(0,y)}),placeholder:"The Website is currently undergoing maintenance, some features may not work as intended."}),e.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[N.length,"/",y]})]})]})]}),e.jsxs(c,{children:[e.jsxs(x,{children:[e.jsx(m,{children:"Live Preview"}),e.jsx(L,{children:"See how your banner will look on the site"})]}),e.jsx(i,{className:"p-0 overflow-hidden rounded-b-lg",children:e.jsx(G,{preview:I})})]}),e.jsxs(c,{children:[e.jsx(x,{children:e.jsx(m,{children:"Content Settings"})}),e.jsxs(i,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(t,{htmlFor:"is_enabled",children:"Enable Banner"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Show or hide the banner site-wide"})]}),e.jsx(w,{id:"is_enabled",checked:s.is_enabled??!0,onCheckedChange:a=>l({...s,is_enabled:a})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(t,{htmlFor:"content_primary",children:"Primary Text *"}),e.jsx(r,{id:"content_primary",value:s.content_primary??"",onChange:a=>l({...s,content_primary:a.target.value}),placeholder:"Main banner message"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(t,{htmlFor:"content_secondary",children:"Secondary Text (shown on larger screens)"}),e.jsx(r,{id:"content_secondary",value:s.content_secondary??"",onChange:a=>l({...s,content_secondary:a.target.value||null}),placeholder:"Additional context"})]}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(t,{htmlFor:"link_url",children:"Link URL (optional)"}),e.jsx(r,{id:"link_url",value:s.link_url??"",onChange:a=>l({...s,link_url:a.target.value||null}),placeholder:"/news/article-slug"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(t,{htmlFor:"link_text",children:"Link Text"}),e.jsx(r,{id:"link_text",value:s.link_text??"",onChange:a=>l({...s,link_text:a.target.value||null}),placeholder:"Learn more â"})]})]})]})]}),e.jsxs(c,{children:[e.jsx(x,{children:e.jsx(m,{children:"Style Options"})}),e.jsxs(i,{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(t,{children:"Backgroun
1d Color"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[H.map(a=>e.jsx("button",{type:"button",onClick:()=>{_(!1),l({...s,background_color:a.value})},className:`w-8 h-8 rounded-full border-2 transition-all ${!d&&s.background_color===a.value?"border-foreground scale-110":"border-transparent hover:border-muted-foreground"}`,style:{backgroundColor:a.color},title:a.label},a.value)),e.jsx("button",{type:"button",onClick:()=>_(!0),className:`w-8 h-8 rounded-full border-2 transition-all bg-gradient-to-br from-red-500 via-green-500 to-blue-500 ${d?"border-foreground scale-110":"border-transparent hover:border-muted-foreground"}`,title:"Custom Color"})]}),d&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(r,{type:"color",value:h,onChange:a=>g(a.target.value),className:"w-12 h-10 p-1 cursor-pointer"}),e.jsx(r,{value:h,onChange:a=>g(a.target.value),placeholder:"#F7941D",className:"flex-1"})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(t,{children:"Text Color"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[q.map(a=>e.jsx("button",{type:"button",onClick:()=>{b(!1),l({...s,text_color:a.value})},className:`px-4 py-2 rounded border transition-all ${!u&&s.text_color===a.value?"border-foreground bg-muted":"border-border hover:border-muted-foreground"}`,children:a.label},a.value)),e.jsx("button",{type:"button",onClick:()=>b(!0),className:`px-4 py-2 rounded border transition-all ${u?"border-foreground bg-muted":"border-border hover:border-muted-foreground"}`,children:"Custom"})]}),u&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(r,{type:"color",value:p,onChange:a=>f(a.target.value),className:"w-12 h-10 p-1 cursor-pointer"}),e.jsx(r,{value:p,onChange:a=>f(a.target.value),placeholder:"#ffffff",className:"flex-1"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(t,{children:"Icon"}),e.jsxs(S,{value:s.icon??"none",onValueChange:a=>l({...s,icon:a}),children:[e.jsx(B,{children:e.jsx(T,{})}),e.jsx(F,{children:z.map(a=>e.jsx(A,{value:a.value,children:a.label},a.value))})]})]})]})]}),e.jsxs(c,{children:[e.jsx(x,{children:e.jsx(m,{children:"Animation Effects"})}),e.jsxs(i,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(t,{children:"Animation Type"}),e.jsxs(S,{value:s.animation_type??"none",onValueChange:a=>l({...s,animation_type:a}),children:[e.jsx(B,{children:e.jsx(T,{})}),e.jsx(F,{children:J.map(a=>e.jsx(A,{value:a.value,children:e.jsxs("div",{children:[e.jsx("div",{children:a.label}),e.jsx("div",{className:"text-xs text-muted-foreground",children:a.description})]})},a.value))})]})]}),s.animation_type==="scroll"&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx(t,{children:"Scroll Speed"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:s.scroll_speed??5})]}),e.jsx(v,{value:[s.scroll_speed??5],onValueChange:([a])=>l({...s,scroll_speed:a}),min:1,max:10,step:1}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"Slower"}),e.jsx("span",{children:"Faster"})]})]}),s.animation_type==="fade-cycle"&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx(t,{children:"Fade Speed"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:s.fade_speed??5})]}),e.jsx(v,{value:[s.fade_speed??5],onValueChange:([a])=>l({...s,fade_speed:a}),min:1,max:10,step:1}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"Slower"}),e.jsx("span",{children:"Faster"})]})]}),s.animation_type==="pulse"&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx(t,{children:"Pulse Speed"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:s.pulse_speed??5})]}),e.jsx(v,{value:[s.pulse_speed??5],onValueChange:([a])=>l({...s,pulse_speed:a}),min:1,max:10,step:1}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"Slower"}),e.jsx("span",{children:"Faster"})]})]})]})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsxs(E,{onClick:D,disabled:j.isPending,children:[e.jsx(R,{className:"w-4 h-4 mr-2"}),j.isPending?"Saving...":"Save Changes"]}),e.jsxs(E,{variant:"outline",onClick:P,children:[e.jsx(U,{className:"w-4 h-4 mr-2"}),"Reset"]})]})]})}function ne(){return e.jsxs("div",{className:"max-w-3xl",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-2xl lg:text-3xl font-bold",children:"Site Banner"}),e.jsx("p",{className:"text-muted-foreground",children:"Manage the announcement banner shown at the top of the site"})]}),e.jsx(K,{})]})}
1export{ne 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.