PageSourceSearch

https://nya.yobber.se/assets/EmployerCandidates-C7IFB467.js

js yobber.se collected 2026-10-08 09:57:38 UTC 4,889 bytes, 1 lines download raw bytes

1import{r as s,j as e,L as w}from"./vendor-react-CbEgFW7o.js";import{f as K,eK as V,eL as $,l as G,a8 as H,ad as J,ae as Z,af as z,ag as Q,ah as W,d6 as X,J as Y,eD as ee,eC as te,r as f,cA as T,aa as L,C as ae,ap as se,aq as ie,ar as le,U as ne,eM as oe,O as ce,cx as re,B as de}from"./main-CNvMvyJ0.js";import{D as me}from"./index-DU97bhtr.js";const ue=25,xe=[{key:"activity",direction:"desc"},{key:"activity",direction:"asc"},{key:"name",direction:"asc"},{key:"name",direction:"desc"},{key:"applications",direction:"desc"},{key:"applications",direction:"asc"}];function je(){const{t:a}=me("employer"),{companies:j,currentCompany:i,setCurrentCompanyId:O}=K(),[x,C]=s.useState(""),[c,E]=s.useState(""),[r,I]=s.useState(V),[n,g]=s.useState([]),[_,S]=s.useState(0),[A,N]=s.useState(!0),[D,v]=s.useState(!1),[F,y]=s.useState(!1),b=s.useRef(0);s.useEffect(()=>{const t=setTimeout(()=>E(x),300);return()=>clearTimeout(t)},[x]);const d=s.useCallback(async(t,l)=>{var P;if(!(i!=null&&i.id))return;const m=++b.current;l?v(!0):N(!0);const o=$(r),{data:u,error:M}=await G.rpc("employer_candidate_pool",{_company_id:i.id,_search:c.trim()||null,_limit:ue,_offset:t,...o?{_sort:o}:{}});if(m!==b.current)return;const h=u??[];M?(l||(g([]),S(0)),y(!0)):(g(k=>{if(!l)return h;const U=new Set(k.map(p=>p.candidate_key));return[...k,...h.filter(p=>!U.has(p.candidate_key))]}),S(((P=h[0])==null?void 0:P.total_count)??(l?t:0)),y(!1)),N(!1),v(!1)},[i==null?void 0:i.id,c,r]);s.useEffect(()=>{d(0,!1)},[d]);const R=t=>[t.first_name,t.last_name].filter(Boolean).join(" ").trim()||t.email||"?",q=t=>{var l,m,o,u;return((((l=t.first_name)==null?void 0:l[0])??"")+(((m=t.last_name)==null?void 0:m[0])??"")).toUpperCase()||((u=(o=t.email)==null?void 0:o[0])==null?void 0:u.toUpperCase())||"K"},B=t=>t.latest_job_listing_id&&t.latest_job_application_id?`/employer/jobs/${t.latest_job_listing_id}?tab=applications&applicationId=${t.latest_job_application_id}`:"/employer/spontaneous-applications";return e.jsxs(e.Fragment,{children:[e.jsx(H,{title:a("candidatePool.title"),subtitle:a("candidatePool.subtitle")}),e.jsxs("main",{className:"container-wide py-8",children:[e.jsxs("div",{className:"mb-6 flex flex-col gap-4 sm:flex-row sm:items-center",children:[j.length>1&&e.jsxs(J,{value:i==null?void 0:i.id,onValueChange:O,children:[e.jsx(Z,{className:"w-48",children:e.jsx(z,{})}),e.jsx(Q,{children:j.map(t=>e.jsx(W,{value:t.id,children:t.name},t.id))})]}),e.jsxs("div",{className:"relative flex-1 sm:max-w-md",children:[e.jsx(X,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(Y,{value:x,onChange:t=>C(t.target.value),placeholder:a("candidatePool.searchPlaceholder"),className:"pl-9"})]}),e.jsx(ee,{className:"sm:ml-auto",sort:r,options:xe,onSortChange:I})]}),e.jsx(te,{sort:r}),A?e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{className:"h-16 w-full"}),e.jsx(f,{className:"h-16 w-full"}),e.jsx(f,{className:"h-16 w-full"})]}):F&&n.length===0?e.jsx(T,{icon:L,title:a("candidatePool.error.title"),description:a("candidatePool.error.description"),actionLabel:a("candidatePool.error.retry"),onAction:()=>void d(0,!1)}):n.length===0?e.jsx(T,{icon:L,title:a(c?"candidatePool.noResults.title":"candidatePool.empty.title"),description:a(c?"candidatePool.noResults.description":"candidatePool.empty.description")}):e.jsxs(e.Fragment,{children:[e.jsx(ae,{children:e.jsx("ul",{className:"divide-y divide-border/60",children:n.map(t=>e.jsx("li",{children:e.jsxs(w,{to:B(t),className:"flex items-center gap-3 px-4 py-3 transition-colors hover:bg-muted/60",children:[e.jsxs(se,{className:"h-10 w-10 shrink-0",children:[t.avatar_url&&e.jsx(ie,{src:t.avatar_url,alt:""}),e.jsx(le,{children:q(t)})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"truncate font-medium",children:R(t)}),t.is_guest&&e.jsx(ne,{variant:"outline",className:"shrink-0 px-1 py-0 text-[10px]",children:a("board.guest")})]}),e.jsx("p",{className:"truncate text-sm text-muted-foreground",children:t.email})]}),e.jsxs("div",{className:"hidden shrink-0 text-right sm:block",children:[e.jsx("p",{className:"text-sm",children:a("candidatePool.applications",{count:Number(t.application_count)})}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[t.latest_job_title??a("candidatePool.spontaneousOnly")," · ",oe(new Date(t.last_activity_at),{locale:ce(),addSuffix:!0})]})]}),e.jsx(re,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]})},t.candidate_key))})}),e.jsxs("div",{className:"mt-4 flex flex-col items-center gap-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:a("candidatePool.showingOf",{shown:n.length,total:_})}),n.length<_&&e.jsx(de,{variant:"outline",disabled:D,onClick:()=>void d(n.length,!0),children:a("candidatePool.showMore")})]})]})]})]})}export{je 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.