1import{j as e}from"./vendor-radix-DK3xxFO5.js";import{r as m}from"./vendor-react-BosAocA3.js";import{a as k,C as F,b as S,f as C,c as I,I as R,j as P,k as U,l as T,m as D,n as v,T as E,B as O,s as d}from"./index-Dz21qnqg.js";import{C as Y}from"./checkbox-bRRlJAhQ.js";import{U as $,X as q}from"./vendor-icons-CVKWOx_N.js";import"./vendor-supabase-DHET8n-G.js";import"./vendor-charts-C6ZjoPMk.js";import"./vendor-query-D2k599xH.js";import"./vendor-motion-C3PkMfQ1.js";const L=()=>{const[t,p]=m.useState({name:"",type:"",message:"",consent:!1}),[o,u]=m.useState(null),[g,h]=m.useState(null),[b,f]=m.useState(!1),{toast:i}=k(),n=(a,s)=>{p(r=>({...r,[a]:s}))},j=a=>{var r;const s=(r=a.target.files)==null?void 0:r[0];if(s){u(s);const x=new FileReader;x.onload=l=>{var c;h((c=l.target)==null?void 0:c.result)},x.readAsDataURL(s)}},w=()=>{u(null),h(null)},y=async()=>{if(!o)return null;const{data:{user:a}}=await d.auth.getUser();if(!a)throw new Error("Must be logged in to upload");const s=o.name.split(".").pop(),r=`${a.id}/${Date.now()}-${Math.random().toString(36).substring(2)}.${s}`,{data:x,error:l}=await d.storage.from("review-photos").upload(r,o);if(l)throw console.error("Image upload error:",l),l;const{data:{publicUrl:c}}=d.storage.from("review-photos").getPublicUrl(r);return c},N=async a=>{if(a.preventDefault(),!t.name||!t.type||!t.message){i({title:"Oops!",description:"Please fill in all required fields.",variant:"destructive"});return}if(t.type==="Review"&&!t.consent){i({title:"Oops!",description:"Please agree to have your review featured for Review submissions.",variant:"destructive"});return}f(!0);try{let s=null;t.type==="Review"&&o&&(s=await y());const{error:r}=await d.from("feedback").insert({name:t.name,type:t.type,message:t.message,image_url:s,consent:t.type==="Review"?t.consent:!1});if(r)throw r;i({title:"Thank you!",description:"Your feedback has been submitted successfully."}),p({name:"",type:"",message:"",consent:!1}),u(null),h(null)}catch(s){console.error("Submission error:",s),i({title:"Oops!",description:"Failed to submit feedback. Please try again.",variant:"destructive"})}finally{f(!1)}};return e.jsxs(F,{className:"w-full max-w-2xl mx-auto",children:[e.jsx(S,{children:e.jsx(C,{className:"text-2xl font-bold text-center",children:"Leave Feedback"})}),e.jsx(I,{children:e.jsxs("form",{onSubmit:N,className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-gray-700 mb-2",children:"Your Name *"}),e.jsx(R,{id:"name",value:t.name,onChange:a=>n("name",a.target.value),placeholder:"Enter your name",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"type",className:"block text-sm font-medium text-gray-700 mb-2",children:"Feedback Type *"}),e.jsxs(P,{value:t.type,onValueChange:a=>n("type",a),children:[e.jsx(U,{children:e.jsx(T,{placeholder:"Select feedback type"})}),e.jsxs(D,{children:[e.jsx(v,{value:"Review",children:"Review"}),e.jsx(v,{value:"Private Feedback",children:"Private Feedback"})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"message",className:"block text-sm font-medium text-gray-700 mb-2",children:"Your Message *"}),e.jsx(E,{id:"message",value:t.message,onChange:a=>n("message",a.target.value),placeholder:"Tell us how we helped move you forward toward the job and future of your dreams â or how we could improve.",rows:4,required:!0})]}),t.type==="Review"&&e.jsxs("div",{children:[e.jsx("label",{htmlFor:"image",className:"block text-sm font-medium text-gray-700 mb-2",children:"Upload Photo (Optional)"}),g?e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:g,alt:"Preview",className:"w-full h-48 object-cover rounded-lg"}),e.jsx("button",{type:"button",onClick:w,className:"absolute top-2 right-2 bg-red-500 text-white rounded-full p-1 hover:bg-red-600",children:e.jsx(q,{className:"h-4 w-4"})})]}):e.jsxs("div",{className:"border-2 border-dashed border-gray-300 rounded-lg p-6 text-center",children:[e.jsx($,{className:"mx-auto h-12 w-12 text-gray-400"}),e.jsx("div",{className:"mt-4",children:e.jsxs("label",{htmlFor:"image-upload",className:"cursor-pointer",children:[e.jsx("span",{className:"mt-2 block text-sm font-medium text-gray-900",children:"Click to upload an image"}),e.jsx("input",{id:"image-upload",type:"file",className:"sr-only",accept:"image/*",onChange:j})]})})]})]}),t.type==="Review"&&e.jsxs("div",{className:"flex items-start space-x-2",children:[e.jsx(Y,{id:"consent",checked:t.consent,onCheckedChange:a=>
1n("consent",a)}),e.jsx("label",{htmlFor:"consent",className:"text-sm text-gray-700 leading-tight",children:"I agree to have my review and image featured on the website or in marketing materials. *"})]}),e.jsx(O,{type:"submit",className:"w-full bg-blue-600 hover:bg-blue-700 text-white",disabled:b,children:b?"Submitting...":"Submit Feedback"})]})})]})},G=()=>e.jsx("div",{className:"min-h-screen bg-gray-50 py-12 px-4",children:e.jsxs("div",{className:"max-w-4xl mx-auto",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900 mb-4",children:"We'd Love to Hear From You"}),e.jsx("p",{className:"text-lg text-gray-600",children:"Share your experience with us or let us know how we can improve our services."})]}),e.jsx(L,{})]})});export{G 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.