PageSourceSearch

https://xterns.ai/assets/XternSprintBoard-BbTlGy6M.js

js xterns.ai collected 2026-10-05 13:24:19 UTC 11,469 bytes, 13 lines download raw bytes

1import{f as F,r as f,s as I,w as T,u as L,j as e,h as x,i as $,J as v,U as w,m,H as B,x as D,B as _,a4 as M,aK as C,bt as P,bu as S,F as R,bI as U}from"./index-DLd_kDlx.js";import{A as z,a as V}from"./alert-CyfKy7ls.js";import{u as H}from"./useXternPods-vMByMFnp.js";import{u as J}from"./usePodSprintsQuery-DeeP5xKS.js";import{u as K}from"./usePodRealtimeSync-Bju8NttL.js";import{L as X}from"./loader-circle-D2miE2xB.js";import{T as Y}from"./trending-up-BU4cR3Ys.js";import{f as q}from"./formatDistanceToNow-57P64IbE.js";import{N as O}from"./NotificationIcon-C1wwYnH5.js";import{C as Q}from"./circle-play-CGUr0fM_.js";import"./en-US-9SRVm7yB.js";import"./differenceInCalendarMonths-BA0TPVs2.js";import"./endOfDay-DkR3ZXc8.js";import"./endOfMonth-CYn6pTOm.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"./message-square-CtxeCfRz.js";import"./trophy-DBX-jNOC.js";import"./triangle-alert-Chqk_WK7.js";const G=()=>{const{user:a}=F(),[t,c]=f.useState([]),[l,n]=f.useState(!0),[o,d]=f.useState(null),h=async()=>{if(!(a!=null&&a.id)){c([]),n(!1);return}try{n(!0),d(null),console.log("Fetching applications for user:",a.id);const{data:i,error:r}=await I.from("tech_lead_applications").select(`
2          *,
3          projects (
4            title,
5            description
6          ),
7          tech_leads_public_v!inner (
8            full_name,
9            bio,
10            expertise_areas,
11            rating
12          )
13        `).eq("applicant_id",a.id).order("applied_at",{ascending:!1});if(r)throw console.error("Error fetching applications:",r),r;console.log("Fetched applications:",i),c(i||[])}catch(i){console.error("Error in fetchApplications:",i),d(i instanceof Error?i.message:"Failed to fetch applications"),c([])}finally{n(!1)}};return f.useEffect(()=>{h()},[a==null?void 0:a.id]),{applications:t,isLoading:l,error:o,refreshApplications:()=>{h()}}},W=a=>{const{state:t,isLoadingAny:c,refetchPod:l,refetchAll:n}=J(a);return{state:t,isLoadingAny:c,refetchPod:l,refetchAll:n}},k=T.memo(({pod:a,sprints:t=[],metadata:c,activeSprint:l,isLoading:n=!1,error:o=null,lastUpdated:d,isRevalidating:h=!1})=>{var j,u;const p=L(),i=Math.max(0,a.current_members-1),r=t.filter(g=>g.status==="completed").length,s=t.reduce((g,E)=>{var A;return g+(((A=E.stories)==null?void 0:A.length)||0)},0),y=g=>{p(`/xterns/sprint-board-swimlanes?pod=${a.id}&sprint=${g}`)},N=()=>{p(`/xterns/sprint-history?pod=${a.id}`)},b=n&&!t.length;return e.jsxs(x,{className:"rounded-[20px] border-slate-200/70 shadow-[0_10px_30px_rgba(15,23,42,0.04)] transition-all hover:-translate-y-1 hover:shadow-[0_18px_42px_rgba(15,23,42,0.08)]",children:[e.jsxs($,{className:"space-y-3 p-5 pb-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"mb-1 text-lg font-semibold text-slate-950",children:a.pod_name}),e.jsx("p",{className:"line-clamp-1 text-sm text-slate-500",children:(j=a.projects)==null?void 0:j.title})]}),h&&e.jsxs(v,{variant:"outline",className:"animate-pulse",children:[e.jsx(X,{className:"h-3 w-3 mr-1 animate-spin"}),"Syncing"]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm text-slate-500",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(w,{className:"h-4 w-4"}),e.jsxs("span",{children:[i," ",i===1?"Xtern":"Xterns"]})]}),e.jsx(v,{variant:"secondary",className:"rounded-full capitalize",children:(u=a.recruiting_phase)==null?void 0:u.replace("_"," ")})]})]}),e.jsx(m,{className:"space-y-4 p-5 pt-2",children:o?e.jsx("div",{className:"text-center py-4 text-sm text-muted-foreground",children:e.jsx("p",{className:"text-yellow-600",children:o})}):b?e.jsxs("div",{className:"space-y-3 animate-pulse",children:[e.jsx("div",{className:"h-4 bg-muted rounded w-3/4"}),e.jsx("div",{className:"h-4 bg-muted rounded w-1/2"}),e.jsx("div",{className:"h-10 bg-muted rounded"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-3 gap-2 rounded-2xl bg-slate-50 p-3",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-lg font-semibold text-slate-950",children:t.length}),e.jsx("div",{className:"text-[11px] text-slate-500",children:"Total Sprints"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-lg font-semibold text-emerald-600",children:r}),e.jsx("div",{className:"text-[11px] text-slate-500",children:"Completed"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-lg font-semibold text-slate-950",children:s}),e.jsx("div",{className:"text-[11px] text-slate-500",children:"Stories"})]})]}),l?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[e.jsx(Y,{className:"h-4 w-4 text-primary"}),e.jsx("span",{children:"Active Sprint"})]}),e.jsx(x,{className:"rounded-2xl border-blue-100 bg-blue-50/60",children:e.jsxs(m,{className:"space-y-3 p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:l.name}),e.jsxs(v,{className:"rounded-full bg-blue-600",children:["Sprint ",l.sprint_number]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-4 text-sm text-slate-500",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(B,{className:"h-3 w-3"}),e.jsx("span",{children:new Date(l.start_date).toLocaleDateString()})]}),l.stories&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(D,{className:"h-3 w-3"}),e.jsxs("span",{children:[l.stories.length," stories"]})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(_,{onClick:()=>y(l.id),size:"sm",className:"h-9 rounded-full bg-blue-600 px-4 hover:bg-blue-700",children:"Open Sprint"})})]})})]}):t.length>0?e.jsx("div",{className:"text-center py-4 text-sm text-muted-foreground",children:"No active sprint"}):e.jsx("div",{className:"text-center py-4 text-sm text-muted-foreground",children:"No sprints yet"}),(t.length>0||d)&&e.jsxs("div",{className:"flex items-center justify-between gap-3 pt-1",children:[d?e.jsxs("div",{className:"flex items-center gap-1 text-xs text-slate-500",children:[e.jsx(M,{className:"h-3 w-3"}),e.jsxs("span",{children:["Updated ",q(d,{addSuffix:!0})]})]}):e.jsx("span",{}),t.length>0&&e.jsxs(_,{onClick:N,variant:"outline",size:"sm",className:"h-9 shrink-0 rounded-full border-slate-200 px-4",children:["View All (",t.length,")"]})]})]})})]})});k.displayName="PodSprintCard";function ve(){var p,i;const a=L(),{pods:t,isLoading:c,error:l}=H(),{applications:n}=G();console.log("XternSprintBoard: pods data:",t),console.log("XternSprintBoard: applications data:",n);const o=f.useMemo(()=>t.map(r=>r.id),[t]),{state:d}=W(o);K(o);const h=n.filter(r=>r.status==="accepted");return c?e.jsx(C,{children:e.jsxs("div",{className:"flex min-h-screen w-full bg-gray-50 font-['Inter',sans-serif]",children:[e.jsx(P,{}),e.jsxs(S,{className:"flex-1",children:[e.jsx("div",{className:"p-8 bg-white border-b",children:e.jsx("h1",{className:"text-2xl font-semibold",children:"Sprint Board"})}),e.jsx("main",{className:"p-8",children:e.jsxs("div",{className:"flex items-center justify-center h-32",children:[e.jsx(X,{className:"h-6 w-6 animate-spin"}),e.jsx("span",{className:"ml-2",children:"Loading sprint boards..."})]})})]})]})}):e.jsx(C,{children:e.jsxs("div",{className:"flex min-h-screen w-full bg-gray-50 font-['Inter',sans-serif]",children:[e.jsx(P,{}),e.jsxs(S,{className:"flex-1",children:[e.jsx("div",{className:"bg-white border-b border-gray-200 px-8 py-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Sprint Board"}),e.jsx("p",{className:"text-gray-600 mt-1",children:"Track your progress across all project sprints"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(v,{variant:"outline",className:"px-3 py-1",children:[t.length," Active Pod",t.length!==1?"s":""]}),e.jsx(O,{})]})]})}),e.jsxs("main",{className:"space-y-6 p-6",children:[l&&e.jsxs(z,{variant:"destructive",children:[e.jsx(R,{className:"h-4 w-4"}),e.jsxs(V,{children:["Error loading pods: ",l]})]}),t.length===0?e.jsx(x,{children:e.jsxs(m,{className:"p-12 text-center",children:[e.jsx(w,{className:"h-16 w-16 text-gray-400 mx-auto mb-4"}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"No Active Pods"}),e.jsx("p",{className:"text-gray-600 mb-6 max-w-md mx-auto",children:"You're not currently part of any pods. Join a pod through the Projects section to access sprint boards and start collaborating with tech leads."}),e.jsx(_,{onClick:()=>a("/xterns/pods"),className:"bg-blue-600 hover:bg-blue-700",children:"Browse Projects"})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-6 grid grid-cols-1 gap-4 md:grid-cols-4",children:[e.jsx(x,{children:e.jsx(m,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Active Pods"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900",children:t.length})]}),e.jsx(U,{className:"h-8 w-8 text-blue-600"})]})})}),e.jsx(x,{children:e.jsx(m,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Total Xterns"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900",children:t.reduce((r,s)=>r+Math.max(0,s.current_members-1),0)})]}),e.jsx(w,{className:"h-8 w-8 text-green-600"})]})})}),e.jsx(x,{children:e.jsx(m,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Applications"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900",children:h.length})]}),e.jsx(B,{className:"h-8 w-8 text-purple-600"})]})})}),e.jsx(x,{children:e.jsx(m,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Current Phase"}),e.jsx("p",{className:"text-sm font-bold text-gray-900",children:((i=(p=t[0])==null?void 0:p.recruiting_phase)==null?void 0:i.replace("_"," "))||"Active"})]}),e.jsx(Q,{className:"h-8 w-8 text-orange-600"})]})})})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Your Project Pods"}),e.jsx("div",{className:"grid grid-cols-1 items-start gap-4 lg:grid-cols-2",children:t.map(r=>{var N,b,j,u;const s=d[r.id],y=Math.max(0,r.current_members-1);return console.log(`XternSprintBoard - Pod: ${r.pod_name} current_members: ${r.current_members} calculated xternCount: ${y}`),e.jsx(k,{pod:r,sprints:(N=s==null?void 0:s.data)==null?void 0:N.sprints,metadata:(b=s==null?void 0:s.data)==null?void 0:b.metadata,activeSprint:(j=s==null?void 0:s.data)==null?void 0:j.activeSprint,isLoading:(s==null?void 0:s.status)==="loading",error:(u=s==null?void 0:s.data)==null?void 0:u.error,lastUpdated:s==null?void 0:s.lastUpdated,isRevalidating:(s==null?void 0:s.status)==="loading"&&(s==null?void 0:s.data)!==null},r.id)})})]})]})]})]})]})})}export{ve 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.