/opt/canhelp/apps/web/.next/static/chunks
Edit: /opt/canhelp/apps/web/.next/static/chunks/6467.a600a1d7b0465863.js (4514B)
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6467],{6467:(e,t,r)=>{r.r(t),r.d(t,{default:()=>n});var s=r(4568),l=r(7620),a=r(9906),o=r(2982);function n(e){let{onClose:t}=e,{t:r}=(0,a.Y)(),[n,i]=(0,l.useState)("bug"),[c,d]=(0,l.useState)(""),[u,x]=(0,l.useState)(""),[p,g]=(0,l.useState)(!1),[m,b]=(0,l.useState)(!1),[h,y]=(0,l.useState)(""),f=[{value:"bug",label:r("support.type.bug"),icon:"\uD83D\uDC1B",color:"border-red-300 bg-red-50 text-red-700"},{value:"suggestion",label:r("support.type.suggestion"),icon:"\uD83D\uDCA1",color:"border-green-300 bg-green-50 text-green-700"},{value:"other",label:r("support.type.other"),icon:"\uD83D\uDCAC",color:"border-gray-300 bg-gray-50 text-gray-700"}];async function j(e){e.preventDefault(),y(""),g(!0);try{await (0,o.mq)({type:n,subject:c,body:u}),b(!0)}catch(e){y(r("support.error"))}finally{g(!1)}}return(0,s.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",onClick:e=>e.target===e.currentTarget&&t(),children:(0,s.jsxs)("div",{className:"bg-white rounded-2xl shadow-xl w-full max-w-lg",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-100",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("svg",{className:"w-5 h-5 text-green-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 5.636l-3.536 3.536m0 5.656l3.536 3.536M9.172 9.172L5.636 5.636m3.536 9.192l-3.536 3.536M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-5 0a4 4 0 11-8 0 4 4 0 018 0z"})}),(0,s.jsx)("h2",{className:"text-lg font-semibold text-gray-900",children:r("support.title")})]}),(0,s.jsx)("button",{onClick:t,className:"text-gray-400 hover:text-gray-600",children:(0,s.jsx)("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),m?(0,s.jsxs)("div",{className:"px-6 py-10 text-center",children:[(0,s.jsx)("div",{className:"text-5xl mb-4",children:"✅"}),(0,s.jsx)("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:r("support.sent.title")}),(0,s.jsx)("p",{className:"text-sm text-gray-500 mb-6",children:r("support.sent.body")}),(0,s.jsx)("button",{onClick:t,className:"bg-green-600 text-white px-6 py-2.5 rounded-xl font-medium hover:bg-green-700",children:r("support.sent.close")})]}):(0,s.jsxs)("form",{onSubmit:j,className:"px-6 py-5 space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm font-medium text-gray-700 mb-2",children:r("support.type.label")}),(0,s.jsx)("div",{className:"grid grid-cols-3 gap-2",children:f.map(e=>{let{value:t,label:r,icon:l,color:a}=e;return(0,s.jsxs)("button",{type:"button",onClick:()=>i(t),className:"flex flex-col items-center gap-1 py-3 px-2 rounded-xl border-2 text-xs font-medium transition ".concat(n===t?a+" border-opacity-100":"border-gray-200 bg-white text-gray-500 hover:border-gray-300"),children:[(0,s.jsx)("span",{className:"text-xl",children:l}),r]},t)})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:r("support.subject")}),(0,s.jsx)("input",{type:"text",value:c,onChange:e=>d(e.target.value),required:!0,minLength:3,maxLength:200,placeholder:r("support.subject.placeholder"),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:r("support.body")}),(0,s.jsx)("textarea",{value:u,onChange:e=>x(e.target.value),required:!0,minLength:10,maxLength:5e3,rows:5,placeholder:r("support.body.placeholder"),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400 resize-none"})]}),h&&(0,s.jsx)("p",{className:"text-sm text-red-600",children:h}),(0,s.jsxs)("div",{className:"flex gap-3 pt-1",children:[(0,s.jsx)("button",{type:"button",onClick:t,className:"flex-1 border border-gray-300 text-gray-700 py-2.5 rounded-xl font-medium hover:bg-gray-50",children:r("support.cancel")}),(0,s.jsx)("button",{type:"submit",disabled:p,className:"flex-1 bg-green-600 text-white py-2.5 rounded-xl font-semibold hover:bg-green-700 disabled:opacity-50",children:p?"...":r("support.submit")})]})]})]})})}}}]);