1import{j as e}from"./query-Bb51m_nn.js";import{r as o,u as S}from"./react-vendor-D0oV-nEq.js";import{H as $,b as d}from"./Header-iQsExY29.js";import{Footer as B}from"./Footer-NKWtx7ax.js";import{a as M}from"./SEO-BDuvxbn0.js";import{g as O}from"./seoConfig-CKa9ckd7.js";import{C as h,c as f}from"./card-BBYjmCls.js";import{x as z}from"./index-BYmuUAXY.js";import{L as F}from"./loader-circle-Dvf4Pq0u.js";import{C as H}from"./chevron-left-CVZCKLLl.js";import{C as U}from"./chevron-right-GFTk7tAL.js";const I="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),X=()=>{const c=z(),a=(c==null?void 0:c.type)==="members"&&c.letter==="A"&&c.page===1?c:null,[m,b]=o.useState("A"),[r,j]=o.useState(1),[x,u]=o.useState((a==null?void 0:a.candidates)??[]),[i,w]=o.useState({currentPage:(a==null?void 0:a.pagination.page)??1,totalPages:(a==null?void 0:a.pagination.totalPages)??1,totalCount:(a==null?void 0:a.pagination.total)??0,limit:(a==null?void 0:a.pagination.limit)??20}),[N,C]=o.useState(!a),[p,v]=o.useState(null),[P,y]=o.useState(!!a),E=async(t,n)=>{C(!0),v(null);try{const s=await fetch(`https://ap1v2.cloudhire.ai/api/v1/candidate/candidates/alphabetical?letter=${t}&page=${n}&limit=20`);if(!s.ok)throw new Error("Failed to fetch candidates");const l=await s.json();l.success&&l.data?(u(l.data.candidates||[]),w({currentPage:l.data.pagination.page,totalPages:l.data.pagination.totalPages,totalCount:l.data.pagination.total,limit:l.data.pagination.limit})):u([])}catch(s){v(s instanceof Error?s.message:"An error occurred"),u([])}finally{C(!1)}};o.useEffect(()=>{P&&m==="A"&&r===1||E(m,r)},[m,r,P]);const L=t=>{b(t),j(1),y(!1)},g=t=>{t>=1&&t<=i.totalPages&&(j(t),window.scrollTo({top:0,behavior:"smooth"}))},k=S(),A=O(k.pathname);return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(M,{...A}),e.jsx($,{}),e.jsx("main",{className:"section-container",children:e.jsxs("div",{className:"max-w-6xl mx-auto space-y-12",children:[e.jsxs("div",{className:"text-center space-y-4",children:[e.jsx("h1",{className:"text-3xl sm:text-4xl lg:text-5xl font-bold tracking-tight",children:"Our Members"}),e.jsx("p",{className:"text-xl text-muted-foreground max-w-3xl mx-auto",children:"Browse our community of talented professionals from A to Z"})]}),e.jsx(h,{children:e.jsx(f,{className:"pt-6",children:e.jsx("div",{className:"flex flex-wrap justify-center gap-2",children:I.map(t=>e.jsx(d,{variant:m===t?"default":"outline",size:"sm",onClick:()=>L(t),className:"w-10 h-10 p-0",children:t},t))})})}),N&&e.jsx("div",{className:"flex justify-center items-center py-12",children:e.jsx(F,{className:"w-8 h-8 animate-spin text-primary"})}),p&&e.jsx(h,{className:"border-destructive",children:e.jsx(f,{className:"pt-6 text-center",children:e.jsx("p",{className:"text-destructive",children:p})})}),!N&&!p&&e.jsxs(e.Fragment,{children:[x.length>0?e.jsx("div",{className:"grid sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-x-6 gap-y-3",children:x.map(t=>{const n=`${t.firstName} ${t.lastName||""}`.trim(),s=`https://jobs.cloudhire.ai/user/${t.candidateProfileId}`;return e.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"text-foreground hover:text-primary transition-colors font-medium","aria-label":`Open profile for ${n} in new tab`,children:n},t.candidateProfileId)})}):e.jsx(h,{children:e.jsx(f,{className:"pt-6 text-center",children:e.jsxs("p",{className:"text-muted-foreground",children:['No members found starting with "',m,'"']})})}),i.totalPages>1&&e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsxs(d,{variant:"outline",size:"sm",onClick:()=>g(r-1),disabled:r===1,children:[e.jsx(H,{className:"w-4 h-4"}),"Previous"]}),e.jsx("div",{className:"flex items-center gap-2",children:Array.from({length:Math.min(5,i.totalPages)},(t,n)=>{let s;return i.totalPages<=5||r<=3?s=n+1:r>=i.totalPages-2?s=i.totalPages-4+n:s=r-2+n,e.jsx(d,{variant:r===s?"default":"outline",size:"sm",onClick:()=>g(s),className:"w-10",children:s},s)})}),e.jsxs(d,{variant:"outline",size:"sm",onClick:()=>g(r+1),disabled:r===i.totalPages,children:["Next",e.jsx(U,{className:"w-4 h-4"})]})]}),x.length>0&&e.jsxs("div",{className:"text-center text-sm text-muted-foreground",children:["Showing ",(r-1)*i.limit+1,"-",Math.min(r*i.limit,i.totalCount)," of"," ",i.totalCount," members"]})]})]})}),e.jsx(B,{})]})};export{X 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.