PageSourceSearch

https://xterns.ai/assets/SuperAdminTalentPipeline-WYfnlo-O.js

js xterns.ai collected 2026-10-05 13:23:56 UTC 11,039 bytes, 1 lines download raw bytes

1import{r as n,Z as ee,j as e,B as v,I as z,ad as X,X as T,J as g,h as se,m as te,a1 as re,a2 as ae,a3 as le,U as ie,s as ne,ae as V}from"./index-DLd_kDlx.js";import{S as oe,U as ce}from"./SuperAdminLayout-BsUvQU2j.js";import{u as de,X as me}from"./XternDetailPanel-BJRSNvku.js";import{S as P,a as L,b as M,c as A,d as p}from"./select-RSrodAEw.js";import{R as xe}from"./refresh-cw-CoPjtj5-.js";import{S as ue}from"./search-DFH5eAlA.js";import{L as he}from"./loader-circle-D2miE2xB.js";import{M as pe}from"./map-pin-ChCNbN_o.js";import{C as fe}from"./chevron-left-Wewsh5d7.js";import{C as ge}from"./chevron-right-CD1gvy-q.js";import"./NotificationIcon-C1wwYnH5.js";import"./popover-BMD5FOmU.js";import"./scroll-area-BXTuUF24.js";import"./index-Deh-4PO1.js";import"./index-BdQq_4o_.js";import"./NotificationItem-Dc2WXW-y.js";import"./formatDistanceToNow-57P64IbE.js";import"./en-US-9SRVm7yB.js";import"./differenceInCalendarMonths-BA0TPVs2.js";import"./endOfDay-DkR3ZXc8.js";import"./endOfMonth-CYn6pTOm.js";import"./message-square-CtxeCfRz.js";import"./trophy-DBX-jNOC.js";import"./triangle-alert-Chqk_WK7.js";import"./dropdown-menu-DSd1c3Vk.js";import"./index-lTaZyIGy.js";import"./crown-hzm_bRIt.js";import"./user-check-DxoAQXwU.js";import"./star-BH1OFEcs.js";import"./globe-C057RQ73.js";import"./timer-CZhDpZys.js";import"./briefcase-business-CphIeAJd.js";import"./key-round-B79BulHq.js";import"./tabs-DKw2ItQa.js";import"./usePublicCVData-BloADn1S.js";import"./VerifiedSkillsSection-BPTGucj2.js";import"./shield-check-C7sUiJPm.js";import"./mail-BVn2o8AP.js";import"./phone-rtR4Bg4j.js";import"./linkedin-C3YpjTq8.js";import"./external-link-D0CFvOTk.js";import"./book-open-BSYsXyfC.js";import"./download-Cr0jatld.js";import"./chevron-down-DpJJsCer.js";import"./chevron-up-M4SAwIjf.js";const I=12,je=new Map(X.map(a=>[a.id,a.name]));function Ne(a){return a!=null&&a.length?a.map(j=>je.get(j)||j):[]}function ve(a){return a===null?"text-muted-foreground":a>=800?"text-emerald-600":a>=600?"text-blue-600":a>=400?"text-amber-600":a>=200?"text-orange-600":"text-red-600"}const us=()=>{const{data:a,isLoading:j}=de(),[m,D]=n.useState(""),[Z,Q]=n.useState(null),[G,R]=n.useState(!1),[S,_]=n.useState(!1),H=ee(),[c,F]=n.useState(""),[i,C]=n.useState([]),[w,Se]=n.useState(""),[d,O]=n.useState(0),[h,U]=n.useState("default"),[x,y]=n.useState(1),b=n.useMemo(()=>{var t;if(!a)return[];const s=new Set;for(const o of a)(t=o.skills)==null||t.forEach(r=>s.add(r));return Array.from(s).sort()},[a]),E=n.useMemo(()=>{if(!w)return b.filter(t=>!i.includes(t)).slice(0,20);const s=w.toLowerCase();return b.filter(t=>t.toLowerCase().includes(s)&&!i.includes(t)).slice(0,20)},[b,w,i]),J=c||i.length>0||d>0||h!=="default",K=()=>{F(""),C([]),O(0),U("default"),D("")};n.useEffect(()=>{y(1)},[m,c,i,d,h]);const{filtered:q,totalPages:k}=n.useMemo(()=>{if(!a)return{filtered:[],totalPages:0};let s=[...a];if(m){const r=m.toLowerCase();s=s.filter(l=>{var u;return l.full_name.toLowerCase().includes(r)||l.email.toLowerCase().includes(r)||((u=l.skills)==null?void 0:u.some(N=>N.toLowerCase().includes(r)))})}c&&(s=s.filter(r=>{var l;return(l=r.preferred_roles)==null?void 0:l.includes(c)})),i.length>0&&(s=s.filter(r=>i.some(l=>{var u;return(u=r.skills)==null?void 0:u.includes(l)}))),d>0&&(s=s.filter(r=>r.podCount>=d)),h==="highest"?s.sort((r,l)=>(l.latestDareyScore??-1)-(r.latestDareyScore??-1)):h==="lowest"&&s.sort((r,l)=>(r.latestDareyScore??1/0)-(l.latestDareyScore??1/0));const t=Math.max(1,Math.ceil(s.length/I));return{filtered:s.slice((x-1)*I,x*I),totalPages:t,totalCount:s.length}},[a,m,c,i,d,h,x]),W=async()=>{_(!0);try{const{data:s,error:t}=await ne.functions.invoke("refresh-dareyscore-cache");if(t)throw t;V({title:"Scores refreshed",description:`${s.refreshed} updated, ${s.skipped} skipped, ${s.errors} errors`}),H.invalidateQueries({queryKey:["talent-pipeline"]})}catch(s){V({title:"Refresh failed",description:s.message||"Could not refresh scores",variant:"destructive"})}finally{_(!1)}},Y=s=>{Q(s),R(!0)},B=n.useMemo(()=>{if(!a)return 0;let s=[...a];if(m){const t=m.toLowerCase();s=s.filter(o=>{var r;return o.full_name.toLowerCase().includes(t)||o.email.toLowerCase().includes(t)||((r=o.skills)==null?void 0:r.some(l=>l.toLowerCase().includes(t)))})}return c&&(s=s.filter(t=>{var o;return(o=t.preferred_roles)==null?void 0:o.includes(c)})),i.length>0&&(s=s.filter(t=>i.some(o=>{var r;return(r=t.skills)==null?void 0:r.includes(o)}))),d>0&&(s=s.filter(t=>t.podCount>=d)),s.length},[a,m,c,i,d]);return e.jsxs(oe,{children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[e.jsx(ce,{className:"h-6 w-6 text-primary"}),"Talent Pipeline"]}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Browse and explore all xterns on the platform"})]}),e.jsxs(v,{variant:"outline",size:"sm",onClick:W,disabled:S,children:[e.jsx(xe,{className:`h-4 w-4 mr-2 ${S?"animate-spin":""}`}),S?"Refreshing…":"Refresh Scores"]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex flex-col sm:flex-row gap-3",children:e.jsxs("div",{className:"relative flex-1 max-w-md",children:[e.jsx(ue,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(z,{placeholder:"Search by name, email, or skill...",value:m,onChange:s=>D(s.target.value),className:"pl-9"})]})}),e.jsxs("div",{className:"flex flex-wrap gap-3 items-end",children:[e.jsxs("div",{className:"w-48",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1 block",children:"Career Path"}),e.jsxs(P,{value:c||"all",onValueChange:s=>F(s==="all"?"":s),children:[e.jsx(L,{className:"h-9 text-sm",children:e.jsx(M,{placeholder:"All Paths"})}),e.jsxs(A,{children:[e.jsx(p,{value:"all",children:"All Paths"}),X.map(s=>e.jsx(p,{value:s.id,children:s.name},s.id))]})]})]}),e.jsxs("div",{className:"w-44",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1 block",children:"Sort by Score"}),e.jsxs(P,{value:h,onValueChange:s=>U(s),children:[e.jsx(L,{className:"h-9 text-sm",children:e.jsx(M,{})}),e.jsxs(A,{children:[e.jsx(p,{value:"default",children:"A–Z (Default)"}
1),e.jsx(p,{value:"highest",children:"Highest First"}),e.jsx(p,{value:"lowest",children:"Lowest First"})]})]})]}),e.jsxs("div",{className:"w-32",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1 block",children:"Min Pods"}),e.jsx(z,{type:"number",min:0,value:d,onChange:s=>O(Math.max(0,Number(s.target.value)||0)),className:"h-9 text-sm"})]}),e.jsxs("div",{className:"w-56 relative",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1 block",children:"Add Skill Filter"}),e.jsxs(P,{value:"",onValueChange:s=>{s&&!i.includes(s)&&C([...i,s])},children:[e.jsx(L,{className:"h-9 text-sm",children:e.jsx(M,{placeholder:"Select skill…"})}),e.jsxs(A,{children:[E.map(s=>e.jsx(p,{value:s,children:s},s)),E.length===0&&e.jsx("div",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:"No skills found"})]})]})]}),J&&e.jsxs(v,{variant:"ghost",size:"sm",onClick:K,className:"h-9",children:[e.jsx(T,{className:"h-3.5 w-3.5 mr-1"}),"Clear"]})]}),i.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:i.map(s=>e.jsxs(g,{variant:"secondary",className:"text-xs gap-1 pr-1",children:[s,e.jsx("button",{onClick:()=>C(i.filter(t=>t!==s)),className:"ml-0.5 hover:text-destructive",children:e.jsx(T,{className:"h-3 w-3"})})]},s))})]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[B," xtern",B!==1?"s":""," found"]}),j?e.jsx("div",{className:"flex items-center justify-center py-16",children:e.jsx(he,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):q.length===0?e.jsx("div",{className:"text-center py-16 text-muted-foreground",children:"No xterns found."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:q.map(s=>{var r,l,u,N,$;const t=Ne(s.preferred_roles),o=[s.location,s.country].filter(Boolean).join(", ");return e.jsx(se,{className:"cursor-pointer hover:shadow-md transition-shadow border-border",onClick:()=>Y(s.user_id),children:e.jsxs(te,{className:"p-5",children:[e.jsxs("div",{className:"flex items-start gap-3 mb-3",children:[e.jsxs(re,{className:"h-11 w-11 shrink-0",children:[e.jsx(ae,{src:s.avatar_url||void 0}),e.jsx(le,{className:"bg-primary/10 text-primary font-semibold",children:((l=(r=s.full_name)==null?void 0:r.charAt(0))==null?void 0:l.toUpperCase())||"X"})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"font-semibold text-sm truncate",children:s.full_name}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.email}),o&&e.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1 mt-0.5",children:[e.jsx(pe,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"truncate",children:o})]})]})]}),t.length>0&&e.jsxs("div",{className:"flex flex-wrap gap-1 mb-2",children:[t.slice(0,2).map(f=>e.jsx(g,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:f},f)),t.length>2&&e.jsxs(g,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:["+",t.length-2]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 mb-3",children:[(u=s.skills)==null?void 0:u.slice(0,3).map(f=>e.jsx(g,{variant:"secondary",className:"text-[10px] px-1.5 py-0 font-normal",children:f},f)),(((N=s.skills)==null?void 0:N.length)??0)>3&&e.jsxs(g,{variant:"secondary",className:"text-[10px] px-1.5 py-0 font-normal",children:["+",((($=s.skills)==null?void 0:$.length)??0)-3]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-border",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wide",children:"Signal Score"}),s.latestDareyScore!=null?e.jsx("p",{className:`font-bold text-lg leading-tight ${ve(s.latestDareyScore)}`,children:Math.round(s.latestDareyScore)}):e.jsx("p",{className:"text-muted-foreground text-lg leading-tight",children:"—"})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wide",children:"Pods"}),e.jsxs("p",{className:"font-semibold text-lg leading-tight flex items-center justify-end gap-1",children:[e.jsx(ie,{className:"h-3.5 w-3.5 text-muted-foreground"}),s.podCount]})]})]})]})},s.id)})}),k>1&&e.jsxs("div",{className:"flex items-center justify-center gap-4 pt-4",children:[e.jsxs(v,{variant:"outline",size:"sm",disabled:x<=1,onClick:()=>y(x-1),children:[e.jsx(fe,{className:"h-4 w-4 mr-1"}),"Previous"]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["Page ",x," of ",k]}),e.jsxs(v,{variant:"outline",size:"sm",disabled:x>=k,onClick:()=>y(x+1),children:["Next",e.jsx(ge,{className:"h-4 w-4 ml-1"})]})]})]})]}),e.jsx(me,{userId:Z,open:G,onOpenChange:R})]})};export{us 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.