1import{r as l,a as g,j as e}from"./index-DVG2EXfO.js";const u=["new","triaged","resolved"];function v(){const[t,c]=l.useState(""),[n,i]=l.useState(null),[o,r]=l.useState(null),p=l.useCallback(async()=>{r(null);try{i((await g.listFeedback(t||void 0)).feedback)}catch(s){r(s.message),i([])}},[t]);l.useEffect(()=>{p()},[p]);const h=async(s,a)=>{try{const{feedback:m}=await g.updateFeedback(s,a);i(d=>(d==null?void 0:d.map(x=>x.id===s?m:x))??d)}catch(m){r(m.message)}};return e.jsxs("div",{style:{maxWidth:980,margin:"0 auto"},children:[e.jsx("div",{className:"page-head",children:e.jsxs("div",{children:[e.jsx("h1",{children:"Feedback inbox"}),e.jsx("p",{children:"Bug reports and feature requests, newest first."})]})}),e.jsxs("div",{children:[e.jsxs("div",{className:"row",style:{gap:8,marginBottom:14,alignItems:"center",flexWrap:"wrap"},children:[e.jsx("button",{className:t?"ghost tiny":"primary tiny",onClick:()=>c(""),children:"All"}),u.map(s=>e.jsx("button",{className:t===s?"primary tiny":"ghost tiny",onClick:()=>c(s),children:s},s)),e.jsx("span",{className:"spacer"}),e.jsx("button",{className:"ghost tiny",onClick:()=>void p(),children:"â» Refresh"})]}),o&&e.jsx("p",{style:{color:"#e5484d"},children:o}),n?n.length===0?e.jsxs("p",{className:"muted",children:["No feedback",t?` with status "${t}"`:""," yet."]}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:n.map(s=>e.jsxs("div",{className:"panel",style:{padding:14},children:[e.jsxs("div",{className:"row",style:{justifyContent:"space-between",alignItems:"center",gap:8,flexWrap:"wrap"},children:[e.jsxs("div",{className:"row",style:{gap:8,alignItems:"center",flexWrap:"wrap"},children:[e.jsx("span",{className:"badge",children:s.category}),e.jsx("span",{className:"muted",style:{fontSize:12},children:new Date(s.created_at).toLocaleString()}),s.user_email&&e.jsxs("span",{className:"muted",style:{fontSize:12},children:["· ",s.user_email]})]}),e.jsx("select",{value:s.status,onChange:a=>void h(s.id,{status:a.target.value}),children:u.map(a=>e.jsx("option",{value:a,children:a},a))})]}),e.jsx("p",{style:{whiteSpace:"pre-wrap",margin:"10px 0"},children:s.message}),s.screenshots.length>0&&e.jsx("div",{className:"row",style:{gap:8,flexWrap:"wrap"},children:s.screenshots.map(a=>e.jsx("a",{href:a,target:"_blank",rel:"noreferrer",children:e.jsx("img",{src:a,style:{width:90,height:90,objectFit:"cover",borderRadius:6,border:"1px solid var(--line)",display:"block"},alt:"screenshot"})},a))}),s.page_url&&e.jsxs("p",{className:"muted",style:{fontSize:12,marginTop:8,wordBreak:"break-all"},children:["ð ",s.page_url]}),e.jsx(j,{row:s,onSave:a=>void h(s.id,{adminNotes:a})})]},s.id))}):e.jsx("p",{className:"muted",children:"Loadingâ¦"})]})]})}function j({row:t,onSave:c}){const[n,i]=l.useState(t.admin_notes??""),o=n!==(t.admin_notes??"");return e.jsxs("div",{style:{marginTop:10},children:[e.jsx("textarea",{value:n,onChange:r=>i(r.target.value),rows:2,placeholder:"Triage notes (admin only)â¦",style:{width:"100%",resize:"vertical",fontSize:13}}),o&&e.jsx("button",{className:"ghost tiny",style:{marginTop:4},onClick:()=>c(n),children:"Save note"})]})}export{v as AdminFeedback};
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.