PageSourceSearch

https://litelinxfiber.com/assets/HeroSlides-CC9BTQNe.js

js litelinxfiber.com collected 2026-10-09 22:18:05 UTC 21,811 bytes, 1 lines download raw bytes

1import{j as e}from"./vendor-Dw1-o7kh.js";import{u as t,r as l}from"./react-BpC26T6t.js";import{s as o,B as a,X as s,n as r,E as i}from"./index-BTs3I-_Y.js";import{I as d}from"./ImageUpload-BljYGLDP.js";import{P as n}from"./plus-C-sL7rnd.js";import{S as c}from"./save-DszisEc6.js";import{E as m}from"./eye-off-_scspYCw.js";import{S as u}from"./square-pen-Dr3ianIY.js";import{A as x,a as g}from"./arrow-up-CvieMSNg.js";import{T as b}from"./trash-2-DLw9R_qY.js";import"./supabase-H1x_w4VC.js";import"./index-CzYlEH6u.js";import"./index-DeeAtTT-.js";import"./storage-D8ZJjjAd.js";import"./upload-CwVcfH0V.js";const h=[{value:"top-left",label:"Top Left"},{value:"top-center",label:"Top Center"},{value:"top-right",label:"Top Right"},{value:"center-left",label:"Center Left"},{value:"center",label:"Center"},{value:"center-right",label:"Center Right"},{value:"bottom-left",label:"Bottom Left"},{value:"bottom-center",label:"Bottom Center"},{value:"bottom-right",label:"Bottom Right"}];function p(){t();const[p,j]=l.useState([]),[y,I]=l.useState(!0),[v,N]=l.useState(null),[_,f]=l.useState(!1),[w,C]=l.useState("all");l.useEffect(()=>{k()},[]);const k=async()=>{try{const{data:e,error:t}=await o.from("hero_slides").select("*").order("display_order",{ascending:!0});if(t)return void alert(`Failed to fetch hero slides: ${t.message}`);j(e||[])}catch(e){alert(`Failed to fetch hero slides: ${e instanceof Error?e.message:"Unknown error"}`)}finally{I(!1)}},M=()=>{const e={id:"",title:"",subtitle:"",description:"",image_url:"",overlay_text:"",show_overlay_text:!0,overlay_position:"center",text_color:"#ffffff",background_overlay_opacity:.3,button_text:"",button_url:"",button_color:"#2B367F",button_text_color:"#ffffff",display_order:p.length,is_active:!0,page_type:"home",created_at:"",updated_at:""};N(e),f(!0)},W=async(e,t)=>{const l=p.findIndex(t=>t.id===e.id),a="up"===t?l-1:l+1;if(a<0||a>=p.length)return;const s=[...p];[s[l],s[a]]=[s[a],s[l]];const r=s.map((e,t)=>({id:e.id,display_order:t}));try{for(const e of r){const{error:t}=await o.from("hero_slides").update({display_order:e.display_order}).eq("id",e.id);if(t)throw t}k()}catch(i){}};return y?e.jsx("div",{className:"flex items-center justify-center min-h-screen",children:e.jsx("div",{className:"text-lg",children:"Loading hero slides..."})}):e.jsxs("div",{className:"max-w-7xl mx-auto p-6",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6",children:[e.jsx("h1",{className:"text-2xl font-bold text-secondary",children:"Hero Slides"}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("select",{value:w,onChange:e=>C(e.target.value),className:"px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary",children:[e.jsx("option",{value:"all",children:"All Pages"}),e.jsx("option",{value:"home",children:"Home Page"}),e.jsx("option",{value:"f360i",children:"F360i Page"}),e.jsx("option",{value:"smart-warehouse",children:"Smart Warehouse Page"}),e.jsx("option",{value:"construction-copilot",children:"Construction Co-Pilot Page"})]}),e.jsxs(a,{onClick:M,children:[e.jsx(n,{className:"h-4 w-4 mr-2"}),"Add Hero Slide"]})]})]}),e.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 mb-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-blue-900 mb-2",children:"How to Use Hero Slides"}),e.jsxs("div",{className:"text-sm text-blue-800 space-y-1",children:[e.jsxs("p",{children:["• ",e.jsx("strong",{children:"Upload Images:"})," Click the upload area in the form or use the upload button on slide cards"]}),e.jsxs("p",{children:["• ",e.jsx("strong",{children:"Manual URLs:"})," You can also paste image URLs directly in the URL field"]}),e.jsxs("p",{children:["• ",e.jsx("strong",{children:"Reorder:"})," Use the up/down arrows to change slide order"]}),e.jsxs("p",{children:["• ",e.jsx("strong",{children:"Toggle Visibility:"})," Use the eye icon to show/hide slides"]}),e.jsxs("p",{children:["• ",e.jsx("strong",{children:"Enable Gallery:"}),' Go to Settings → Portal → Check "Use Hero Gallery on Homepage"']})]})]}),v&&e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:e.jsx("div",{className:"bg-white rounded-lg max-w-4xl w-full max-h-[90vh] overflow-y-auto",children:e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6",children:[e.jsx("h2",{className:"text-xl font-bold",children:_?"Create Hero Slide":"Edit Hero Slide"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(a,{variant:"outline",onClick:async()=>
1{if(v)if(v.title.trim())if(v.image_url.trim())try{if(_){const e={title:v.title,subtitle:v.subtitle,description:v.description,image_url:r(v.image_url),overlay_text:v.overlay_text,show_overlay_text:!1!==v.show_overlay_text,overlay_position:v.overlay_position,text_color:v.text_color,background_overlay_opacity:v.background_overlay_opacity,button_text:v.button_text,button_url:v.button_url,button_color:v.button_color,button_text_color:v.button_text_color,display_order:v.display_order,is_active:v.is_active,page_type:v.page_type||"home"},{data:t,error:l}=await o.from("hero_slides").insert([e]).select().single();if(l)return void alert(`Failed to create hero slide: ${l.message}`)}else{const e={title:v.title,subtitle:v.subtitle,description:v.description,image_url:r(v.image_url),overlay_text:v.overlay_text,show_overlay_text:!1!==v.show_overlay_text,overlay_position:v.overlay_position,text_color:v.text_color,background_overlay_opacity:v.background_overlay_opacity,button_text:v.button_text,button_url:v.button_url,button_color:v.button_color,button_text_color:v.button_text_color,display_order:v.display_order,is_active:v.is_active,page_type:v.page_type||"home"},{data:t,error:l}=await o.from("hero_slides").update(e).eq("id",v.id).select().single();if(l)return void alert(`Failed to update hero slide: ${l.message}`)}alert(_?"Hero slide created successfully!":"Hero slide updated successfully!"),N(null),f(!1),k()}catch(e){alert(`Failed to save hero slide: ${e instanceof Error?e.message:"Unknown error"}`)}else alert("Please upload an image or enter an image URL.");else alert("Please enter a title for the hero slide.")},children:[e.jsx(c,{className:"h-4 w-4 mr-2"}),"Save"]}),e.jsxs(a,{variant:"outline",onClick:()=>N(null),children:[e.jsx(s,{className:"h-4 w-4 mr-2"}),"Cancel"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2",children:"Overlay Text"}),e.jsx("input",{type:"text",value:v.overlay_text||"",onChange:e=>N({...v,overlay_text:e.target.value}),className:"w-full p-2 border rounded-md",placeholder:"Main headline text that appears on the slide"}),e.jsxs("div",{className:"mt-2 flex items-center",children:[e.jsx("input",{type:"checkbox",id:"show_overlay_text",checked:!1!==v.show_overlay_text,onChange:e=>N({...v,show_overlay_text:e.target.checked}),className:"h-4 w-4 text-primary focus:ring-primary border-gray-300 rounded"}),e.jsx("label",{htmlFor:"show_overlay_text",className:"ml-2 text-sm text-gray-700",children:"Show overlay text on hero slide"})]}),e.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Uncheck to hide overlay text even if it's entered above"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2",children:"Title *"}),e.jsx("input",{type:"text",value:v.title,onChange:e=>N({...v,title:e.target.value}),className:"w-full p-2 border rounded-md",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2",children:"Subtitle"}),e.jsx("input",{type:"text",value:v.subtitle||"",onChange:e=>N({...v,subtitle:e.target.value}),className:"w-full p-2 border rounded-md"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2",children:"Description"}),e.jsx("textarea",{value:v.description||"",onChange:e=>N({...v,description:e.target.value}),className:"w-full p-2 border rounded-md h-20"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2",children:"Page Type *"}),e.jsxs("select",{value:v.page_type||"home",onChange:e=>N({...v,page_type:e.target.value}),className:"w-full p-2 border rounded-md",children:[e.jsx("option",{value:"home",children:"Home Page"}),e.jsx("option",{value:"f360i",children:"F360i Page"}),e.jsx("option",{value:"smart-warehouse",children:"Smart Warehouse Page"}),e.jsx("option",{value:"construction-copilot",children:"Construction Co-Pilot Page"})]}),e.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Select which page this hero slide should appear on"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2",children:"Hero Image *"}),e.jsxs("div",{className:"mb-4",children:[e.jsx(d,{value:v.image_url?r(v.image_url):"",onCh
1ange:e=>{const t=r(e);N({...v,image_url:t})},onError:e=>{alert(`Image upload failed: ${e.message}`)}}),v.image_url&&e.jsx("div",{className:"mt-2 p-2 bg-green-50 border border-green-200 rounded-md",children:e.jsxs("p",{className:"text-sm text-green-800",children:[e.jsx("strong",{children:"Image URL:"})," ",r(v.image_url)]})})]}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"block text-sm font-medium mb-1 text-gray-600",children:"Or enter image URL manually:"}),e.jsx("input",{type:"url",value:v.image_url?r(v.image_url):"",onChange:e=>{const t=r(e.target.value);N({...v,image_url:t})},onBlur:e=>{const t=r(e.target.value);t!==e.target.value&&N({...v,image_url:t})},className:"w-full p-2 border rounded-md text-sm",placeholder:"https://storage.litelinxfiber.com/storage/v1/object/public/product-images/image.jpg"}),e.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"URLs will be automatically normalized to use storage.litelinxfiber.com"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2",children:"Overlay Position"}),e.jsx("select",{value:v.overlay_position,onChange:e=>N({...v,overlay_position:e.target.value}),className:"w-full p-2 border rounded-md",children:h.map(t=>e.jsx("option",{value:t.value,children:t.label},t.value))})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2",children:"Text Color"}),e.jsx("input",{type:"color",value:v.text_color,onChange:e=>N({...v,text_color:e.target.value}),className:"w-full h-10 border rounded-md"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium mb-2",children:["Background Overlay Opacity: ",v.background_overlay_opacity]}),e.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",value:v.background_overlay_opacity,onChange:e=>N({...v,background_overlay_opacity:parseFloat(e.target.value)}),className:"w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2",children:"Button Text"}),e.jsx("input",{type:"text",value:v.button_text||"",onChange:e=>N({...v,button_text:e.target.value}),className:"w-full p-2 border rounded-md"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2",children:"Button URL"}),e.jsx("input",{type:"url",value:v.button_url||"",onChange:e=>N({...v,button_url:e.target.value}),className:"w-full p-2 border rounded-md"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2",children:"Button Color"}),e.jsxs("div",{className:"mb-3",children:[e.jsx("p",{className:"text-sm text-gray-600 mb-2",children:"Quick Colors:"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:()=>N({...v,button_color:"#2B367F"}),className:"w-8 h-8 rounded border-2 "+("#2B367F"===v.button_color?"border-gray-800":"border-gray-300"),style:{backgroundColor:"#2B367F"},title:"Primary Blue (#2B367F)"}),e.jsx("button",{type:"button",onClick:()=>N({...v,button_color:"#F99C1C"}),className:"w-8 h-8 rounded border-2 "+("#F99C1C"===v.button_color?"border-gray-800":"border-gray-300"),style:{backgroundColor:"#F99C1C"},title:"Orange (#F99C1C)"}),e.jsx("button",{type:"button",onClick:()=>N({...v,button_color:"#007bff"}),className:"w-8 h-8 rounded border-2 "+("#007bff"===v.button_color?"border-gray-800":"border-gray-300"),style:{backgroundColor:"#007bff"},title:"Blue (#007bff)"}),e.jsx("button",{type:"button",onClick:()=>N({...v,button_color:"#28a745"}),className:"w-8 h-8 rounded border-2 "+("#28a745"===v.button_color?"border-gray-800":"border-gray-300"),style:{backgroundColor:"#28a745"},title:"Green (#28a745)"}),e.jsx("button",{type:"button",onClick:()=>N({...v,button_color:"#dc3545"}),className:"w-8 h-8 rounded border-2 "+("#dc3545"===v.button_color?"border-gray-800":"border-gray-300"),style:{backgroundColor:"#dc3545"},title:"Red (#dc3545)"})]})]}),e.jsx("input",{type:"color",value:v.button_color,onChange:e=>N({...v,button_color:e.target.value}),className:"w-full h-10 border rounded-md"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2",children:"Button Text Color"}),e.jsxs("div",{className:"mb-3",children:[e.jsx("p",{className:"text-sm text-gray-600 mb-2",children:"Qu
1ick Text Colors:"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:()=>N({...v,button_text_color:"#ffffff"}),className:"w-8 h-8 rounded border-2 "+("#ffffff"===v.button_text_color?"border-gray-800":"border-gray-300"),style:{backgroundColor:"#ffffff"},title:"White (#ffffff)"}),e.jsx("button",{type:"button",onClick:()=>N({...v,button_text_color:"#000000"}),className:"w-8 h-8 rounded border-2 "+("#000000"===v.button_text_color?"border-gray-800":"border-gray-300"),style:{backgroundColor:"#000000"},title:"Black (#000000)"}),e.jsx("button",{type:"button",onClick:()=>N({...v,button_text_color:"#333333"}),className:"w-8 h-8 rounded border-2 "+("#333333"===v.button_text_color?"border-gray-800":"border-gray-300"),style:{backgroundColor:"#333333"},title:"Dark Gray (#333333)"})]})]}),e.jsx("input",{type:"color",value:v.button_text_color,onChange:e=>N({...v,button_text_color:e.target.value}),className:"w-full h-10 border rounded-md"})]})]})]}),e.jsxs("div",{className:"mt-6",children:[e.jsx("h3",{className:"text-lg font-medium mb-4",children:"Preview"}),e.jsxs("div",{className:"relative h-64 bg-gray-200 rounded-lg overflow-hidden",children:[e.jsx("img",{src:v.image_url?r(v.image_url):"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAwIiBoZWlnaHQ9IjQ1MCIgdmlld0JveD0iMCAwIDgwMCA0NTAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSI4MDAiIGhlaWdodD0iNDUwIiBmaWxsPSIjRjNGNEY2Ii8+CjxwYXRoIGQ9Ik0zNTAgMjAwSDQ1MFYyNTBIMzUwVjIwMFoiIGZpbGw9IiNEMUQ1REIiLz4KPHBhdGggZD0iTTM3NSAyMjVIMzUwVjIwMEgzNzVWMjI1WiIgZmlsbD0iI0QxRDVEQiIvPgo8cGF0aCBkPSJNNDI1IDIyNUg0NTBWMjAwSDQyNVYyMjVaIiBmaWxsPSIjRDFENURCIi8+CjxwYXRoIGQ9Ik0zNzUgMjUwSDM1MFYyMjVIMzc1VjI1MFoiIGZpbGw9IiNEMUQ1REIiLz4KPHBhdGggZD0iTTQyNSAyNTBINDUwVjIyNUg0MjVWMjUwWiIgZmlsbD0iI0QxRDVEQiIvPgo8dGV4dCB4PSI0MDAiIHk9IjMwMCIgZm9udC1mYW1pbHk9IkFyaWFsLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4IiBmaWxsPSIjNkI3MjgwIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIj5IZXJvIFNsaWRlIEltYWdlPC90ZXh0Pgo8dGV4dCB4PSI0MDAiIHk9IjMyNSIgZm9udC1mYW1pbHk9IkFyaWFsLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE0IiBmaWxsPSIjOUI5QkE1IiB0ZXh0LWFuY2hvcj0ibWlkZGxlIj5VcGxvYWQgYW4gaW1hZ2UgdG8gZ2V0IHN0YXJ0ZWQ8L3RleHQ+Cjwvc3ZnPgo=",alt:"Hero preview",className:"w-full h-full object-cover",onError:e=>{e.currentTarget.src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAwIiBoZWlnaHQ9IjQ1MCIgdmlld0JveD0iMCAwIDgwMCA0NTAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSI4MDAiIGhlaWdodD0iNDUwIiBmaWxsPSIjRjNGNEY2Ii8+CjxwYXRoIGQ9Ik0zNTAgMjAwSDQ1MFYyNTBIMzUwVjIwMFoiIGZpbGw9IiNEMUQ1REIiLz4KPHBhdGggZD0iTTM3NSAyMjVIMzUwVjIwMEgzNzVWMjI1WiIgZmlsbD0iI0QxRDVEQiIvPgo8cGF0aCBkPSJNNDI1IDIyNUg0NTBWMjAwSDQyNVYyMjVaIiBmaWxsPSIjRDFENURCIi8+CjxwYXRoIGQ9Ik0zNzUgMjUwSDM1MFYyMjVIMzc1VjI1MFoiIGZpbGw9IiNEMUQ1REIiLz4KPHBhdGggZD0iTTQyNSAyNTBINDUwVjIyNUg0MjVWMjUwWiIgZmlsbD0iI0QxRDVEQiIvPgo8dGV4dCB4PSI0MDAiIHk9IjMwMCIgZm9udC1mYW1pbHk9IkFyaWFsLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4IiBmaWxsPSIjNkI3MjgwIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIj5IZXJvIFNsaWRlIEltYWdlPC90ZXh0Pgo8dGV4dCB4PSI0MDAiIHk9IjMyNSIgZm9udC1mYW1pbHk9IkFyaWFsLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE0IiBmaWxsPSIjOUI5QkE1IiB0ZXh0LWFuY2hvcj0ibWlkZGxlIj5VcGxvYWQgYW4gaW1hZ2UgdG8gZ2V0IHN0YXJ0ZWQ8L3RleHQ+Cjwvc3ZnPgo="}}),e.jsx("div",{className:"absolute inset-0",style:{backgroundColor:`rgba(0, 0, 0, ${v.background_overlay_opacity})`}}),e.jsxs("div",{className:"absolute p-4 "+("center"===v.overlay_position?"top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 text-center":"top-left"===v.overlay_position?"top-4 left-4":"top-center"===v.overlay_position?"top-4 left-1/2 transform -translate-x-1/2 text-center":"top-right"===v.overlay_position?"top-4 right-4 text-right":"center-left"===v.overlay_position?"top-1/2 left-4 transform -translate-y-1/2":"center-right"===v.overlay_position?"top-1/2 right-4 transform -translate-y-1/2 text-right":"bottom-left"===v.overlay_position?"bottom-4 left-4":"bottom-center"===v.overlay_position?"bottom-4 left-1/2 transform -translate-x-1/2 text-center":"bottom-4 right-4 text-right"),style:{color:v.text_color},children:[v.overlay_text&&e.jsx("h2",{className:"text-2xl font-bold mb-2",children:v.overlay_text}),v.title&&e.jsx("h3",{className:"text-lg font-semibold mb-1",children:v.title}),v.subtitle&&e.jsx("p",{className:"text-sm opacity-90",children:v.subt
1itle}),v.button_text&&e.jsx("button",{className:"mt-3 px-4 py-2 rounded-md font-medium",style:{backgroundColor:v.button_color,color:v.button_text_color},children:v.button_text})]})]})]})]})})}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:p.filter(e=>"all"===w||e.page_type===w).map((t,l)=>{const a=p.findIndex(e=>e.id===t.id);return e.jsxs("div",{className:"bg-white rounded-lg shadow-md overflow-hidden",children:[e.jsxs("div",{className:"relative h-48",children:[e.jsx("img",{src:r(t.image_url),alt:t.title,className:"w-full h-full object-cover",onError:e=>{e.currentTarget.src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAwIiBoZWlnaHQ9IjQ1MCIgdmlld0JveD0iMCAwIDgwMCA0NTAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSI4MDAiIGhlaWdodD0iNDUwIiBmaWxsPSIjRjNGNEY2Ii8+CjxwYXRoIGQ9Ik0zNTAgMjAwSDQ1MFYyNTBIMzUwVjIwMFoiIGZpbGw9IiNEMUQ1REIiLz4KPHBhdGggZD0iTTM3NSAyMjVIMzUwVjIwMEgzNzVWMjI1WiIgZmlsbD0iI0QxRDVEQiIvPgo8cGF0aCBkPSJNNDI1IDIyNUg0NTBWMjAwSDQyNVYyMjVaIiBmaWxsPSIjRDFENURCIi8+CjxwYXRoIGQ9Ik0zNzUgMjUwSDM1MFYyMjVIMzc1VjI1MFoiIGZpbGw9IiNEMUQ1REIiLz4KPHBhdGggZD0iTTQyNSAyNTBINDUwVjIyNUg0MjVWMjUwWiIgZmlsbD0iI0QxRDVEQiIvPgo8dGV4dCB4PSI0MDAiIHk9IjMwMCIgZm9udC1mYW1pbHk9IkFyaWFsLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE4IiBmaWxsPSIjNkI3MjgwIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIj5IZXJvIFNsaWRlIEltYWdlPC90ZXh0Pgo8dGV4dCB4PSI0MDAiIHk9IjMyNSIgZm9udC1mYW1pbHk9IkFyaWFsLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE0IiBmaWxsPSIjOUI5QkE1IiB0ZXh0LWFuY2hvcj0ibWlkZGxlIj5VcGxvYWQgYW4gaW1hZ2UgdG8gZ2V0IHN0YXJ0ZWQ8L3RleHQ+Cjwvc3ZnPgo="}}),e.jsx("div",{className:"absolute top-2 right-2 flex gap-1",children:e.jsx("button",{onClick:()=>(async e=>{try{const{error:t}=await o.from("hero_slides").update({is_active:!e.is_active}).eq("id",e.id);if(t)throw t;k()}catch(t){}})(t),className:"p-1 rounded-full "+(t.is_active?"bg-green-500 text-white":"bg-gray-500 text-white"),title:t.is_active?"Hide slide":"Show slide",children:t.is_active?e.jsx(i,{className:"h-4 w-4"}):e.jsx(m,{className:"h-4 w-4"})})}),e.jsx("div",{className:"absolute bottom-2 right-2",children:e.jsx("button",{onClick:()=>{N({...t}),f(!1)},className:"p-1 rounded-full bg-blue-500 text-white hover:bg-blue-600 transition-colors",title:"Edit slide",children:e.jsx(u,{className:"h-4 w-4"})})})]}),e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h3",{className:"font-semibold text-lg",children:t.title}),t.page_type&&e.jsx("span",{className:"text-xs px-2 py-1 bg-primary/10 text-primary rounded-full",children:"home"===t.page_type?"Home":"f360i"===t.page_type?"F360i":"smart-warehouse"===t.page_type?"Warehouse":"construction-copilot"===t.page_type?"Co-Pilot":t.page_type})]}),t.subtitle&&e.jsx("p",{className:"text-gray-600 text-sm mb-2",children:t.subtitle}),t.overlay_text&&e.jsxs("p",{className:"text-gray-500 text-xs mb-2",children:['Overlay: "',t.overlay_text,'"']}),e.jsxs("div",{className:"flex justify-between items-center mt-4",children:[e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{onClick:()=>W(t,"up"),disabled:0===a,className:"p-1 rounded hover:bg-gray-100 disabled:opacity-50",children:e.jsx(x,{className:"h-4 w-4"})}),e.jsx("button",{onClick:()=>W(t,"down"),disabled:a===p.length-1,className:"p-1 rounded hover:bg-gray-100 disabled:opacity-50",children:e.jsx(g,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>(e=>{N({...e,image_url:e.image_url?r(e.image_url):e.image_url}),f(!1)})(t),className:"p-1 rounded hover:bg-gray-100",children:e.jsx(u,{className:"h-4 w-4"})}),e.jsx("button",{onClick:()=>(async e=>{if(confirm("Are you sure you want to delete this hero slide?"))try{const{error:t}=await o.from("hero_slides").delete().eq("id",e);if(t)throw t;k()}catch(t){}})(t.id),className:"p-1 rounded hover:bg-red-100 text-red-600",children:e.jsx(b,{className:"h-4 w-4"})})]})]})]})]},t.id)})}),0===p.filter(e=>"all"===w||e.page_type===w).length&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx("p",{className:"text-gray-500 mb-4",children:"No hero slides found."}),e.jsxs(a,{onClick:M,children:[e.jsx(n,{className:"h-4 w-4 mr-2"}),"Create Your First Hero Slide"]})]})]})}export{p as AdminHeroSlides,p 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.