1import{e as I,u as O,b as V,p as Q,v as D,r as i,f as H,i as K,j as e,o as M,B as n,L as G,m as C,d as J,I as X}from"./index-QiiZ-xPT.js";import{A as S}from"./AppLayout-DS32LUNS.js";import{T as U}from"./textarea-Bd1mcSz8.js";import{L as l}from"./label-BA9Xin3m.js";import{S as L,a as q,b as F,c as T,d as m}from"./select-B1P2Vx_w.js";import{u as W}from"./useTranslation-XedzLvcK.js";import{L as Y}from"./lock-NaFetfNF.js";import{C as Z}from"./chevron-right-f4G5e4zR.js";import{L as ee}from"./lightbulb-C5iibd-m.js";import{S as $}from"./sparkles-C108-045.js";import{C as A}from"./circle-question-mark-D1Xaa_pm.js";import{C as te}from"./circle-x-DoPw8ViA.js";import{C as R}from"./circle-check-BOGFOgJv.js";import{C as se}from"./clock-Jb0c5sRN.js";import{f as ae}from"./formatDistanceToNow-Cgxttm8N.js";import"./chevron-left-BlU_Pgs7.js";import"./gift-DGFeQbUI.js";import"./log-out-CqAuLeet.js";import"./library-DGVSHwk6.js";import"./history-Db1-bwk2.js";import"./video-DCxcvy3M.js";import"./index-BMyKsIJE.js";import"./Combination-TP2Egp2x.js";import"./index-DqZlRfV5.js";import"./chevron-down-BWOHa16b.js";import"./check-KTa2Xihg.js";import"./en-US-BddybvhD.js";const ie=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],re=I("bug",ie);const ne=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M12 8v6",key:"1ib9pf"}],["path",{d:"M9 11h6",key:"1fldmi"}]],u=I("message-square-plus",ne),_=[{value:"content_request",label:"Content Request",icon:J,description:"Request new learning topics or modules"},{value:"feature_request",label:"Feature Request",icon:ee,description:"Suggest new features or improvements"},{value:"bug_report",label:"Bug Report",icon:re,description:"Report something that isn't working"},{value:"improvement",label:"Improvement",icon:$,description:"Suggest improvements to existing features"},{value:"other",label:"Other",icon:A,description:"General feedback or questions"}],oe={pending:{bg:"bg-yellow-500/10",text:"text-yellow-500",icon:e.jsx(se,{size:14})},reviewed:{bg:"bg-blue-500/10",text:"text-blue-500",icon:e.jsx(R,{size:14})},in_progress:{bg:"bg-purple-500/10",text:"text-purple-500",icon:e.jsx($,{size:14})},completed:{bg:"bg-green-500/10",text:"text-green-500",icon:e.jsx(R,{size:14})},declined:{bg:"bg-red-500/10",text:"text-red-500",icon:e.jsx(te,{size:14})}};function Ie(){const{t}=W(),{isAuthenticated:o,isLoading:x}=O(),[,p]=V(),{toast:w}=Q(),P=D(),[r,h]=i.useState(""),[f,b]=i.useState(""),[g,j]=i.useState(""),[z,y]=i.useState("medium"),[k,c]=i.useState(!1),{data:v,isLoading:E}=H({queryKey:["/api/suggestions"],queryFn:async()=>{const s=await fetch("/api/suggestions",{credentials:"include"});if(!s.ok)throw new Error("Failed to fetch suggestions");return s.json()},enabled:o}),N=K({mutationFn:async()=>{const s=await fetch("/api/suggestions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({category:r,title:f,description:g,priority:z}),credentials:"include"});if(!s.ok)throw new Error("Failed to submit suggestion");return s.json()},onSuccess:()=>{P.invalidateQueries({queryKey:["/api/suggestions"]}),w({title:t("feedback.successTitle"),description:t("feedback.successMessage")}),h(""),b(""),j(""),y("medium"),c(!1)},onError:()=>{w({title:t("feedback.errorTitle"),description:t("feedback.errorMessage"),variant:"destructive"})}});if(i.useEffect(()=>{!x&&!o&&p("/login?redirect=/feedback")},[x,o,p]),x||E)return e.jsx(S,{children:e.jsx("div",{className:"min-h-screen flex items-center justify-center",children:e.jsx(M,{className:"w-8 h-8 animate-spin text-primary"})})});if(!o)return e.jsx(S,{children:e.jsx("div",{className:"min-h-screen flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(Y,{size:48,className:"mx-auto text-muted-foreground mb-4"}),e.jsx("h1",{className:"text-3xl font-bold mb-4",children:t("feedback.loginRequired")}),e.jsx("p",{className:"text-muted-foreground mb-8",children:t("feedback.loginRequiredMessage")}),e.jsx(n,{onClick:()=>p("/login?redirect=/feedback"),"data-testid":"button-login",children:t("feedback.logIn")})]})})});const B=s=>{const d=_.find(a=>a.value===s);if(d){const a=d.icon;return e.jsx(a,{size:16})}return e.jsx(A,{size:16})};return e.jsx(S,{children:e.jsxs("div",{className:"min-h-screen p-6",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-6 text-sm text-muted-foreground",children:[e.jsx(G,{href:"/",children:e.jsx("span",{className:"hover:text-foreground cursor-pointer",children:t("feedback.breadcrumbHome")})}),e.jsx(Z,{size:14}),e.jsx("span",{className:"text-foreground",children:t("feedback.breadcrumbTitle")})]}),e.jsxs(C.div,{initial:{opacity:0,y:20}
1,animate:{opacity:1,y:0},transition:{duration:.4},children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold","data-testid":"text-page-title",children:t("feedback.pageTitle")}),e.jsx("p",{className:"text-muted-foreground mt-1",children:t("feedback.pageSubtitle")})]}),!k&&e.jsxs(n,{onClick:()=>c(!0),className:"rounded-full","data-testid":"button-new-suggestion",children:[e.jsx(u,{size:18,className:"mr-2"}),t("feedback.newSuggestion")]})]}),k&&e.jsxs(C.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},className:"bg-card rounded-xl border border-border p-6 mb-8",children:[e.jsx("h2",{className:"text-xl font-bold mb-4",children:t("feedback.submitFeedback")}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(l,{htmlFor:"category",children:t("feedback.category")}),e.jsxs(L,{value:r,onValueChange:h,children:[e.jsx(q,{className:"mt-1","data-testid":"select-category",children:e.jsx(F,{placeholder:t("feedback.selectCategory")})}),e.jsx(T,{children:_.map(s=>e.jsx(m,{value:s.value,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.icon,{size:16}),e.jsx("span",{children:t(`feedback.categories.${s.value}`)})]})},s.value))})]}),r&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t(`feedback.categories.${r}_desc`)})]}),e.jsxs("div",{children:[e.jsx(l,{htmlFor:"title",children:t("feedback.title")}),e.jsx(X,{id:"title",value:f,onChange:s=>b(s.target.value),placeholder:t("feedback.titlePlaceholder"),className:"mt-1","data-testid":"input-title"})]}),e.jsxs("div",{children:[e.jsx(l,{htmlFor:"description",children:t("feedback.description")}),e.jsx(U,{id:"description",value:g,onChange:s=>j(s.target.value),placeholder:t("feedback.descriptionPlaceholder"),className:"mt-1 min-h-[120px]","data-testid":"input-description"})]}),e.jsxs("div",{children:[e.jsx(l,{htmlFor:"priority",children:t("feedback.priority")}),e.jsxs(L,{value:z,onValueChange:y,children:[e.jsx(q,{className:"mt-1","data-testid":"select-priority",children:e.jsx(F,{})}),e.jsxs(T,{children:[e.jsx(m,{value:"low",children:t("feedback.priorities.low")}),e.jsx(m,{value:"medium",children:t("feedback.priorities.medium")}),e.jsx(m,{value:"high",children:t("feedback.priorities.high")})]})]})]}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsxs(n,{onClick:()=>N.mutate(),disabled:!r||!f||!g||N.isPending,"data-testid":"button-submit-suggestion",children:[N.isPending?e.jsx(M,{size:18,className:"mr-2 animate-spin"}):e.jsx(u,{size:18,className:"mr-2"}),t("feedback.submit")]}),e.jsx(n,{variant:"outline",onClick:()=>{c(!1),h(""),b(""),j(""),y("medium")},"data-testid":"button-cancel",children:t("feedback.cancel")})]})]})]}),v&&v.length>0?e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-xl font-bold",children:t("feedback.yourSubmissions")}),v.map((s,d)=>{const a=oe[s.status||"pending"];return e.jsx(C.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:d*.05},className:"bg-card rounded-xl border border-border p-5","data-testid":`suggestion-${s.id}`,children:e.jsx("div",{className:"flex items-start justify-between gap-4",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"text-muted-foreground",children:B(s.category)}),e.jsx("span",{className:"text-sm text-muted-foreground capitalize",children:t(`feedback.categories.${s.category}`)}),e.jsxs("span",{className:`text-xs px-2 py-0.5 rounded-full flex items-center gap-1 ${a.bg} ${a.text}`,children:[a.icon,e.jsx("span",{className:"capitalize",children:t(`feedback.statuses.${s.status||"pending"}`)})]})]}),e.jsx("h3",{className:"font-semibold text-lg",children:s.title}),e.jsx("p",{className:"text-muted-foreground mt-1",children:s.description}),s.adminNotes&&e.jsxs("div",{className:"mt-3 p-3 bg-primary/5 rounded-lg border border-primary/10",children:[e.jsx("p",{className:"text-sm font-medium text-primary",children:t("feedback.responseFromTeam")}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s.adminNotes})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-3",children:t("feedback.submitted",{time:s.createdAt&&ae(new Date(s.createdAt),{addSuffix:!0})})})]})})},s.id)})]}):k?null:e.jsxs("div",{className:"bg-card rounded-xl border border-border p-12 text-center",children:[e.jsx(u,{size:48,className:"mx-auto text-muted-foreground mb-4"}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:t("feedback.noSuggestionsTitle")}),e.jsx("p",{className:"text-muted-foreground mb-6",children:t("feedback.noSuggestionsMessage")}),e.jsxs(n,{onClick:()=>c(!0),"data-testid":"button-first-suggestion",children:[e.jsx(u,{size:18,className:"mr-2"}),t("feedback.submitFirstSuggestion")]})]})]})]})})}export{Ie 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.