PageSourceSearch

https://deliverimates-production.up.railway.app/assets/FeedbackAdmin-C5CRqkIh.js

js deliverimates-production.up.railway.app collected 2026-10-03 12:13:22 UTC 7,745 bytes, 1 lines download raw bytes

1import{c as b,o as j,aa as f,ax as y,q as x,ay as m,a8 as h,j as e,f as N,g,r as u,k as p,a6 as w,cK as v}from"./index-Db4qfLtJ.js";const k=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],S=b("lightbulb",k);function $(s={}){return j({queryKey:x.feedback.admin(s),queryFn:async()=>{const a=await m(),l=new URLSearchParams;s.type&&l.set("type",s.type);const t=await fetch(`${h}/api/feedback?${l}`,{headers:a});if(!t.ok)throw new Error("Failed to fetch feedback");return t.json()},staleTime:3e4})}function D(){const s=f();return y({mutationFn:async({id:a,direction:l})=>{const t=await m(),n=await fetch(`${h}/api/feedback/${a}/vote`,{method:l==="up"?"POST":"DELETE",headers:t});if(!n.ok){const r=await n.json().catch(()=>({error:"Vote failed"}));throw new Error(r.error||"Failed to vote")}return n.json()},onSuccess:()=>{s.invalidateQueries({queryKey:x.feedback.all})}})}function P({positive:s,neutral:a,negative:l}){const t=s+a+l>0;return e.jsxs("div",{className:"mb-6",children:[e.jsx("h3",{className:"text-sm font-medium text-slate-600 mb-2",children:"Sentiment Breakdown"}),t?e.jsxs("div",{className:"flex h-6 rounded-full overflow-hidden",children:[s>0&&e.jsx("div",{className:"bg-emerald-500 flex items-center justify-center text-xs text-white font-medium",style:{width:`${s}%`},title:`Positive: ${s}%`,children:s>=10&&`${s}%`}),a>0&&e.jsx("div",{className:"bg-amber-400 flex items-center justify-center text-xs text-white font-medium",style:{width:`${a}%`},title:`Neutral: ${a}%`,children:a>=10&&`${a}%`}),l>0&&e.jsx("div",{className:"bg-rose-500 flex items-center justify-center text-xs text-white font-medium",style:{width:`${l}%`},title:`Negative: ${l}%`,children:l>=10&&`${l}%`})]}):e.jsx("div",{className:"h-6 rounded-full bg-slate-100 flex items-center justify-center text-xs text-slate-400",children:"No ratings yet"}),e.jsxs("div",{className:"flex justify-between text-xs text-slate-500 mt-1",children:[e.jsxs("span",{children:["Positive (",s,"%)"]}),e.jsxs("span",{children:["Neutral (",a,"%)"]}),e.jsxs("span",{children:["Negative (",l,"%)"]})]})]})}function E({submissions:s}){const a=D(),l=[...s].filter(t=>t.type==="idea").sort((t,n)=>n.votes-t.votes);return l.length===0?e.jsx("div",{className:"text-center py-12 text-slate-400",children:"No feature ideas submitted yet."}):e.jsx("div",{className:"space-y-3",children:l.map(t=>e.jsxs("div",{className:"flex items-start gap-3 p-4 bg-white rounded-lg border border-slate-200",children:[e.jsxs("div",{className:"flex flex-col items-center gap-0.5 min-w-[40px]",children:[e.jsx("button",{onClick:()=>a.mutate({id:t.id,direction:"up"}),className:"p-0.5 rounded hover:bg-emerald-50 text-slate-400 hover:text-emerald-600 transition-colors",disabled:a.isPending,children:e.jsx(N,{className:"h-4 w-4"})}),e.jsx("span",{className:"text-sm font-semibold text-slate-700",children:t.votes}),e.jsx("button",{onClick:()=>a.mutate({id:t.id,direction:"down"}),className:"p-0.5 rounded hover:bg-rose-50 text-slate-400 hover:text-rose-600 transition-colors",disabled:a.isPending,children:e.jsx(g,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm text-slate-800",children:t.body}),e.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-emerald-100 text-emerald-800",children:t.companies?.name||"Unknown DSP"}),e.jsx("span",{className:"text-xs text-slate-400",children:new Date(t.created_at).toLocaleDateString()})]})]})]},t.id))})}const _={bug:"bg-rose-100 text-rose-800",idea:"bg-emerald-100 text-emerald-800",ux:"bg-blue-100 text-blue-800",praise:"bg-amber-100 text-amber-800"};function A({submissions:s}){const[a,l]=u.useState(null);return s.length===0?e.jsx("div",{className:"text-center py-12 text-slate-400",children:"No submissions yet."}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-slate-200 text-left text-slate-500",children:[e.jsx("th",{className:"py-2 px-3 font-medium",children:"DSP"}),e.jsx("th",{className:"py-2 px-3 font-medium",children:"Type"}),e.jsx("th",{className:"py-2 px-3 font-medium",children:"Body"}),e.jsx("th",{className:"py-2 px-3 font-medium",children:"Screen"}),e.jsx("th",{className:"py-2 px-3 font-medium",children:"Rating"}),e.jsx("th",{className:"py-2 px-3 font-medium",children:"Date"})]})}),e.jsx("tbody",{children:s.map(t=>{const n=a===t.id,r=t.body.length>120?t.body.slice(0,120)+"…":t.body;return e.jsxs("tr",{className:"border-b border-slate-100 hover:bg-slate-50",children:[e.jsx("td",{className:"py-2.5 px-3 whitespace-nowrap",children:t.companies?.name||"Unknown"}),e.jsx("td",{className:"py-2.5 px-3",children:e.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${_[t.type]||""}`,children:t.type})}),e.jsx("td",{className:"py-2.5 px-3 max-w-[300px]",children:e.jsx("button",{className:"text-left",onClick:()=>l(n?null:t.id),children:n?t.body:r})}),e.jsx("td",{className:"py-2.5 px-3 whitespace-nowrap text-xs text-slate-500 font-mono",children:t.screen_context?t.screen_context.replace("/dashboard/","/")||"/":"—"}),e.jsx("td",{className:"py-2.5 px-3",children:t.rating!=null?e.jsx("div",{className:"flex items-center gap-0.5",children:[1,2,3,4,5].map(i=>e.jsx(p,{className:`h-3.5 w-3.5 ${i<=t.rating?"fill-amber-400 text-amber-400":"text-slate-200"}`},i))}):e.jsx("span",{className:"text-slate-300",children:"\\u2014"})}),e.jsx("td",{className:"py-2.5 px-3 whitespace-nowrap text-slate-500",children:new Date(t.created_at).toLocaleDateString()})]},t.id)})})]})})}const B=[{key:"all",label:"All"},{key:"idea",label:"Ideas"},{key:"bug",label:"Bugs"},{key:"ux",label:"UX"},{key:"praise",label:"Praise"}];function T(){const[s,a]=u.useState("all"),l=s==="all"?void 0:s,{data:t,isLoading:n}=$({type:l}),r=t?.meta,i=t?.sentiment,o=t?.submissions||[];return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-2xl font-bold text-slate-900",children:"Feedback"}),e.jsx("p",{className:"text-sm text-slate-500 mt-1",children:"Submissions from DSP operators"})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-6",children:[e.jsx(c,{icon:e.jsx(w,{className:"h-4 w-4 text-blue-600"}),label:"Total",value:r?.total??0,loading:n}),e.jsx(c,{icon:e.jsx(p,{className:"h-4 w-4 text-amber-500"}),label:"Avg Rating",value:r?.avg_rating??0,loading:n}),e.jsx(c,{icon:e.jsx(S,{className:"h-4 w-4 text-emerald-600"}),label:"Open Ideas",value:r?.open_ideas??0,loading:n}),e.jsx(c,{icon:e.jsx(v,{className:"h-4 w-4 text-purple-600"}),label:"DSPs Submitting",value:r?.dsps_submitting??0,loading:n})]}),i&&e.jsx(P,{...i}),e.jsx("div",{className:"flex gap-1 border-b border-slate-200 mb-4",children:B.map(d=>e.jsx("button",{onClick:()=>a(d.key),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${s===d.key?"border-slate-900 text-slate-900":"border-transparent text-slate-500 hover:text-slate-700"}`,children:d.label},d.key))}),n?e.jsx("div",{className:"text-center py-12 text-slate-400",children:"Loading feedback..."}):s==="idea"?e.jsx(E,{submissions:o}):e.jsx(A,{submissions:o})]})}function c({icon:s,label:a,value:l,loading:t}){return e.jsxs("div",{className:"bg-white rounded-lg border border-slate-200 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s,e.jsx("span",{className:"text-xs text-slate-500 font-medium",children:a})]}),e.jsx("p",{className:"text-2xl font-bold text-slate-900",children:t?"—":l})]})}
1export{T 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.