1import{c as Fe,u as _e,r as l,s as $,j as e,aK as J,bK as G,bu as Q,J as j,B as C,S as Te,I as Me,ad as le,X as ke}from"./index-DLd_kDlx.js";import{T as Z}from"./TechLeadHeader-eLOg3V3h.js";import{S as v,a as y,b as N,c as w,d as n}from"./select-RSrodAEw.js";import{u as Ie}from"./useProjects-D0lM2jIR.js";import{L as Le,P as Be}from"./ProjectDetailsModal-inVluIgr.js";import{W as ze,i as De}from"./WizardMockContainer-Dn7sEr7R.js";import{P as Ve}from"./PodCreationWizard-CdgIUX8C.js";import{u as He}from"./usePodCreation-D6Vw7gOo.js";import{m as P}from"./proxy-D0Q57V63.js";import{R as ee,T as se,B as Re,C as Ue}from"./generateCategoricalChart-ByDL-d9M.js";import{B as Ke}from"./BarChart-mmA8KDsJ.js";import{X as Oe,Y as We}from"./YAxis-BtEb5zMI.js";import{P as qe,a as Xe}from"./PieChart-Bcnc_bSW.js";import{S as Ye}from"./search-DFH5eAlA.js";import{F as $e}from"./filter-BMeMiGQo.js";import{L as Je}from"./lightbulb-BpXO0eKD.js";import"./dropdown-menu-DSd1c3Vk.js";import"./index-Deh-4PO1.js";import"./index-lTaZyIGy.js";import"./chevron-right-CD1gvy-q.js";import"./NotificationIcon-C1wwYnH5.js";import"./popover-BMD5FOmU.js";import"./scroll-area-BXTuUF24.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"./rotate-ccw-Bx1C64Ur.js";import"./chevron-down-DpJJsCer.js";import"./chevron-up-M4SAwIjf.js";import"./book-open-BSYsXyfC.js";import"./git-branch-C-twpC7K.js";import"./plus-0WhrdjYO.js";import"./alert-CyfKy7ls.js";import"./info-BLiu1f4f.js";import"./radio-group-BU56MLP7.js";import"./route-Rd_Np_3d.js";import"./textarea-C6X-I43k.js";import"./refresh-cw-CoPjtj5-.js";import"./save-DnzFMk1L.js";import"./trash-2-0uuZSTFd.js";import"./code-xml-BUecDWl6.js";import"./loader-circle-D2miE2xB.js";import"./shield-alert-CVqPbwtZ.js";import"./label-D4-ENrYn.js";import"./globe-C057RQ73.js";import"./PodNameGenerator-DUSAq0St.js";import"./table-BOJIo-OD.js";import"./useTechLeads-Cmw-XrPs.js";import"./mail-plus-CkuPXPSq.js";import"./star-BH1OFEcs.js";import"./external-link-D0CFvOTk.js";import"./useAIDeliveryPlanning-CTW9zPaD.js";import"./useMultilateralTechLeadInvitations-CzvKFiLJ.js";import"./findIndex-Cos7Fxsp.js";import"./tiny-invariant-CopsF_GD.js";import"./PolarAngleAxis-Blx3t8Nb.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const Ge=Fe("FilePlus2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]]),T={hidden:{opacity:0,y:14},show:{opacity:1,y:0}},te=["#2563EB","#16A34A","#F97316","#7C3AED","#EF4444","#0F766E"];function Qe(a){var m;const r=a.trim();return((m=De.find(d=>d.id===r))==null?void 0:m.name)||r}function z(a){var d,x;const r=(d=a.project_content)==null?void 0:d.find(c=>["industries","industry"].includes(c.title.toLowerCase()));return((x=r==null?void 0:r.items)!=null&&x.length?r.items:a.industry?[a.industry]:[]).map(Qe).filter(
6Boolean)}function Ze(a){return Array.isArray(a.career_paths)&&a.career_paths.length>1?"Multilateral (cross-functional)":"Unilateral (single pathway)"}function es(a){var r;return((r=le.find(m=>m.id===a))==null?void 0:r.name)||a}function ae({title:a,description:r,children:m}){return e.jsxs(P.section,{variants:T,className:"rounded-[20px] border border-[#EAECEF] bg-white p-5",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-slate-950",children:a}),e.jsx("p",{className:"text-xs text-slate-500",children:r})]}),e.jsx("div",{className:"h-64",children:m})]})}function ss({project:a,usageCount:r,onView:m}){var x;const d=z(a);return e.jsxs(P.article,{variants:T,whileHover:{y:-5},className:"rounded-[20px] border border-[#EAECEF] bg-white p-5 shadow-[0_10px_30px_rgba(15,23,42,0.04)] transition-shadow hover:shadow-[0_18px_40px_rgba(15,23,42,0.08)]",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"line-clamp-2 text-base font-semibold leading-6 text-slate-950",children:a.title}),e.jsx("p",{className:"mt-1 text-sm text-slate-500",children:d[0]||"No industry selected"})]}),((x=a.project_content)==null?void 0:x.some(c=>c.title.toLowerCase().includes("project type")))&&e.jsx(j,{className:"bg-blue-50 text-blue-700 hover:bg-blue-50",children:"AI"})]}),e.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.jsx(j,{variant:"outline",className:"capitalize",children:a.difficulty_level}),e.jsx(j,{variant:"outline",children:Ze(a)}),a.career_paths.slice(0,2).map(c=>e.jsx(j,{className:"bg-slate-100 text-slate-700 hover:bg-slate-100",children:es(c)},c)),a.career_paths.length>2&&e.jsxs(j,{variant:"outline",children:["+",a.career_paths.length-2]})]}),e.jsx("p",{className:"mt-4 line-clamp-3 text-sm leading-6 text-slate-600",children:a.description}),e.jsxs("div",{className:"mt-5 grid grid-cols-3 gap-2",children:[e.jsxs("div",{className:"rounded-2xl bg-slate-50 p-3",children:[e.jsx("p",{className:"text-sm font-semibold text-slate-950",children:r}),e.jsx("p",{className:"text-[11px] text-slate-500",children:"Pods"})]}),e.jsxs("div",{className:"rounded-2xl bg-slate-50 p-3",children:[e.jsx("p",{className:"text-sm font-semibold text-slate-950",children:a.current_participants||0}),e.jsx("p",{className:"text-[11px] text-slate-500",children:"Participants"})]}),e.jsxs("div",{className:"rounded-2xl bg-slate-50 p-3",children:[e.jsx("p",{className:"text-sm font-semibold text-slate-950",children:a.duration_weeks||0}),e.jsx("p",{className:"text-[11px] text-slate-500",children:"Weeks"})]})]}),e.jsx("div",{className:"mt-5 flex flex-wrap gap-2",children:e.jsx(C,{size:"sm",className:"rounded-full",onClick:m,children:"View"})})]})}const mt=()=>{const a=_e(),[r,m]=l.useState(""),[d,x]=l.useState("all"),[c,re]=l.useState("all"),[A,ie]=l.useState("all"),[E,ne]=l.useState("all"),[S,oe]=l.useState("all"),[g,de]=l.useState("most-used"),[ce,D]=l.useState(1),[K,M]=l.useState(null),[me,V]=l.useState(!1),[he,H]=l.useState(!1),[xe,F]=l.useState(!1),[O,ue]=l.useState([]),[_,pe]=l.useState({}),{projects:W,isLoading:je,error:q,refreshProjects:ge}=Ie(),{createPod:fe}=He(),k=l.useCallback(async()=>{const[{data:s,error:t},{data:p,error:B}]=await Promise.all([$.from("projects").select("*").order("posted_date",{ascending:!1}),$.from("pods").select("project_id")]);if(t)throw t;if(B)throw B;const R=(p||[]).reduce((i,o)=>(o.project_id&&(i[o.project_id]=(i[o.project_id]||0)+1),i),{}),U=(s||[]).map(i=>({...i,mode:i.mode,difficulty_level:i.difficulty_level,technologies:Array.isArray(i.technologies)?i.technologies.filter(o=>typeof o=="string"):[],prerequisites:Array.isArray(i.prerequisites)?i.prerequisites.filter(o=>typeof o=="string"):[],learning_outcomes:Array.isArray(i.learning_outcomes)?i.learning_outcomes.filter(o=>typeof o=="string"):[],career_paths:Array.isArray(i.career_paths)?i.career_paths.filter(o=>typeof o=="string"):[],project_content:Array.isArray(i.project_content)?i.project_content:[]}));ue(U),pe(R)},[]);l.useEffect(()=>{k().catch(s=>{console.error("Error loading project hub analytics:",s)})},[k]);const h=O.length?O:W,f=9,be=l.useMemo(()=>Array.from(new Set(h.flatMap(z))).sort(),[h]),ve=l.useMemo(()=>Array.from(new Set(h.flatMap(s=>s.technologies||[]))).sort(),[h]),b=l.useMemo(()=>{const s=r.trim().toLowerCase();return h.filter(t=>{const p=z(t),B=!s||t.title.toLowerCase().includes(s)||t.description.toLowerCase().includes(s)||t.technologies.some(Se=>Se.toLowerCase().includes(s)),R=d==="all"||p.includes(d),U=c==="all"||t.difficulty_level===c,i=A==="all"||t.career_paths.includes(A),o=E==="all"||(E==="multilateral"?t.career_paths.length>1:t.career_paths.length<=1),Ee=S==="all"||t.technologies.includes(S);return B&&R&&U&&i&&o&&Ee}).sort((t,p)=>g==="most-used"?(_[p.id]||0)-(_[t.id]||0):g==="newest"?new Date(p.posted_date).getTime()-new Date(t.posted_date).getTime():g==="alph
6abetical"?t.title.localeCompare(p.title):0)},[h,r,d,c,A,E,S,g,_]);l.useEffect(()=>{D(1)},[r,d,c,A,E,S,g]);const I=Math.max(1,Math.ceil(b.length/f)),u=Math.min(ce,I),X=b.slice((u-1)*f,u*f),ye=b.length?(u-1)*f+1:0,Ne=Math.min(u*f,b.length),L=Array.from(h.flatMap(z).reduce((s,t)=>(s.set(t,(s.get(t)||0)+1),s),new Map)).map(([s,t])=>({name:s,value:t})).sort((s,t)=>t.value-s.value).slice(0,6),Y=h.map(s=>({name:s.title.length>22?`${s.title.slice(0,22)}...`:s.title,usage:_[s.id]||0})).sort((s,t)=>t.usage-s.usage).slice(0,5),we=s=>{M(s),V(!0)},Ce=s=>{M(s),V(!1),H(!0)},Pe=async s=>{try{const t=await fe(s);H(!1),M(null),k(),a(`/tech-lead/delivery-plan-creation?pod=${t.id}`)}catch(t){console.error("Failed to create pod from project hub:",t)}},Ae=()=>{F(!1),ge(),k()};return q?e.jsx(J,{children:e.jsxs("div",{className:"flex min-h-screen w-full bg-[#FAFBFC]",children:[e.jsx(G,{}),e.jsxs(Q,{className:"flex-1",children:[e.jsx(Z,{title:"Project Hub"}),e.jsx("main",{className:"p-8",children:e.jsxs("div",{className:"rounded-[20px] border border-red-100 bg-red-50 p-8 text-red-700",children:["Error loading projects: ",q]})})]})]})}):e.jsx(J,{children:e.jsxs("div",{className:"flex min-h-screen w-full bg-[#FAFBFC] font-['Inter',sans-serif]",children:[e.jsx(G,{}),e.jsxs(Q,{className:"flex-1",children:[e.jsx(Z,{title:"Project Hub"}),e.jsxs(P.main,{initial:"hidden",animate:"show",transition:{staggerChildren:.055},className:"mx-auto w-full max-w-[1680px] space-y-8 px-4 py-6 sm:px-6 lg:px-8",children:[e.jsx(P.section,{variants:T,className:"overflow-hidden rounded-[24px] border border-[#EAECEF] bg-white shadow-[0_18px_55px_rgba(15,23,42,0.05)]",children:e.jsxs("div",{className:"grid gap-8 p-6 lg:grid-cols-[1fr_360px] lg:items-center lg:p-8",children:[e.jsxs("div",{children:[e.jsxs(j,{className:"bg-blue-50 text-blue-700 hover:bg-blue-50",children:[e.jsx(Le,{className:"mr-1.5 h-3.5 w-3.5"}),"Template creation workspace"]}),e.jsx("h1",{className:"mt-5 text-4xl font-semibold tracking-tight text-slate-950 md:text-5xl",children:"Project Hub"}),e.jsx("p",{className:"mt-4 max-w-3xl text-base leading-7 text-slate-600",children:"Create reusable AI-powered project templates used across the Xtern ecosystem. Track adoption, reuse, and project completion across Tech Leads."}),e.jsx("div",{className:"mt-7 flex flex-wrap gap-3",children:e.jsxs(C,{className:"h-11 rounded-full bg-blue-600 px-5 hover:bg-blue-700",onClick:()=>F(!0),children:[e.jsx(Ge,{className:"mr-2 h-4 w-4"}),"Create New Project"]})})]}),e.jsxs("div",{className:"rounded-[22px] border border-blue-100 bg-gradient-to-br from-blue-50 via-white to-slate-50 p-5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-slate-950",children:"Total created projects"}),e.jsx("p",{className:"text-xs text-slate-500",children:"All projects currently visible on the platform"})]}),e.jsx(Te,{className:"h-5 w-5 text-blue-600"})]}),e.jsxs("div",{className:"mt-6",children:[e.jsxs("div",{className:"flex items-end justify-between",children:[e.jsx("p",{className:"text-5xl font-semibold text-slate-950",children:h.length}),e.jsx("p",{className:"text-sm font-medium text-slate-500",children:"projects"})]}),e.jsxs("div",{className:"mt-5 grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"rounded-2xl bg-white p-4",children:[e.jsx("p",{className:"text-2xl font-semibold text-slate-950",children:W.length}),e.jsx("p",{className:"text-xs text-slate-500",children:"Active projects"})]}),e.jsxs("div",{className:"rounded-2xl bg-white p-4",children:[e.jsx("p",{className:"text-2xl font-semibold text-slate-950",children:L.length}),e.jsx("p",{className:"text-xs text-slate-500",children:"Industries"})]})]})]})]})]})}),e.jsxs("div",{className:"grid gap-5 xl:grid-cols-2",children:[e.jsx(ae,{title:"Most Used Templates",description:"Projects with the highest pod adoption",children:Y.length>0?e.jsx(ee,{width:"100%",height:"100%",children:e.jsxs(Ke,{data:Y,layout:"vertical",margin:{left:20},children:[e.jsx(Oe,{type:"number",allowDecimals:!1,hide:!0}),e.jsx(We,{dataKey:"name",type:"category",width:140,tickLine:!1,axisLine
6:!1,fontSize:12}),e.jsx(se,{}),e.jsx(Re,{dataKey:"usage",name:"Pods created",fill:"#16A34A",radius:[0,10,10,0]})]})}):e.jsx("div",{className:"flex h-full items-center justify-center rounded-2xl bg-slate-50 text-sm text-slate-500",children:"No project usage data yet."})}),e.jsx(ae,{title:"Top Industries",description:"Industry focus selected during project creation",children:L.length>0?e.jsx(ee,{width:"100%",height:"100%",children:e.jsxs(qe,{children:[e.jsx(Xe,{data:L,dataKey:"value",nameKey:"name",innerRadius:58,outerRadius:88,paddingAngle:4,children:L.map((s,t)=>e.jsx(Ue,{fill:te[t%te.length]},s.name))}),e.jsx(se,{})]})}):e.jsx("div",{className:"flex h-full items-center justify-center rounded-2xl bg-slate-50 text-sm text-slate-500",children:"No industry focus data yet."})})]}),e.jsxs(P.section,{variants:T,className:"rounded-[20px] border border-[#EAECEF] bg-white p-5",children:[e.jsxs("div",{className:"mb-5 flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-slate-950",children:"Project Discovery"}),e.jsx("p",{className:"text-sm text-slate-500",children:"Find, refine, and manage reusable templates."})]}),e.jsxs("div",{className:"relative w-full lg:max-w-md",children:[e.jsx(Ye,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-400"}),e.jsx(Me,{value:r,onChange:s=>m(s.target.value),placeholder:"Search templates, skills, technologies...",className:"h-11 rounded-full border-[#EAECEF] bg-[#FAFBFC] pl-10"})]})]}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-6",children:[e.jsxs(v,{value:d,onValueChange:x,children:[e.jsx(y,{className:"h-10 rounded-full border-[#EAECEF]",children:e.jsx(N,{placeholder:"Industry"})}),e.jsxs(w,{children:[e.jsx(n,{value:"all",children:"All Industries"}),be.map(s=>e.jsx(n,{value:s,children:s},s))]})]}),e.jsxs(v,{value:c,onValueChange:re,children:[e.jsx(y,{className:"h-10 rounded-full border-[#EAECEF]",children:e.jsx(N,{placeholder:"Difficulty"})}),e.jsxs(w,{children:[e.jsx(n,{value:"all",children:"All Difficulties"}),e.jsx(n,{value:"beginner",children:"Beginner"}),e.jsx(n,{value:"intermediate",children:"Intermediate"}),e.jsx(n,{value:"advanced",children:"Advanced"})]})]}),e.jsxs(v,{value:A,onValueChange:ie,children:[e.jsx(y,{className:"h-10 rounded-full border-[#EAECEF]",children:e.jsx(N,{placeholder:"Career Path"})}),e.jsxs(w,{children:[e.jsx(n,{value:"all",children:"All Career Paths"}),le.map(s=>e.jsx(n,{value:s.id,children:s.name},s.id))]})]}),e.jsxs(v,{value:E,onValueChange:ne,children:[e.jsx(y,{className:"h-10 rounded-full border-[#EAECEF]",children:e.jsx(N,{placeholder:"Project Type"})}),e.jsxs(w,{children:[e.jsx(n,{value:"all",children:"All Project Types"}),e.jsx(n,{value:"unilateral",children:"Unilateral (single pathway)"}),e.jsx(n,{value:"multilateral",children:"Multilateral (multiple pathways)"})]})]}),e.jsxs(v,{value:S,onValueChange:oe,children:[e.jsx(y,{className:"h-10 rounded-full border-[#EAECEF]",children:e.jsx(N,{placeholder:"Technology"})}),e.jsxs(w,{children:[e.jsx(n,{value:"all",children:"All Stacks"}),ve.map(s=>e.jsx(n,{value:s,children:s},s))]})]}),e.jsxs(v,{value:g,onValueChange:de,children:[e.jsx(y,{className:"h-10 rounded-full border-[#EAECEF]",children:e.jsx(N,{placeholder:"Sort"})}),e.jsxs(w,{children:[e.jsx(n,{value:"most-used",children:"Most Used"}),e.jsx(n,{value:"newest",children:"Newest"}),e.jsx(n,{value:"alphabetical",children:"Alphabetical"})]})]})]})]}),e.jsx("div",{children:e.jsxs("section",{children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-slate-950",children:"All Projects"}),e.jsx("p",{className:"text-sm text-slate-500",children:"Platform projects filtered by industry, pathway, type, technology, and usage."})]}),e.jsxs(j,{variant:"outline",className:"hidden rounded-full px-3 py-1 sm:inline-flex",children:[e.jsx($e,{className:"mr-1.5 h-3.5 w-3.5"}),b.length," projects"]})]}),je?e.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:Array.from({length:f}).map((s,t)=>e.jsx("div",{className:"h-80 animate-pulse rounded-[20px] bg-white"},t))}):X.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:X.map(s=>e.jsx(ss,{project:s,usageCount:_[s.id]||0,onView:()=>we(s)},s.id))}),e.jsxs("div",{className:"mt-5 flex flex-col gap-3 rounded-[20px] border border-[#
6EAECEF] bg-white p-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("p",{className:"text-sm text-slate-500",children:["Showing ",ye,"-",Ne," of ",b.length," projects"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"outline",className:"rounded-full",disabled:u<=1,onClick:()=>D(s=>Math.max(1,s-1)),children:"Previous"}),e.jsxs("span",{className:"rounded-full bg-slate-100 px-3 py-2 text-sm font-medium text-slate-700",children:[u," / ",I]}),e.jsx(C,{variant:"outline",className:"rounded-full",disabled:u>=I,onClick:()=>D(s=>Math.min(I,s+1)),children:"Next"})]})]})]}):e.jsxs(P.div,{variants:T,className:"rounded-[24px] border border-dashed border-[#EAECEF] bg-white p-10 text-center",children:[e.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-3xl bg-blue-50 text-blue-700",children:e.jsx(Je,{className:"h-7 w-7"})}),e.jsx("h3",{className:"mt-5 text-xl font-semibold text-slate-950",children:"Start Building Your First Project"}),e.jsx("p",{className:"mx-auto mt-2 max-w-xl text-sm leading-6 text-slate-500",children:"Create reusable project templates that other Tech Leads can adopt across different learning pathways."}),e.jsx(C,{className:"mt-6 rounded-full bg-blue-600 hover:bg-blue-700",onClick:()=>F(!0),children:"Create Project"})]})]})}),e.jsx(Be,{project:K,isOpen:me,onClose:()=>V(!1),onCreatePod:Ce,userType:"techlead"}),xe&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-slate-950/45 p-4 backdrop-blur-sm",children:e.jsxs("div",{className:"relative w-full max-w-6xl",children:[e.jsx(C,{variant:"outline",size:"icon",className:"absolute -right-3 -top-3 z-10 h-10 w-10 rounded-full bg-white shadow-lg",onClick:()=>F(!1),"aria-label":"Close",children:e.jsx(ke,{className:"h-4 w-4"})}),e.jsx(ze,{onCancel:()=>F(!1),onProjectCreated:Ae})]})}),e.jsx(Ve,{project:K,isOpen:he,onClose:()=>{H(!1),M(null)},onCreatePod:Pe})]})]})]})})};export{mt 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.