PageSourceSearch

https://mindgolf.ai/assets/AdminFeatureSuggestions-BtAkolIG.js

js mindgolf.ai collected 2026-10-05 14:52:57 UTC 16,353 bytes, 11 lines download raw bytes

1import{j as e,r as u}from"./vendor-ahVw9cdH.js";import{Z as X,fO as le,O as T,dI as C,f3 as ie,bJ as ne,dM as oe,dT as ce,V as P,ds as G,dN as de,dO as ue,dP as me,bC as A,bK as M,c2 as j,c3 as b,c4 as v,c5 as N,c6 as y,fS as xe,f5 as ge,af as B,be as he,bf as pe,bg as J,bh as Q,aX as fe,bY as Z,dE as $,a5 as ee,a6 as L,az as V,b0 as je,b1 as be,a7 as U,b2 as ve,b3 as Ne,b4 as ye,bZ as Ce}from"./index-DXi0I5ak.js";import{a as K,b as z}from"./query-CeIq2NOR.js";import{F as se}from"./FeedbackCategoryBadge-BtOQMEGc.js";import{T as Se}from"./TimeframeControls-CwLitKXI.js";import{A as we}from"./AppBreadcrumb-DQQeh5xA.js";import{C as te}from"./circle-check-big-BdhKg125.js";import{C as ae}from"./circle-x-gCUm4_Za.js";import"./radix--pSzM2y8.js";import"./supabase-DYrB2Yg5.js";import"./charts-CSweoJhv.js";import"./forms-Cc1FL3tT.js";import"./ellipsis-C_dnP560.js";import"./dollar-sign-BHeR3-l3.js";import"./scale-PyObyzaN.js";import"./circle-help-BWJGwUEn.js";import"./bug-DBMHFSM1.js";import"./calendar-VJ0tAwC5.js";import"./setYear-lX1ccTYE.js";import"./endOfWeek-CvZ6jUGu.js";import"./isSameDay-CFziqlbR.js";import"./breadcrumb-C59QT_kB.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const re=X("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const _e=X("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);function Te(){return le({queryKey:["feature-suggestions"],requireUser:!1,queryFn:async()=>{const{data:t,error:s}=await T.from("feature_suggestions").select("*").order("created_at",{ascending:!1});if(s)throw s;return t}})}function ke(){const t=K();return z({mutationFn:async s=>{const{data:{user:r}}=await T.auth.getUser(),o={title:s.title||"",description:s.description||"",category:s.category||"mental_metrics",feedback_category:s.feedback_category??"feature_request",suggestion_source:s.suggestion_source||"admin",suggested_tier:s.suggested_tier??null,suggested_rounds:s.suggested_rounds??1,suggested_reflections:s.suggested_reflections??0,rationale:s.rationale??null,status:s.status??"pending",priority:s.priority??"medium",admin_notes:s.admin_notes??null,related_feature_id:s.related_feature_id??null,ai_analysis:s.ai_analysis?JSON.parse(JSON.stringify(s.ai_analysis)):null,created_by:(r==null?void 0:r.id)??null},{data:m,error:n}=await T.from("feature_suggestions").insert(o).select().single();if(n)throw n;return m},onSuccess:()=>{t.invalidateQueries({queryKey:["feature-suggestions"]}),C({title:"Feature suggestion created"})},onError:s=>{C({title:"Error creating suggestion",description:s.message,variant:"destructive"})}})}function De(){const t=K();return z({mutationFn:async({id:s,...r})=>{const o={};for(const[c,x]of Object.entries(r))c==="ai_analysis"&&x?o[c]=JSON.parse(JSON.stringify(x)):o[c]=x;const{data:m,error:n}=await T.from("feature_suggestions").update(o).eq("id",s).select().single();if(n)throw n;return m},onSuccess:()=>{t.invalidateQueries({queryKey:["feature-suggestions"]}),C({title:"Feature suggestion updated"})},onError:s=>{C({title:"Error updating suggestion",description:s.message,variant:"destructive"})}})}function Fe(){const t=K();return z({mutationFn:async s=>{const{error:r}=await T.from("feature_suggestions").delete().eq("id",s);if(r)throw r},onSuccess:()=>{t.invalidateQueries({queryKey:["feature-suggestions"]}),C({title:"Feature suggestion deleted"})},onError:s=>{C({title:"Error deleting suggestion",description:s.message,variant:"destructive"})}})}const Oe=[{value:"feature_request",label:"Feature Request"},{value:"bug",label:"Bug"},{value:"usability",label:"Usability"},{value:"confusion",label:"Confusion"}];function Ie({selectedCategories:t,onToggle:s}){return e.jsxs("div",{className:"flex flex-wrap items-center gap-3 p-3 bg-muted/50 rounded-lg",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Filter by Type:"}),Oe.map(r=>e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(ie,{id:`filter-${r.value}`,checked:t.has(r.value),onCheckedChange:()=>s(r.value)}),e.jsx(ne,{htmlFor:`filter-${r.value}`,className:"cursor-pointer",children:e.jsx(se,{category:r.value,showIcon:!0,className:"cursor-pointer"})})]},r.value))]})}const Re=["mental_metrics","strokes_gained","correlations","training","off_course","achievements","community"],qe=[{value:"feature_request",label:"Feature Request"},{value:"bug",label:"Bug"},{value:"usability",label:"Usability"},{value:"confusion",label:"Confusion"}];function Ee({onSubmit:t,isLoading:s}){const[r,o]=u.useState(!1),[m,n]=u.useState(""),[c,x]=u.useState(""),[d,g]=u.useState("mental_metrics"),[S,w]=u.useState("feature_request"),[k,I]=u.useState("2"),[D,R]=u.useState("3"),[F,q]=u.useState("0"),[O,p]=u.useState(""),f=a=>{a.preventDefault(),m.trim()&&(t({title:m.trim(),description:c.trim(),category:d,feedback_category:S,suggested_tier:parseInt(k),suggested_rounds:parseInt(D),suggested_reflections:parseInt(F),rationale:O.trim()||null,suggestion_source:"admin",status:"pending",priority:S==="bug"?"high":"medium"}),n(""),x(""),p(""),o(!1))};return e.jsxs(oe,{open:r,onOpenChange:o,children:[e.jsx(ce,{asChild:!0,children:e.jsxs(P,{size:"sm",className:"gap-1.5",children:[e.jsx(G,{className:"h-4 w-4"}),"New"]})}),e.jsxs(de,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[e.jsx(ue,{children:e.jsx(me,{children:"Add New Backlog Item"})}
11),e.jsxs("form",{onSubmit:f,className:"space-y-4 mt-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Title"}),e.jsx(A,{value:m,onChange:a=>n(a.target.value),placeholder:"e.g., Weather-based Performance Insights",className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Description"}),e.jsx(M,{value:c,onChange:a=>x(a.target.value),placeholder:"What does this feature do? Or describe the issue...",className:"mt-1"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Feedback Type"}),e.jsxs(j,{value:S,onValueChange:a=>w(a),children:[e.jsx(b,{className:"mt-1",children:e.jsx(v,{})}),e.jsx(N,{children:qe.map(a=>e.jsx(y,{value:a.value,children:a.label},a.value))})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Category"}),e.jsxs(j,{value:d,onValueChange:g,children:[e.jsx(b,{className:"mt-1",children:e.jsx(v,{})}),e.jsx(N,{children:Re.map(a=>e.jsx(y,{value:a,children:a.replace("_"," ")},a))})]})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Suggested Tier"}),e.jsxs(j,{value:k,onValueChange:I,children:[e.jsx(b,{className:"mt-1",children:e.jsx(v,{})}),e.jsx(N,{children:xe.map(a=>e.jsxs(y,{value:a.tier.toString(),children:["Tier ",a.tier]},a.tier))})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Required Rounds"}),e.jsx(A,{type:"number",min:"1",value:D,onChange:a=>R(a.target.value),className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Reflections"}),e.jsx(A,{type:"number",min:"0",value:F,onChange:a=>q(a.target.value),className:"mt-1"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Rationale (optional)"}),e.jsx(M,{value:O,onChange:a=>p(a.target.value),placeholder:"Why is this valuable?",className:"mt-1"})]}),e.jsxs(P,{type:"submit",className:"w-full",disabled:s||!m.trim(),children:[e.jsx(G,{className:"h-4 w-4 mr-2"}),"Add to Backlog"]})]})]})]})}const Ae=[{value:"newest",label:"Newest First"},{value:"oldest",label:"Oldest First"},{value:"priority",label:"Priority"}],H={critical:4,high:3,medium:2,low:1},W={pending:{label:"Pending",color:"bg-yellow-500/10 text-yellow-600 border-yellow-500/20",icon:Z},approved:{label:"Approved",color:"bg-blue-500/10 text-blue-600 border-blue-500/20",icon:$},in_development:{label:"In Dev",color:"bg-purple-500/10 text-purple-600 border-purple-500/20",icon:re},rejected:{label:"Rejected",color:"bg-red-500/10 text-red-600 border-red-500/20",icon:ae},implemented:{label:"Done",color:"bg-green-500/10 text-green-600 border-green-500/20",icon:te}},Y={low:{label:"Low",color:"bg-muted text-muted-foreground"},medium:{label:"Medium",color:"bg-blue-500/10 text-blue-600"},high:{label:"High",color:"bg-orange-500/10 text-orange-600"},critical:{label:"Critical",color:"bg-red-500/10 text-red-600"}};function Be({suggestion:t,onUpdate:s,onDelete:r}){const[o,m]=u.useState(!1),n=W[t.status],c=Y[t.priority],x=n.icon;return e.jsx(je,{open:o,onOpenChange:m,children:e.jsxs(ee,{className:"overflow-hidden",children:[e.jsx(be,{className:"w-full text-left",children:e.jsx(L,{className:"py-3",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[t.feedback_category&&e.jsx(se,{category:t.feedback_category,showIcon:!0}),e.jsxs(U,{variant:"outline",className:V("text-xs",n.color),children:[e.jsx(x,{className:"h-3 w-3 mr-1"}),n.label]}),e.jsx(U,{variant:"outline",className:V("text-xs",c.color),children:c.label}),t.suggestion_source==="user_feedback"&&e.jsx(U,{className:"bg-violet-100 text-violet-700 text-xs",children:"User Feedback"})]}),e.jsx("h4",{className:"font-medium text-sm truncate",children:t.title}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:t.description})]}),e.jsx("div",{className:"flex items-center gap-1",children:o?e.jsx(ve,{className:"h-4 w-4"}):e.jsx(Ne,{className:"h-4 w-4"})})]})})}),e.jsx(ye,{children:e.jsxs(L,{className:"pt-0 space-y-3 border-t",children:[e.jsxs("div",{className:"pt-3",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Summary"}
11),e.jsx("p",{className:"text-sm font-medium mt-1",children:t.title})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Full Feedback"}),e.jsx("p",{className:"text-sm mt-1 whitespace-pre-wrap",children:t.description})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Status"}),e.jsxs(j,{value:t.status,onValueChange:d=>s({status:d}),children:[e.jsx(b,{className:"h-8 text-xs",children:e.jsx(v,{})}),e.jsx(N,{children:Object.entries(W).map(([d,g])=>e.jsx(y,{value:d,children:g.label},d))})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Priority"}),e.jsxs(j,{value:t.priority,onValueChange:d=>s({priority:d}),children:[e.jsx(b,{className:"h-8 text-xs",children:e.jsx(v,{})}),e.jsx(N,{children:Object.entries(Y).map(([d,g])=>e.jsx(y,{value:d,children:g.label},d))})]})]})]}),t.rationale&&e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Rationale"}),e.jsx("p",{className:"text-xs mt-1",children:t.rationale})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Admin Notes"}),e.jsx(M,{className:"text-xs min-h-[60px] mt-1",placeholder:"Add notes...",value:t.admin_notes||"",onChange:d=>s({admin_notes:d.target.value})})]}),e.jsxs("div",{className:"flex justify-between items-center pt-2",children:[e.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[t.suggested_rounds," rounds, ",t.suggested_reflections," reflections"]}),e.jsxs(P,{variant:"ghost",size:"sm",className:"text-destructive h-7",onClick:r,children:[e.jsx(Ce,{className:"h-3 w-3 mr-1"}),"Delete"]})]})]})})]})})}function _({title:t,icon:s,iconColor:r,suggestions:o,onUpdate:m,onDelete:n}){return e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[e.jsx(s,{className:V("h-4 w-4",r)}),t," (",o.length,")"]}),e.jsxs("div",{className:"space-y-2",children:[o.map(c=>e.jsx(Be,{suggestion:c,onUpdate:x=>m(c.id,x),onDelete:()=>n(c.id)},c.id)),o.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground py-4 text-center",children:"No items"})]})]})}function is(){const{data:t,isLoading:s}=Te(),r=ke(),o=De(),m=Fe(),[n,c]=u.useState(new Set(["feature_request","bug","usability","confusion"])),[x,d]=u.useState("year"),[g,S]=u.useState(0),[w,k]=u.useState("newest"),I=i=>{c(h=>{const l=new Set(h);return l.has(i)?l.delete(i):l.add(i),l})},{pendingSuggestions:D,approvedSuggestions:R,inDevSuggestions:F,doneSuggestions:q,rejectedSuggestions:O}=u.useMemo(()=>{if(!t)return{pendingSuggestions:[],approvedSuggestions:[],inDevSuggestions:[],doneSuggestions:[],rejectedSuggestions:[]};let i=ge(t,x,g,l=>l.created_at);i=i.filter(l=>n.has(l.feedback_category||"feature_request"));const h=[...i].sort((l,E)=>{switch(w){case"newest":return new Date(E.created_at||0).getTime()-new Date(l.created_at||0).getTime();case"oldest":return new Date(l.created_at||0).getTime()-new Date(E.created_at||0).getTime();case"priority":return(H[E.priority]||0)-(H[l.priority]||0);default:return 0}});return{pendingSuggestions:h.filter(l=>l.status==="pending"),approvedSuggestions:h.filter(l=>l.status==="approved"),inDevSuggestions:h.filter(l=>l.status==="in_development"),doneSuggestions:h.filter(l=>l.status==="implemented"),rejectedSuggestions:h.filter(l=>l.status==="rejected")}},[t,x,g,n,w]),p=(i,h)=>{o.mutate({id:i,...h})},f=i=>{m.mutate(i)},a=i=>{r.mutate(i)};return e.jsxs("div",{className:"space-y-4",children:[e.jsx(we,{items:[{label:"Home",href:"/dashboard"},{label:"Admin",href:"/admin"},{label:"Feedback Backlog"}]}),e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[e.jsx(B,{className:"h-6 w-6"}),"Feedback Backlog"]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage actionable feedback from users"})]}),e.jsx(Ee,{onSubmit:a,isLoading:r.isPending})]}),e.jsxs("div",{className:"flex flex-wrap items-end gap-3",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(Ie,{selectedCategories:n,onToggle:I})}),e.jsxs(j,{value:w,onValueChange:k,children:[e.jsx(b,{className:"h-8 text-xs w-32",children:e.jsx(v,{placeholder:"Sort"})}),e.jsx(N,{children:Ae.map(i=>e.jsx(y,{value:i.value,children:i.label},i.value))})]})]}),e.jsx(Se,{timeframe:x,periodOffset:g,onTimeframeChange:d,onPeriodOffsetChange:S,compact:!0,centered:!1}),e.jsxs(he,{defaultValue:"pipeline",className:"w-full",children:[e.jsxs(pe,{className:"grid w-full grid-cols-2",children:[e.jsxs(J,{value:"pipeline",className:"text-xs",children:[e.jsx(_e,{className:"h-3 w-3 mr-1"}),"Pipeline"]}),e.jsxs(J,{value:"ai",className:"text-xs",children:[e.jsx(B,{className:"h-3 w-3 mr-1"}),"Assistant Ideas"]})]}
11),e.jsx(Q,{value:"pipeline",className:"space-y-4 mt-4",children:s?e.jsx("div",{className:"space-y-3",children:[1,2,3].map(i=>e.jsx(fe,{className:"h-24"},i))}):e.jsxs(e.Fragment,{children:[e.jsx(_,{title:"Pending",icon:Z,iconColor:"text-yellow-500",suggestions:D,onUpdate:p,onDelete:f}),e.jsx(_,{title:"Approved",icon:$,iconColor:"text-blue-500",suggestions:R,onUpdate:p,onDelete:f}),e.jsx(_,{title:"In Dev",icon:re,iconColor:"text-purple-500",suggestions:F,onUpdate:p,onDelete:f}),e.jsx(_,{title:"Done",icon:te,iconColor:"text-green-500",suggestions:q,onUpdate:p,onDelete:f}),e.jsx(_,{title:"Rejected",icon:ae,iconColor:"text-red-500",suggestions:O,onUpdate:p,onDelete:f})]})}),e.jsx(Q,{value:"ai",className:"mt-4",children:e.jsx(ee,{children:e.jsxs(L,{className:"py-8 text-center",children:[e.jsx(B,{className:"h-8 w-8 mx-auto mb-3 text-muted-foreground"}),e.jsx("h3",{className:"font-medium",children:"Assistant-generated Ideas"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Coming soon: Assistant will analyze user patterns and suggest feature improvements"})]})})})]})]})}export{is 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.