PageSourceSearch

https://mindgolf.ai/assets/AdminProTourVerifications-BjWZKaSZ.js

js mindgolf.ai collected 2026-10-05 14:52:51 UTC 6,206 bytes, 1 lines download raw bytes

1import{n as D,r as n,j as e}from"./vendor-ahVw9cdH.js";import{bz as L,aG as M,b_ as R,be as U,bf as z,b$ as B,bY as v,bg as P,a7 as w,bh as X,aX as q,a5 as y,a6 as C,aW as F,bd as G,bp as $,c0 as H,bJ as S,bC as J,bK as K,V as m,am as W,aw as Y,q as Q,O as b,d as Z}from"./index-DXi0I5ak.js";import{A as ee}from"./AppBreadcrumb-DQQeh5xA.js";import{C as se}from"./circle-x-gCUm4_Za.js";import{C as ae}from"./circle-check-big-BdhKg125.js";import"./radix--pSzM2y8.js";import"./supabase-DYrB2Yg5.js";import"./charts-CSweoJhv.js";import"./query-CeIq2NOR.js";import"./forms-Cc1FL3tT.js";import"./breadcrumb-C59QT_kB.js";const l={pending:{label:"Pending",cls:"bg-yellow-500/10 text-yellow-500 border-yellow-500/20",icon:v},approved:{label:"Approved",cls:"bg-green-500/10 text-green-500 border-green-500/20",icon:ae},rejected:{label:"Rejected",cls:"bg-red-500/10 text-red-500 border-red-500/20",icon:se},expired:{label:"Expired",cls:"bg-muted text-muted-foreground border-border",icon:v},suspended:{label:"Suspended",cls:"bg-orange-500/10 text-orange-500 border-orange-500/20",icon:B}};function xe(){const{isSuperAdmin:o,isLoading:p}=L(),{toast:u}=M(),g=D(),[T,k]=n.useState([]),[A,x]=n.useState(!0),[V,I]=n.useState("pending"),[j,O]=n.useState({}),[N,E]=n.useState({});n.useEffect(()=>{!p&&!o&&g("/")},[o,p,g]);const _=async()=>{x(!0);const{data:a,error:s}=await b.from("pro_tour_verifications").select("*").order("created_at",{ascending:!1});if(s){u({title:"Failed to load",description:s.message,variant:"destructive"}),x(!1);return}const r=Array.from(new Set((a??[]).map(t=>t.user_id)));let i={};if(r.length){const{data:t}=await b.from("profiles").select("id, display_name, email").in("id",r);i=Object.fromEntries((t??[]).map(d=>[d.id,d]))}k((a??[]).map(t=>({...t,profile:i[t.user_id]??null}))),x(!1)};n.useEffect(()=>{o&&_()},[o]);const c=async(a,s)=>{const r={status:s,review_notes:j[a]??null,reviewed_at:new Date().toISOString()};s==="approved"&&(r.valid_from=new Date().toISOString().slice(0,10),r.valid_until=N[a]||Z(new Date,12).toISOString().slice(0,10));const{error:i}=await b.from("pro_tour_verifications").update(r).eq("id",a);if(i){u({title:"Update failed",description:i.message,variant:"destructive"});return}u({title:`Verification ${s}`}),_()};if(p||!o)return null;const f=a=>T.filter(s=>s.status===a);return e.jsxs("div",{className:"container mx-auto px-4 py-6 max-w-6xl",children:[e.jsx(ee,{items:[{label:"Admin",href:"/admin"},{label:"Pro Tour Verifications"}]}),e.jsxs("div",{className:"mb-6",children:[e.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[e.jsx(R,{className:"h-6 w-6 text-primary"})," Pro Tour Verifications"]}),e.jsxs("p",{className:"text-muted-foreground text-sm mt-1",children:["Verify professional tour player submissions. The ",e.jsx("span",{className:"font-medium",children:"pro_tour"})," benchmark cohort only surfaces once n ≥ 20 approved & active verifications per circuit."]})]}),e.jsxs(U,{value:V,onValueChange:a=>I(a),children:[e.jsx(z,{className:"grid grid-cols-5 w-full",children:Object.keys(l).map(a=>e.jsxs(P,{value:a,children:[l[a].label,e.jsx(w,{variant:"secondary",className:"ml-2",children:f(a).length})]},a))}),Object.keys(l).map(a=>e.jsx(X,{value:a,className:"space-y-3 mt-4",children:A?e.jsx(q,{className:"h-32 w-full"}):f(a).length===0?e.jsx(y,{children:e.jsxs(C,{className:"py-10 text-center text-muted-foreground",children:["No ",l[a].label.toLowerCase()," verifications."]})}):f(a).map(s=>{var i,t;const r=l[s.status].icon;return e.jsxs(y,{children:[e.jsx(F,{children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx(G,{className:"text-base",children:((i=s.profile)==null?void 0:i.display_name)||((t=s.profile)==null?void 0:t.email)||s.user_id.slice(0,8)}),e.jsxs($,{className:"mt-1",children:[s.circuit.replace(/_/g," ").toUpperCase(),s.is_main_tour?" · Main Tour":" · Developmental"," · Season ",s.season_year]})]}),e.jsxs(w,{className:l[s.status].cls,children:[e.jsx(r,{className:"h-3 w-3 mr-1"})," ",l[s.status].label]})]})}),e.jsxs(C,{className:"space-y-3 text-sm",children:[s.player_id_on_tour&&e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Tour player ID:"})," ",s.player_id_on_tour]}),s.evidence_url&&e.jsx("div",{children:e.jsxs("a",{href:s.evidence_url,target:"_blank",rel:"noreferrer",className:"text-primary inline-flex items-center gap-1 hover:underline",children:["Evidence link ",e.jsx(H,{className:"h-3 w-3"})]})}),s.evidence_notes&&e.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:s.evidence_notes}),s.review_notes&&e.jsxs("div",{className:"text-xs bg-muted/30 p-2 rounded",children:[e.jsx("span",{className:"text-muted-foreground",children:"Reviewer notes: "}),s.review_notes]}
1),s.valid_until&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Valid until: ",s.valid_until]}),s.status==="pending"&&e.jsxs("div",{className:"space-y-2 border-t border-border pt-3",children:[e.jsx("div",{className:"grid grid-cols-2 gap-2",children:e.jsxs("div",{children:[e.jsx(S,{className:"text-xs",children:"Valid until (default +12mo)"}),e.jsx(J,{type:"date",value:N[s.id]??"",onChange:d=>E(h=>({...h,[s.id]:d.target.value}))})]})}),e.jsxs("div",{children:[e.jsx(S,{className:"text-xs",children:"Reviewer notes"}),e.jsx(K,{value:j[s.id]??"",onChange:d=>O(h=>({...h,[s.id]:d.target.value})),placeholder:"Optional notes…",rows:2})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(m,{size:"sm",onClick:()=>c(s.id,"approved"),children:[e.jsx(W,{className:"h-4 w-4 mr-1"})," Approve"]}),e.jsxs(m,{size:"sm",variant:"destructive",onClick:()=>c(s.id,"rejected"),children:[e.jsx(Y,{className:"h-4 w-4 mr-1"})," Reject"]})]})]}),s.status==="approved"&&e.jsxs("div",{className:"flex gap-2 border-t border-border pt-3",children:[e.jsx(m,{size:"sm",variant:"outline",onClick:()=>c(s.id,"suspended"),children:"Suspend"}),e.jsx(m,{size:"sm",variant:"outline",onClick:()=>c(s.id,"expired"),children:"Mark expired"})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Submitted ",Q(new Date(s.created_at),"MMM d, yyyy")]})]})]},s.id)})},a))]})]})}export{xe 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.