1import{c as o,j as e,aI as j,dc as y}from"./vendor-1kUQ7zn2.js";import{u as N,D as v,a as w,b as S,d as D,e as k,N as m,c as x,f as q,B as h,s as C}from"./index--kdl1ae9.js";import{T as _}from"./textarea-eVnMW_FJ.js";import{d as R}from"./vendor-supabase-Dh2gyaRa.js";import"./vendor-date-en1IyhsK.js";import"./vendor-motion-BX-jsy7E.js";const B=({open:f,onOpenChange:c})=>{const[s,i]=o.useState(null),[t,l]=o.useState(""),[n,d]=o.useState(!1),{toast:r}=N(),{session:u}=R.useSessionContext(),p=async()=>{if(s===null){r({title:"Pick a rating first."});return}if(!t.trim()){r({title:"Write a few words first."});return}d(!0);try{const{error:a}=await C.from("feature_requests").insert({user_id:u?.user?.id,satisfaction_rating:s,feature_request:t,created_at:new Date().toISOString(),user_email:u?.user?.email,metadata:{url:window.location.pathname,userAgent:navigator.userAgent,timestamp:new Date().toISOString()}});if(a)throw a;r({title:"Thanks. We read every message.",variant:"success"}),i(null),l(""),c(!1)}catch{r({title:"Couldn't send your feedback",description:"Please try again in a moment.",variant:"destructive"})}finally{d(!1)}},g=()=>{i(null),l("")};return e.jsx(v,{open:f,onOpenChange:c,children:e.jsxs(w,{className:"sm:max-w-[500px]",children:[e.jsxs(S,{className:"text-left",children:[e.jsx(D,{className:"text-xl",children:"Send feedback"}),e.jsx(k,{children:"Rate the app and tell us what to add or fix."})]}),e.jsxs("div",{className:"space-y-6 py-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[e.jsx(m,{id:"fr-rating-label",children:"How satisfied are you with the app?"}),e.jsx("span",{className:"fr-score shrink-0 text-sm tabular-nums text-muted-foreground","aria-live":"polite",children:s!==null?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-semibold text-foreground",children:s})," / 10"]}):"â / 10"})]}),e.jsx("div",{className:"fr-stars flex gap-1",role:"radiogroup","aria-labelledby":"fr-rating-label",children:Array.from({length:10},(a,b)=>b+1).map(a=>e.jsxs("button",{type:"button",role:"radio","aria-checked":s===a,"aria-label":`${a} of 10`,onClick:()=>i(a),className:x("group relative p-2 rounded-lg transition-all duration-200","hover:bg-primary/10 focus:outline-none focus:ring-2 focus:ring-primary/50",s===a&&"bg-primary/20"),children:[e.jsx(j,{className:x("h-6 w-6 transition-all duration-200",s!==null&&a<=s?"fill-amber-400 text-amber-400":"text-gray-300 group-hover:text-amber-300")}),e.jsx("span",{className:"absolute -bottom-6 left-1/2 -translate-x-1/2 text-xs text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity",children:a})]},a))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"feature-request",children:"What should we add or fix?"}),e.jsx(_,{id:"feature-request",placeholder:"Tell us what would helpâ¦",value:t,onChange:a=>l(a.target.value),className:"min-h-[120px] resize-none",maxLength:1e3}),e.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[t.length,"/1000 characters"]})]})]}),e.jsxs(q,{className:"gap-2",children:[e.jsx(h,{variant:"ghost",onClick:g,disabled:n,children:"Clear"}),e.jsxs(h,{onClick:p,disabled:n||!t.trim(),className:"gap-2",children:[e.jsx(y,{className:"h-4 w-4"}),n?"Sendingâ¦":"Send feedback"]})]})]})})};export{B as FeatureRequestDialog};
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.