1import{f as ae,bs as te,j as e,h as x,i as le,k as re,J as b,m as h,a4 as _,U as S,H as je,bF as z,B as P,p as ie,F as B,r as f,E as ue,u as ge,aK as Y,bt as Z,bu as H,aZ as O,I as fe}from"./index-DLd_kDlx.js";import{S as Q,a as G,b as J,c as K,d as N}from"./select-RSrodAEw.js";import{T as Ne,a as be,b as W,c as ve}from"./tabs-DKw2ItQa.js";import{u as ye}from"./useProjects-D0lM2jIR.js";import{u as we}from"./useXternPods-vMByMFnp.js";import{u as Pe,A as Ae}from"./AcquireExperienceDialog-gZslbKSr.js";import{M as Se}from"./map-pin-ChCNbN_o.js";import{Z as Ce}from"./zap-Cs6U3-LC.js";import{P as Le}from"./ProjectDetailsModal-inVluIgr.js";import{R as ee}from"./refresh-cw-CoPjtj5-.js";import{L as se}from"./loader-circle-D2miE2xB.js";import{S as Te}from"./search-DFH5eAlA.js";import"./index-BdQq_4o_.js";import"./index-Deh-4PO1.js";import"./chevron-down-DpJJsCer.js";import"./chevron-up-M4SAwIjf.js";import"./index-lTaZyIGy.js";import"./book-open-BSYsXyfC.js";import"./git-branch-C-twpC7K.js";import"./plus-0WhrdjYO.js";const ke=({project:a,hasApplied:c=!1,applicationStatus:n=null,onApply:v,onViewDetails:p,podStats:r})=>{var L;const{user:o}=ae(),{assessmentStatus:i}=te(),t=(L=o==null?void 0:o.roles)==null?void 0:L.includes("xtern"),y=i==null?void 0:i.assessmentCompleted,u=l=>{switch(l.toLowerCase()){case"beginner":return"bg-green-100 text-green-800";case"intermediate":return"bg-yellow-100 text-yellow-800";case"advanced":return"bg-red-100 text-red-800";default:return"bg-gray-100 text-gray-800"}},M=l=>{switch(l){case"pending":return"bg-yellow-100 text-yellow-800";case"accepted":return"bg-green-100 text-green-800";case"rejected":return"bg-red-100 text-red-800";default:return"bg-gray-100 text-gray-800"}},w=l=>new Date(l).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),C=c||a.current_participants>=a.max_participants,m=t&&!y,I=()=>{m||v&&!C&&v(a.id,"","")},j=()=>e.jsxs(P,{onClick:I,disabled:C&&!m,className:"flex items-center gap-2",size:"sm",children:[m&&e.jsx(ie,{className:"w-4 h-4"}),c?"Applied":a.current_participants>=a.max_participants?"Full":"Apply Now"]});return e.jsxs(x,{className:"hover:shadow-lg transition-shadow duration-200",children:[e.jsx(le,{children:e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsx(re,{className:"text-lg font-semibold line-clamp-2",children:a.title}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{className:u(a.difficulty_level),children:a.difficulty_level}),e.jsx(b,{variant:"outline",children:a.mode})]})]})}),e.jsxs(h,{className:"space-y-4",children:[e.jsx("p",{className:"text-gray-600 text-sm line-clamp-3",children:a.description}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[a.technologies.slice(0,4).map((l,T)=>e.jsx(b,{variant:"secondary",className:"text-xs",children:l},T)),a.technologies.length>4&&e.jsxs(b,{variant:"secondary",className:"text-xs",children:["+",a.technologies.length-4," more"]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm text-gray-600",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(_,{className:"w-4 h-4"}),e.jsxs("span",{children:[a.duration_weeks," weeks"]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(S,{className:"w-4 h-4"}),e.jsx("span",{children:r?`${r.filledSpots}/${r.totalSpots} spots`:`${a.current_participants}/${a.max_participants} participants`})]}),a.application_deadline&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(je,{className:"w-4 h-4"}),e.jsxs("span",{children:["Due ",w(a.application_deadline)]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Se,{className:"w-4 h-4"}),e.jsx("span",{children:"Remote"})]})]}),r&&r.spotsLeft>0&&e.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:e.jsxs("div",{className:"flex items-center gap-2 text-blue-700",children:[e.jsx(Ce,{className:"w-4 h-4"}),e.jsxs("span",{className:"text-sm font-medium",children:[r.spotsLeft," pod spots available"]})]})}),c&&n&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-gray-600",children:"Application Status:"}),e.jsx(b,{className:M(n),children:n})]}),e.jsxs("div",{className:"flex gap-2 pt-2",children:[m?e.jsx(z,{requiredForFeature:"project applications",showInlinePrompt:!1,children:e.jsx(j,{})}):e.jsx(j,{}),e.jsx(P,{variant:"outline",onClick:()=>p==null?void 0:p(a),size:"sm",children:"View Details"})]})]})]})},D=[{id:"1",podName:"AI Chatbot Development",projectTitle:"Customer Service AI Bot",techLeadName:"Sarah Chen",appliedAt:"2024-01-15",status:"pending",maxMembers:8,currentMembers:3}],Fe=()=>{var i;const{user:a}=ae(),{assessmentStatus:c}=te(),n=(i=a==null?void 0:a.roles)==null?void 0:i.includes("xtern"),v=c==null?void 0:c.assessmentCompleted,p=n&&!v,r=t=>new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),o=t=>
1{switch(t){case"pending":return"bg-yellow-100 text-yellow-800";case"accepted":return"bg-green-100 text-green-800";case"rejected":return"bg-red-100 text-red-800";default:return"bg-gray-100 text-gray-800"}};return p&&D.length===0?e.jsxs("div",{className:"mb-8",children:[e.jsxs("h2",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[e.jsx(_,{className:"w-5 h-5"}),"Pending Pod Applications"]}),e.jsx(z,{requiredForFeature:"pod applications",showInlinePrompt:!0,children:e.jsx(x,{children:e.jsxs(h,{className:"p-8 text-center",children:[e.jsx(B,{className:"h-12 w-12 text-gray-400 mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-medium mb-2",children:"No Pending Applications"}),e.jsx("p",{className:"text-gray-500",children:"You haven't applied to any pods yet. Complete your assessment to start applying!"})]})})})]}):D.length===0?e.jsxs("div",{className:"mb-8",children:[e.jsxs("h2",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[e.jsx(_,{className:"w-5 h-5"}),"Pending Pod Applications"]}),e.jsx(x,{children:e.jsxs(h,{className:"p-8 text-center",children:[e.jsx(B,{className:"h-12 w-12 text-gray-400 mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-medium mb-2",children:"No Pending Applications"}),e.jsx("p",{className:"text-gray-500",children:"You haven't applied to any pods yet. Browse available projects to get started!"})]})})]}):e.jsxs("div",{className:"mb-8",children:[e.jsxs("h2",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[e.jsx(_,{className:"w-5 h-5"}),"Pending Pod Applications"]}),p?e.jsx(z,{requiredForFeature:"pod applications",showInlinePrompt:!0,children:e.jsx("div",{className:"space-y-4",children:D.map(t=>e.jsx(x,{className:"opacity-50",children:e.jsx(h,{className:"p-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("h3",{className:"font-semibold text-lg",children:t.podName}),e.jsx(ie,{className:"w-4 h-4 text-gray-400"})]}),e.jsx("p",{className:"text-gray-600 mb-2",children:t.projectTitle}),e.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-500",children:[e.jsxs("span",{children:["Tech Lead: ",t.techLeadName]}),e.jsxs("span",{children:["Applied: ",r(t.appliedAt)]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(S,{className:"w-4 h-4"}),e.jsxs("span",{children:[t.currentMembers,"/",t.maxMembers," members"]})]})]})]}),e.jsx("div",{className:"flex items-center gap-3",children:e.jsx(b,{className:o(t.status),children:t.status})})]})})},t.id))})}):e.jsx("div",{className:"space-y-4",children:D.map(t=>e.jsx(x,{children:e.jsx(h,{className:"p-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"font-semibold text-lg mb-2",children:t.podName}),e.jsx("p",{className:"text-gray-600 mb-2",children:t.projectTitle}),e.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-500",children:[e.jsxs("span",{children:["Tech Lead: ",t.techLeadName]}),e.jsxs("span",{children:["Applied: ",r(t.appliedAt)]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(S,{className:"w-4 h-4"}),e.jsxs("span",{children:[t.currentMembers,"/",t.maxMembers," members"]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(b,{className:o(t.status),children:t.status}),e.jsx(P,{variant:"outline",size:"sm",children:"View Details"})]})]})})},t.id))})]})},We=()=>{const{projects:a,isLoading:c,error:n,refreshProjects:v,applyToProject:p,hasAppliedToProject:r,getApplicationStatus:o}=ye(),{pods:i,isLoading:t}=we(),{pods:y}=Pe(),[u,M]=f.useState(""),[w,C]=f.useState("all"),[m,I]=f.useState("all"),[j,L]=f.useState("available"),[l,T]=f.useState(null),[ce,R]=f.useState(!1),[ne,k]=f.useState(!1),{toast:X}=ue(),de=ge();console.log("XternProjects render state:",{projects:(a==null?void 0:a.length)||0,pods:(i==null?void 0:i.length)||0,allPods:(y==null?void 0:y.length)||0,isLoading:c,error:n});const oe=s=>{const d=y.filter(A=>A.project_id===s);if(d.length===0)return{totalSpots:0,filledSpots:0,spotsLeft:0};const g=d.reduce((A,q)=>A+q.max_members,0),F=d.reduce((A,q)=>A+Math.max(0,q.current_members-1),0),E=g-F;return{totalSpots:g,filledSpots:F,spotsLeft:Math.max(0,E)}},$=a.filter(s=>{const d=s.title.toLowerCase().includes(u.toLowerCase())||s.description.toLowerCase().includes(u.toLowerCase())||s.te
1chnologies.some(E=>E.toLowerCase().includes(u.toLowerCase())),g=w==="all"||s.difficulty_level===w,F=m==="all"||s.mode===m;return d&&g&&F}),U=(()=>{switch(j){case"available":return $.filter(s=>!r(s.id));case"all":default:return $}})(),V=()=>{console.log("Retrying project fetch..."),v()},me=s=>{T(s),R(!0)},xe=s=>{T(s),k(!0)},he=s=>{X({title:"Pod Application",description:"Pod application functionality will be implemented soon."}),k(!1)},pe=()=>{X({title:"Find Tech Lead",description:"Tech lead finder functionality will be implemented soon."}),k(!1)};return n?(console.log("Rendering error state:",n),e.jsx(Y,{children:e.jsxs("div",{className:"min-h-screen flex w-full bg-gray-50",children:[e.jsx(Z,{}),e.jsxs(H,{className:"flex-1",children:[e.jsxs("header",{className:"sticky top-0 z-40 flex h-16 shrink-0 items-center gap-2 border-b bg-white px-4",children:[e.jsx(O,{className:"-ml-1"}),e.jsx("div",{className:"flex-1",children:e.jsx("h1",{className:"text-xl font-semibold",children:"Projects & Pods"})})]}),e.jsx("div",{className:"flex-1 p-6",children:e.jsx(x,{className:"border-red-200 bg-red-50",children:e.jsx(h,{className:"p-6",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(B,{className:"h-5 w-5 text-red-500 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"font-medium text-red-800 mb-1",children:"Error loading projects"}),e.jsx("p",{className:"text-red-700 mb-3",children:n}),e.jsxs(P,{onClick:V,variant:"outline",size:"sm",className:"bg-white hover:bg-red-50",children:[e.jsx(ee,{className:"h-4 w-4 mr-2"}),"Try Again"]})]})]})})})})]})]})})):e.jsxs(Y,{children:[e.jsxs("div",{className:"min-h-screen flex w-full bg-gray-50",children:[e.jsx(Z,{}
1),e.jsxs(H,{className:"flex-1",children:[e.jsxs("header",{className:"sticky top-0 z-40 flex h-16 shrink-0 items-center gap-2 border-b bg-white px-4",children:[e.jsx(O,{className:"-ml-1"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h1",{className:"text-xl font-semibold",children:"Projects & Pods"}),e.jsx("p",{className:"text-sm text-gray-600",children:"Discover projects and manage your pods"})]})]}),e.jsxs("div",{className:"flex-1 space-y-6 p-6",children:[e.jsxs("div",{className:"mb-8",children:[e.jsxs("h2",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[e.jsx(S,{className:"w-5 h-5"}),"My Pods"]}),t?e.jsxs("div",{className:"flex items-center justify-center p-4",children:[e.jsx(se,{className:"h-6 w-6 animate-spin"}),e.jsx("span",{className:"ml-2",children:"Loading pods..."})]}):i.length>0?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:i.map(s=>{var d,g;return e.jsxs(x,{className:"cursor-pointer hover:shadow-lg transition-shadow",children:[e.jsx(le,{children:e.jsx(re,{className:"text-lg",children:s.pod_name})}),e.jsx(h,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm text-gray-600",children:((d=s.projects)==null?void 0:d.title)||"Project Title"}),e.jsx("p",{className:"text-xs text-gray-500 line-clamp-2",children:((g=s.projects)==null?void 0:g.description)||"Project description not available"}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 mt-2",children:[e.jsxs("span",{children:["Members: ",s.current_members,"/",s.max_members]}),e.jsx("span",{children:"â¢"}),e.jsxs("span",{children:["Status: ",s.status]})]}),e.jsx("div",{className:"flex gap-2 mt-4",children:e.jsx(P,{size:"sm",onClick:()=>de(`/xterns/sprint-board-swimlanes?pod=${s.id}&sprint=sprint-1`),children:"Sprint Board"})})]})})]},s.id)})}):e.jsx(x,{children:e.jsxs(h,{className:"p-6 text-center",children:[e.jsx(S,{className:"h-12 w-12 text-gray-400 mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-medium mb-2",children:"No Active Pods"}),e.jsx("p",{className:"text-gray-500 mb-4",children:"You're not currently part of any pods. Apply to projects below to join or create pods."})]})})]}),e.jsx(Fe,{}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold mb-4",children:"Available Projects"}),e.jsxs(Ne,{value:j,onValueChange:L,className:"w-full",children:[e.jsxs(be,{children:[e.jsx(W,{value:"available",children:"Available Projects"}),e.jsx(W,{value:"all",children:"All Projects"})]}),e.jsxs(ve,{value:j,className:"mt-6",children:[e.jsxs("div",{className:"flex flex-col md:flex-row gap-4 mb-6",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(Te,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-500"}),e.jsx(fe,{placeholder:"Search projects...",className:"pl-10",value:u,onChange:s=>M(s.target.value)})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Q,{value:w,onValueChange:C,children:[e.jsx(G,{className:"w-40",children:e.jsx(J,{placeholder:"Difficulty"})}),e.jsxs(K,{children:[e.jsx(N,{value:"all",children:"All Levels"}),e.jsx(N,{value:"beginner",children:"Beginner"}),e.jsx(N,{value:"intermediate",children:"Intermediate"}),e.jsx(N,{value:"advanced",children:"Advanced"})]})]}),e.jsxs(Q,{value:m,onValueChange:I,children:[e.jsx(G,{className:"w-32",children:e.jsx(J,{placeholder:"Mode"})}),e.jsxs(K,{children:[e.jsx(N,{value:"all",children:"All Modes"}),e.jsx(N,{value:"solo",children:"Solo"}),e.jsx(N,{value:"pod",children:"Pod"})]})]})]})]}),c?e.jsxs("div",{className:"flex items-center justify-center p-8",children:[e.jsx(se,{className:"h-8 w-8 animate-spin"}),e.jsx("span",{className:"ml-2",children:"Loading projects..."})]}):U.length===0?e.jsx(x,{children:e.jsxs(h,{className:"p-8 text-center",children:[e.jsx("h3",{className:"text-lg font-medium mb-2",children:j==="available"?"No available projects":"No projects found"}),e.jsx("p",{className:"text-gray-500 mb-4",children:j==="available"?"All projects have been applied to or are full.":u||w!=="all"||m!=="all"?"No projects match your search criteria.":"No projects available at the moment."}),a.length===0&&e.jsxs("div",{className:"text-sm text-gray-400",children:[e.jsx("p",{children:"No projects have been published to the database yet."}),e.jsxs(P,{onClick:V,variant:"outline",size:"sm",className:"mt-2",children:[e.jsx(ee,{className:"h-4 w-4 mr-2"}),"Refresh"]})]})]})}):e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:U.map(s=>{const d=oe(s.id);return e.jsx(ke,{project:s,hasApplied:r(s.id),applicationStatus:o(s.id),onApply:p,onViewDetails:me,podStats:d},s.id)})})]})]})]})]})]})]}),e.jsx(Le,{project:l,isOpen:ce,onClose:()=>R(!1),hasApplied:l?r(l.id):!1,applicationStatus:l?o(l.id):null,onAcquireExperience:xe,userType:"xtern"}),e.jsx(Ae,{project:l,isOpen:ne,onClose:()=>k(!1),onSelectSolo:null,onSelectPod:he,onFindTechLead:pe})]})};export{We 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.