1import{j as e,r as a,P as s}from"./vendor-DKpN-gn6.js";import{u as r,B as t,s as i}from"./index-CjqWG2Gu.js";import{D as l,a as n,c as o,d as c,e as d,f as m}from"./dialog-vWJa2GV8.js";import{I as x}from"./input-BczSeZo5.js";import{L as h}from"./label-D75N5ztj.js";import{T as u}from"./textarea-DfQUl5Gc.js";import{m as p}from"./mailchimpService-BSr-9f18.js";import{C as j,a as v,b as g,c as b,d as N}from"./carousel-2AsvTRXH.js";import{C as w,a as f}from"./card-C0twyzQf.js";import{S as y}from"./skeleton-CQZJIIqz.js";import"./auth-D0Oxv0aP.js";import"./ui-DbiJ6HOd.js";const S=()=>e.jsx("section",{className:"hero-blue-gradient text-white py-16",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("h1",{className:"text-4xl md:text-6xl font-bold mb-6 text-center uppercase",children:["Reader ",e.jsx("span",{className:"text-brand-orange",children:"Reviews"})]}),e.jsx("p",{className:"text-xl text-center max-w-2xl mx-auto",children:"See what others are saying about BrandJitsu⢠and how it's helping transform businesses."})]})}),C=({review:a})=>e.jsxs("div",{className:"bg-white p-6 rounded-lg shadow-md "+(a.featured?"border-2 border-brand-purple":""),children:[e.jsxs("p",{className:"italic mb-4",children:["â",a.review,"â"]}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold",children:a.author}),e.jsxs("p",{className:"text-sm text-gray-600",children:[a.title,", ",a.company]}),a.featured&&e.jsx("span",{className:"inline-block mt-2 text-xs bg-brand-purple text-white px-2 py-1 rounded",children:"Featured"})]})]}),F=({reviews:a,loading:s})=>s?e.jsx("div",{className:"text-center py-8",children:"Loading reviews..."}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:a.length>0?a.map((a=>e.jsx(C,{review:a},a.id))):e.jsx("div",{className:"col-span-full text-center py-8",children:e.jsx("p",{className:"text-gray-500",children:"No reviews available yet. Be the first to submit one!"})})}),R=()=>{const[s,j]=a.useState(!1),[v,g]=a.useState({review:"",author:"",firstName:"",lastName:"",email:"",title:"",company:""}),{toast:b}=r(),N=e=>{const{name:a,value:s}=e.target;if("author"===a){const e=s.split(" "),r=e[0]||"",t=e.slice(1).join(" ")||"";g((e=>({...e,[a]:s,firstName:r,lastName:t})))}else g((e=>({...e,[a]:s})))};return e.jsxs(e.Fragment,{children:[e.jsx(t,{onClick:()=>j(!0),variant:"outline",className:"border-2 border-brand-orange text-brand-orange bg-white hover:bg-brand-orange hover:text-white",children:"Submit Your Review"}),e.jsx(l,{open:s,onOpenChange:j,children:e.jsxs(n,{className:"sm:max-w-[500px] max-h-[90vh] overflow-y-auto px-4 sm:px-6",children:[e.jsxs(o,{children:[e.jsx(c,{children:"Submit a Review"}),e.jsx(d,{children:"Share your thoughts about BrandJitsuâ¢. All reviews are subject to approval before being published."})]}),e.jsxs("form",{onSubmit:async e=>{e.preventDefault();try{const{error:e}=await i.from("reviews").insert([{review:v.review,author:v.author,email:v.email,title:v.title,company:v.company,status:"pending",featured:!1}]);if(e)b({title:"Error",description:"Failed to submit your review. Please try again later.",variant:"destructive"});else{try{await p.subscribe({firstName:v.firstName,lastName:v.lastName,email:v.email,tags:["New Review"]})}catch(a){}b({title:"Review Submitted",description:"Thank you! Your review has been submitted for approval."}),j(!1),g({review:"",author:"",firstName:"",lastName:"",email:"",title:"",company:""})}}catch(s){b({title:"Error",description:"An unexpected error occurred. Please try again later.",variant:"destructive"})}},className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 py-2 sm:py-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(h,{htmlFor:"review",children:"Your Review"}),e.jsx(u,{id:"review",name:"review",value:v.review,onChange:N,placeholder:"Share your experience with BrandJitsuâ¢...",className:"min-h-[100px]",required:!0})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(h,{htmlFor:"author",children:"Your Name"}),e.jsx(x,{id:"author",name:"author",value:v.author,onChange:N,placeholder:"John Smith",required:!0})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(h,{htmlFor:"email",children:"Your Email"}),e.jsx(x,{id:"email",name:"email",type:"email",value:v.email,onChange:N,placeholder:"[email protected]",required:!0})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(h,{htmlFor:"title",children:"Your Title"}),e.jsx(x,{id:"title",name:"title",value:v.title,onChange:N,placeholder:"CEO, Founder, etc.",required:!0})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(h,{htmlFor:"company",children:"Company Name"}),e.jsx(x,{id:"company",name:"company",value:v.company,onChange:N,placeholder:"Your Company",required:!0})]})]}),e.jsx(m,{className:"pt-2 sm:pt-0",children:e.jsx(t,{type:"submit",className:"w-full sm:w-auto",children:"Submit Review"})})]})]})})]})},E=({reviews:r,loading:t})=>
1{const[i,l]=a.useState(0),[n,o]=a.useState();return a.useEffect((()=>{if(!n)return;const e=()=>l(n.selectedScrollSnap());return e(),n.on("select",e),()=>{n.off("select",e)}}),[n]),t?e.jsx("div",{className:"max-w-4xl mx-auto",children:e.jsx(w,{className:"border-0 shadow-none",children:e.jsxs(f,{className:"p-6 flex flex-col items-center",children:[e.jsx(y,{className:"h-32 w-full mb-6"}),e.jsx(y,{className:"h-6 w-32 mb-3"}),e.jsx(y,{className:"h-4 w-24"})]})})}):e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"flex justify-center mb-8",children:e.jsx(s,{className:"text-brand-orange h-12 w-12"})}),e.jsxs(j,{className:"max-w-4xl mx-auto",setApi:o,children:[e.jsx(v,{children:r.map((a=>e.jsx(g,{children:e.jsx(w,{className:"border-0 shadow-none",children:e.jsxs(f,{className:"p-6 flex flex-col items-center",children:[e.jsxs("p",{className:"text-xl md:text-2xl text-center mb-6 italic",children:['"',a.review,'"']}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"font-semibold text-lg",children:a.author}),e.jsxs("p",{className:"text-gray-600",children:[a.title,", ",a.company]})]})]})})},a.id)))}),e.jsx("div",{className:"flex justify-center mt-4 mb-6 gap-1",role:"tablist","aria-label":"Featured reviews",children:r.map(((a,s)=>e.jsx("button",{type:"button",role:"tab","aria-selected":s===i,"aria-label":`Go to review ${s+1} of ${r.length}`,onClick:()=>n?.scrollTo(s),className:"h-2 w-2 rounded-full mx-1 transition-colors "+(s===i?"bg-brand-orange":"bg-gray-300 hover:bg-gray-400")},s)))}),e.jsx("div",{className:"absolute left-0 top-1/2 -translate-y-1/2",children:e.jsx(b,{className:"h-10 w-10 border-gray-300 text-gray-600"})}),e.jsx("div",{className:"absolute right-0 top-1/2 -translate-y-1/2",children:e.jsx(N,{className:"h-10 w-10 border-gray-300 text-gray-600"})})]})]})},Y=()=>{const[s,t]=a.useState([]),[l,n]=a.useState([]),[o,c]=a.useState(!0),{toast:d}=r();a.useEffect((()=>{m()}),[]);const m=async()=>{try{c(!0);const{data:e,error:a}=await i.from("reviews").select("*").eq("status","approved").order("created_at",{ascending:!1});if(a)d({title:"Error",description:"Failed to load reviews. Please try again later.",variant:"destructive"});else{const a=e?.filter((e=>e.featured))||[],s=e?.filter((e=>!e.featured))||[];n(a),t(s)}}catch(e){}finally{c(!1)}};return e.jsxs("div",{children:[e.jsx(S,{}),l.length>0&&e.jsx("section",{className:"py-12 bg-gray-50",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsx(E,{reviews:l,loading:o})})}),e.jsx("section",{className:"py-12 md:py-16",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("div",{className:"text-center mb-10",children:[e.jsx("h2",{className:"text-2xl font-bold mb-4",children:"All Reviews"}),e.jsx(R,{})]}),e.jsx(F,{reviews:s,loading:o})]})})]})};export{Y 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.