PageSourceSearch

https://startup-gate.net/assets/AdminMatchmakingPage-BB9HyAG8.js

js startup-gate.net collected 2026-10-08 16:27:06 UTC 15,335 bytes, 1 lines download raw bytes

1import{r as c,j as e}from"./vendor-radix-DLGwGdby.js";import{u as ve}from"./useDebounce-C6WaUO4R.js";import{P as Ne}from"./PageHeader-DadO5fKg.js";import{q as ie,h as oe,A as ce,C as w,e as k,s as y,b as A,c as L,d as R,D as P,I as se,v as F,w as $,x as z,y as H,z as d,B as Se}from"./index-Cz1Nuibl.js";import{S as we,a as E}from"./SummaryCard-CE7LCVA1.js";import{S as D}from"./SortableTableHead-Lp3V85rI.js";import{A as ke}from"./AdminPagination-6qEaDgP-.js";import{u as Ce}from"./useUrlSort-BPZC7RwV.js";import{T as Me,a as Oe,b as U,c as V,d as Te,e as m}from"./table-DxmE8Wef.js";import{bt as Ae,a5 as Le,U as Re,G as Ee,T as De,z as Ie,b as Be,f as Ke,_ as Pe,b2 as Fe}from"./vendor-lucide-BWW0XcuW.js";import{R as q,B as X,C as G,X as Y,Y as Q,T as W,b as I,m as ae}from"./vendor-recharts-dzgay_RI.js";import"./vendor-datefns-CU7NMMYW.js";function $e(l=""){return ie({queryKey:["admin-matchmaking-summary",l],queryFn:()=>oe.get(`${ce}/admin/mentors/matchmaking/summary${l?`?version=${encodeURIComponent(l)}`:""}`)})}function ze(l,C,p,j,i,h,_,x="all",b="",o=""){return ie({queryKey:["admin-matchmaking-matches",l,C,p,j,i,h,_,x,b,o],queryFn:()=>{const t=new URLSearchParams;return t.set("page",String(l+1)),t.set("limit",String(C)),p&&t.set("search",p),j&&t.set("sort_by",j),i&&t.set("sort_dir",i),h&&t.set("min_score",h),_&&t.set("max_score",_),x!=="all"&&t.set("eligibility",x),b&&t.set("exclusion_reason",b),o&&t.set("version",o),oe.get(`${ce}/admin/mentors/matchmaking/matches?${t}`)},placeholderData:(t,f)=>f?.queryKey[10]===o?t:void 0})}const He="hsl(var(--primary))",Ue="hsl(var(--warning))",te="hsl(var(--success))",re="hsl(var(--muted-foreground))",le=["hsl(var(--success))","hsl(var(--primary))","hsl(var(--warning))","hsl(var(--destructive))"],Ve=[["mentor_not_verified","Mentor not verified"],["mentor_not_available","Mentor unavailable"],["mentor_at_capacity","Mentor at capacity"],["startup_not_public","Startup not public"],["startup_not_seeking_mentorship","Not seeking mentorship"],["taxonomy_no_overlap","No taxonomy overlap"],["score_below_actionable_threshold","Below score threshold"]];function ne(l){return l?new Date(l).toLocaleString():"Not completed yet"}function rs(){const[l,C]=c.useState(""),p=ve(l,300),[j,i]=c.useState(0),[h,_]=c.useState(25),[x,b]=c.useState("all"),[o,t]=c.useState(""),[f,de]=c.useState(""),[n,J]=c.useState("all"),{sortBy:v,sortDir:N,handleSort:M}=Ce(()=>i(0),"admin-matchmaking-sort",["startup_name","mentor_name","score","overlap_count","total_score"]),{data:a,isLoading:u,refetch:me}=$e(f),he={"0_25":["0","25"],"26_50":["26","50"],"51_75":["51","75"],"76_100":["76","100"]},[xe,ue]=n!=="all"?he[n]:["",""],{data:S,isLoading:ge,isError:pe,refetch:je}=ze(j,h,p,v,N,xe,ue,x,o,f),Z=S?.data??[],O=S?.total??0,fe=Math.max(1,Math.ceil(O/h)),g=a?.index_health??S?.index_health,T=a?.snapshot??S?.snapshot,ee=!!T;c.useEffect(()=>{i(0)},[p,n,x,o,f]);function ye(){me(),je()}const B=[{key:"0_25",label:"0-25"},{key:"26_50",label:"26-50"},{key:"51_75",label:"51-75"},{key:"76_100",label:"76-100"}].map(s=>({...s,count:a?.score_distribution[s.key]??0})),_e=[{name:"Startups",with_taxonomy:a?.startups_with_taxonomy??0,missing_taxonomy:a?.startups_missing_taxonomy??0},{name:"Mentors",with_taxonomy:a?.mentors_with_taxonomy??0,missing_taxonomy:a?.mentors_missing_taxonomy??0}],K=[{key:"both",label:"Industry + Stage"},{key:"industry_only",label:"Industry only"},{key:"stage_only",label:"Stage only"},{key:"neither",label:"Neither"}].map(s=>({...s,count:a?.match_breakdown?.[s.key]??0}));return e.jsxs("div",{className:"p-4 sm:p-6 space-y-6",children:[e.jsx(Ne,{title:"Matchmaking",description:"Aggregate health of the startup ↔ mentor taxonomy-matching engine and individual match scores"}),ee&&e.jsx(w,{className:"overflow-hidden border-primary/20 bg-gradient-to-r from-primary/[0.04] via-background to-background",children:e.jsxs(k,{className:"grid gap-4 p-4 sm:grid-cols-2 xl:grid-cols-5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"rounded-lg bg-primary/10 p-2 text-primary",children:e.jsx(Ae,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Score snapshot"}),e.jsxs("p",{className:"text-sm font-semibold",children:["Version ",T?.score_version??"—",T&&!T.is_active_version&&e.jsx(y,{variant:"outline",className:"ms-2 text-[10px]",children:"Historical"})]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Queue"}),e.jsxs("p",{className:"text-sm font-semibold",children:[g?.pen
1ding_jobs??0," pending ·"," ",g?.processing_jobs??0," processing"]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Attention needed"}),e.jsxs("p",{className:"flex items-center gap-1.5 text-sm font-semibold",children:[(g?.failed_jobs??0)>0&&e.jsx(Le,{className:"h-4 w-4 text-destructive"}),g?.failed_jobs??0," failed · ",g?.stale_matches??0," ","stale"]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Full reconciliation"}),e.jsx("p",{className:"text-sm font-medium",children:ne(g?.last_full_reconciliation)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Targeted refresh"}),e.jsx("p",{className:"text-sm font-medium",children:ne(g?.last_targeted_refresh)})]})]})}),e.jsxs(we,{children:[e.jsx(E,{label:"Startups",value:a?.total_startups,icon:e.jsx(Re,{className:"h-3.5 w-3.5"}),isLoading:u,color:"#6366f1"}),e.jsx(E,{label:"Approved Mentors",value:a?.total_mentors,icon:e.jsx(Ee,{className:"h-3.5 w-3.5"}),isLoading:u,color:"#22c55e"}),e.jsx(E,{label:"Avg Overlap Score",value:a?.average_score,icon:e.jsx(De,{className:"h-3.5 w-3.5"}),isLoading:u,color:"#f59e0b"}),e.jsx(E,{label:"Startups w/ Strong Match",value:a?.startups_with_strong_match,icon:e.jsx(Ie,{className:"h-3.5 w-3.5"}),isLoading:u,color:"#ec4899"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs(w,{children:[e.jsxs(A,{children:[e.jsx(L,{className:"text-base",children:"Score Distribution"}),e.jsxs(R,{children:["Match scores (0-100, clamped) across ",a?.total_matches??0," ","computed matches"]})]}),e.jsx(k,{children:u?e.jsx(P,{className:"h-48 w-full rounded-lg"}):e.jsxs("div",{children:[e.jsx(q,{width:"100%",height:180,children:e.jsxs(X,{data:B,margin:{left:-20,top:8},onClick:s=>{const r=s?.activePayload?.[0]?.payload.key;r&&J(n===r?"all":r)},children:[e.jsx(G,{strokeDasharray:"3 3",stroke:"hsl(var(--border))",vertical:!1}),e.jsx(Y,{dataKey:"label",tick:{fontSize:11,fill:"hsl(var(--muted-foreground))"}}),e.jsx(Q,{allowDecimals:!1,tick:{fontSize:11,fill:"hsl(var(--muted-foreground))"}}),e.jsx(W,{formatter:s=>[s.toLocaleString(),"Matches"]}),e.jsx(I,{dataKey:"count",name:"Matches",radius:[4,4,0,0],cursor:"pointer",children:B.map(s=>e.jsx(ae,{fill:n===s.key||n==="all"?Ue:He,fillOpacity:n==="all"||n===s.key?1:.35},s.key))})]})}),e.jsxs("fieldset",{className:"grid grid-cols-4 gap-2 mt-2",children:[e.jsx("legend",{className:"sr-only",children:"Filter by score bucket"}),B.map(s=>e.jsxs("button",{type:"button","data-testid":`bucket-${s.key}`,onClick:()=>J(n===s.key?"all":s.key),className:`rounded-lg border p-2 text-center transition-colors ${n===s.key?"border-primary bg-primary/5":"hover:bg-muted/50"}`,children:[e.jsx("div",{className:"text-sm font-semibold",children:s.count}),e.jsx("div",{className:"text-[10px] text-muted-foreground",children:s.label})]},s.key))]})]})})]}),e.jsxs(w,{children:[e.jsxs(A,{children:[e.jsx(L,{className:"text-base",children:"Taxonomy Data Coverage"}),e.jsx(R,{children:"Profiles missing taxonomy data cannot be matched"})]}),e.jsx(k,{children:u?e.jsx(P,{className:"h-48 w-full rounded-lg"}):e.jsxs(e.Fragment,{children:[e.jsx(q,{width:"100%",height:140,children:e.jsxs(X,{layout:"vertical",data:_e,margin:{left:8,right:16},stackOffset:"expand",children:[e.jsx(G,{strokeDasharray:"3 3",stroke:"hsl(var(--border))",horizontal:!1}),e.jsx(Y,{type:"number",hide:!0}),e.jsx(Q,{type:"category",dataKey:"name",tick:{fontSize:11,fill:"hsl(var(--muted-foreground))"},width:70}),e.jsx(W,{formatter:s=>s.toLocaleString()}),e.jsx(I,{dataKey:"with_taxonomy",name:"Has taxonomy",stackId:"a",fill:te,radius:[4,0,0,4]}),e.jsx(I,{dataKey:"missing_taxonomy",name:"Missing",stackId:"a",fill:re,radius:[0,4,4,0]})]})}),e.jsxs("div",{className:"flex items-center gap-4 justify-center text-xs mt-1",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:te}}),"Has taxonomy"]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:re}}),"Missing"]})]}),e.jsxs("div",{className:"flex items-center justify-between text-sm mt-3 pt-3 border-t",children:[e.jsxs("span",{className:"text-muted-foreground",children:["Startups with a strong match (score ≥"," ",a?.strong_match_threshold??50,")"]}),e.jsxs("span",{className:"font-medium flex items-center gap-1",children:[e.jsx(Be,{className:"h-3.5 w-3.5 text-success"}),a?.startups_with_strong_match_pct??0,"%"]})]})]})})]})]}),e.jsxs(w,{children:[e.jsxs(A,{children:[e.jsx(L,{className:"text-base",children:"Industry / Stage Match Breakdown"}),e.jsx(R,{children:"How many computed matches align on industry, stage, both, or neither"})]}),e.jsx(k,{children:u?e.jsx(P,{className:"h-40 w-full rounded-lg"}):K.every(s=>s.count===0)?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No matches to break down yet"}):e.jsx(q,{width:"100%",height:180,children:e.jsxs(X,{layout:"vertical",data:K,margin:{left:8,right:16},children:[e.jsx(G,{strokeDasharray:"3 3",stroke:"hsl(var(--border))",horizontal:!1}),e.jsx(Y,{type:"number",allowDecimals:!1,tick:{fontSize:11,fill:"hsl(var(--muted-foreground))"}}),e.jsx(Q,{type:"category",dataKey:"label",tick:{fontSize:11,fill:"hsl(var(--muted-foreground))"},width:90}),e.jsx(W,{formatter:s=>
1[s.toLocaleString(),"Matches"]}),e.jsx(I,{dataKey:"count",name:"Matches",radius:[0,4,4,0],children:K.map((s,r)=>e.jsx(ae,{fill:le[r%le.length]},s.key))})]})})})]}),e.jsxs(w,{children:[e.jsx(A,{children:e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[e.jsxs("div",{children:[e.jsx(L,{children:"Match Scores"}),e.jsxs(R,{children:[O," startup ↔ mentor matches"]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Ke,{className:"absolute start-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(se,{placeholder:"Search startup or mentor...","aria-label":"Search startup or mentor",value:l,onChange:s=>C(s.target.value),className:"ps-8 w-[250px]","data-testid":"input-search-matches"})]}),ee&&e.jsxs(e.Fragment,{children:[e.jsx(se,{type:"number",min:1,inputMode:"numeric","aria-label":"Score version",placeholder:"Active version",value:f,onChange:s=>de(s.target.value.replace(/[^0-9]/g,"")),className:"w-[130px]"}),e.jsxs(F,{value:x,onValueChange:b,children:[e.jsx($,{className:"w-[145px]","aria-label":"Filter by eligibility",children:e.jsx(z,{})}
1),e.jsxs(H,{children:[e.jsx(d,{value:"all",children:"All eligibility"}),e.jsx(d,{value:"eligible",children:"Eligible"}),e.jsx(d,{value:"ineligible",children:"Ineligible"})]})]}),e.jsxs(F,{value:o||"all",onValueChange:s=>t(s==="all"?"":s),children:[e.jsx($,{className:"w-[200px]","aria-label":"Filter by exclusion reason",children:e.jsx(z,{})}),e.jsxs(H,{children:[e.jsx(d,{value:"all",children:"All exclusion reasons"}),Ve.map(([s,r])=>e.jsx(d,{value:s,children:r},s))]})]})]}),e.jsx(Se,{variant:"outline",size:"icon",onClick:ye,"aria-label":"Refresh matchmaking data","data-testid":"button-refresh-matchmaking",children:e.jsx(Pe,{className:"h-4 w-4"})})]})]})}),e.jsxs(k,{children:[ge&&!S?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading matches..."}):pe?e.jsx("div",{className:"text-center py-8 text-destructive",children:"Failed to load matches. Please refresh the page or sign in again."}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(Me,{children:[e.jsx(Oe,{children:e.jsxs(U,{children:[e.jsx(D,{column:"startup_name",sortBy:v,sortDir:N,onSort:M,children:"Startup"}),e.jsx(D,{column:"mentor_name",sortBy:v,sortDir:N,onSort:M,children:"Mentor"}),e.jsx(D,{column:"total_score",sortBy:v,sortDir:N,onSort:M,children:"Score"}),e.jsx(D,{column:"overlap_count",sortBy:v,sortDir:N,onSort:M,className:"hidden md:table-cell",children:"Overlap"}),e.jsx(V,{children:"Eligibility"}),e.jsx(V,{className:"hidden lg:table-cell",children:"Signals"}),e.jsx(V,{className:"hidden xl:table-cell",children:"Component scores"})]})}),e.jsxs(Te,{children:[Z.map(s=>e.jsxs(U,{"data-testid":`row-match-${s.startup_id}-${s.mentor_id}`,children:[e.jsx(m,{className:"font-medium",children:s.startup_name}),e.jsx(m,{children:s.mentor_name}),e.jsx(m,{children:e.jsx(y,{variant:s.total_score>=(a?.strong_match_threshold??50)?"default":"secondary",children:s.total_score})}),e.jsx(m,{className:"hidden md:table-cell",children:s.overlap_count}),e.jsx(m,{children:e.jsxs("div",{className:"space-y-1",children:[e.jsx(y,{variant:s.is_eligible===!1?"destructive":"secondary",children:s.is_eligible===!1?"Ineligible":"Eligible"}),s.is_stale&&e.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-warning",children:[e.jsx(Fe,{className:"h-3 w-3"})," Stale"]}),s.exclusion_reasons?.map(r=>e.jsx("p",{className:"max-w-44 text-[10px] text-muted-foreground",children:r.code.replaceAll("_"," ")},r.code))]})}),e.jsx(m,{className:"hidden lg:table-cell",children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[s.industry_match&&e.jsx(y,{variant:"outline",children:"Industry"}),s.stage_match&&e.jsx(y,{variant:"outline",children:"Stage"}),!!s.signals?.language_match&&e.jsx(y,{variant:"outline",children:"Language"}),!s.industry_match&&!s.stage_match&&!s.signals?.language_match&&e.jsx("span",{className:"text-muted-foreground",children:"—"})]})}),e.jsx(m,{className:"hidden xl:table-cell",children:s.component_scores?e.jsx("div",{className:"grid grid-cols-2 gap-x-3 gap-y-0.5 font-mono text-[10px]",children:Object.entries(s.component_scores).map(([r,be])=>e.jsxs("span",{className:"flex justify-between gap-2",children:[e.jsx("span",{className:"font-sans text-muted-foreground",children:r}),e.jsx("span",{children:be})]},r))}):e.jsx("span",{className:"text-muted-foreground",children:"Legacy"})})]},`${s.startup_id}-${s.mentor_id}`)),Z.length===0&&e.jsx(U,{children:e.jsx(m,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"No matches found"})})]})]})}),O>0&&e.jsxs("div",{className:"flex items-center justify-between mt-4 pt-4 border-t flex-wrap gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Rows per page"}),e.jsxs(F,{value:String(h),onValueChange:s=>{_(Number(s)),i(0)},children:[e.jsx($,{className:"h-8 w-[70px]",children:e.jsx(z,{})}
1),e.jsxs(H,{children:[e.jsx(d,{value:"25",children:"25"}),e.jsx(d,{value:"50",children:"50"}),e.jsx(d,{value:"100",children:"100"})]})]})]}),e.jsx(ke,{page:j+1,totalPages:fe,total:O,onPageChange:s=>i(s-1),className:"mt-0 pt-0 border-t-0"})]})]})]})]})}export{rs 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.