PageSourceSearch

https://xterns.ai/assets/ClientSprints-DMAdoaF2.js

js xterns.ai collected 2026-10-05 13:24:31 UTC 12,954 bytes, 1 lines download raw bytes

1import{j as e,r as m,s as B,B as U,h as v,i as f,k as N,aa as se,ab as te,ac as ae,m as y,ad as le,I as M,K as z,x as L,U as re,T as H,ae as ie,J as W,P as ne}from"./index-DLd_kDlx.js";import{C as ce}from"./ClientBusinessGate-CKL9R3zX.js";import{x as de}from"./businessManagement-BTTXtuIj.js";import{L as g}from"./label-D4-ENrYn.js";import{S as b,a as k,b as w,c as T,d}from"./select-RSrodAEw.js";import{T as $,a as D,b as p,c as n,d as V,e as r}from"./table-BOJIo-OD.js";import{T as oe}from"./timer-CZhDpZys.js";import{L as G}from"./loader-circle-D2miE2xB.js";import{R as xe}from"./refresh-cw-CoPjtj5-.js";import{F as me}from"./filter-BMeMiGQo.js";import{R as he}from"./rotate-ccw-Bx1C64Ur.js";import{T as J}from"./triangle-alert-Chqk_WK7.js";import{C as K}from"./calendar-clock-BWm3z0fh.js";import{C as pe}from"./clock-3-De2r9tJK.js";import"./briefcase-business-CphIeAJd.js";import"./index-BdQq_4o_.js";import"./index-Deh-4PO1.js";import"./chevron-down-DpJJsCer.js";import"./chevron-up-M4SAwIjf.js";const je={metrics:{total_active_sprints:0,completed_sprints:0,overdue_sprints:0,upcoming_sprints:0,total_xterns_in_active_sprints:0,xterns_completed_all_tasks:0,xterns_with_overdue_tasks:0,average_task_completion_rate:0,total_tasks_assigned:0,tasks_completed:0,tasks_in_progress:0,tasks_not_started:0,overall_sprint_completion:0},sprints:[],xterns:[],pods:[],filter_options:{pods:[],sprints:[],pathways:[],cohorts:[]}},q={not_started:"Not Started",active:"Active",completed:"Completed",overdue:"Overdue"},Q=s=>s==="overdue"?"destructive":s==="completed"?"secondary":"outline",_=s=>s?new Date(s).toLocaleDateString():"Not available",A=s=>s||"all",P=s=>s==="all"?null:s,Ee=()=>e.jsx(ce,{children:({business:s})=>e.jsx(ue,{businessId:s.id})}),ue=({businessId:s})=>{const[a,i]=m.useState(je),[l,C]=m.useState({}),[S,X]=m.useState(null),[R,E]=m.useState(!0),o=async(t=l)=>{try{E(!0);const x=await de(s,t);i(x),X(u=>{var I;return u&&x.sprints.some(ee=>ee.id===u)?u:((I=x.sprints[0])==null?void 0:I.id)||null})}catch(x){ie({title:"Unable to load sprint analytics",description:x instanceof Error?x.message:"Please try again.",variant:"destructive"})}finally{E(!1)}};m.useEffect(()=>{o()},[s]),m.useEffect(()=>{const t=B.channel(`client-sprint-analytics-${s}`).on("postgres_changes",{event:"*",schema:"public",table:"sprints"},()=>o()).on("postgres_changes",{event:"*",schema:"public",table:"roadmap_tasks"},()=>o()).on("postgres_changes",{event:"*",schema:"public",table:"roadmap_stories"},()=>o()).on("postgres_changes",{event:"*",schema:"public",table:"pod_members"},()=>o()).subscribe();return()=>{B.removeChannel(t)}},[s,l]);const h=m.useMemo(()=>a.sprints.find(t=>t.id===S)||a.sprints[0]||null,[a.sprints,S]),Y=m.useMemo(()=>h?a.xterns.filter(t=>t.sprint_id===h.id):[],[a.xterns,h]),j=(t,x)=>{const u={...l,[t]:x||null};C(u),o(u)},Z=()=>{C({}),o({})},c=a.metrics;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(oe,{className:"h-6 w-6 text-primary"}),e.jsx("h1",{className:"text-2xl font-bold",children:"Sprint Tracking"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Monitor sprint health, Xtern delivery, and pod performance across your business pods."})]}),e.jsxs(U,{variant:"outline",className:"gap-2",onClick:()=>o(),disabled:R,children:[R?e.jsx(G,{className:"h-4 w-4 animate-spin"}):e.jsx(xe,{className:"h-4 w-4"}),"Refresh"]})]}),e.jsxs(v,{children:[e.jsx(f,{children:e.jsxs(N,{className:"flex items-center gap-2 text-base",children:[e.jsx(me,{className:"h-4 w-4"}),"Filters",e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx("span",{className:"cursor-help text-sm text-muted-foreground",children:"?"})}),e.jsx(ae,{className:"max-w-xs",children:"Filters apply to the sprint list, dashboard metrics, Xtern performance, and pod summary."})]})]})}),e.jsxs(y,{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-7",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{children:"Pod"}),e.jsxs(b,{value:A(l.pod_id),onValueChange:t=>j("pod_id",P(t)),children:[e.jsx(k,{children:e.jsx(w,{placeholder:"All pods"})}),e.jsxs(T,{children:[e.jsx(d,{value:"all",children:"All pods"}),a.filter_options.pods.map(t=>e.jsx(d,{value:t.id,children:t.name},t.id))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{children:"Sprint"}),e.jsxs(b,{value:A(l.sprint_id),onValueChange:t=>j("sprint_id",P(t)),children:[e.jsx(k,{children:e.jsx(w,{placeholder:"All sprints"})}),e.jsxs(T,{children:[e.jsx(d,{value:"all",children:"All sprints"}),a.filter_options.sprints.map(t=>e.jsx(d,{value:t.id,children:t.name},t.id))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{children:"Pathway"}),e.jsxs(b,{value:A(l.pathway),onValueChange:t=>j("pathway",P(t)),children:[e.jsx(k,{children:e.jsx(w,{placeholder:"All pathways"})}),e.jsxs(T,{children:[e.jsx(d,{value:"all",children:"All pathways"}),le.map(t=>e.jsx(d,{value:t.name,children:t.name},t.id))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{children:"Status"}),e.jsxs(b,{value:A(l.status),onValueChange:t=>j("status",P(t)),children:[e.jsx(k,{children:e.jsx(w,{placeholder:"All statuses"})}),e.jsxs(T,{children:[e.jsx(d,{value:"all",children:"All statuses"}),e.jsx(d,{value:"not_started",children:"Not Started"}),e.jsx(d,{value:"active",children:"Active"}),e.jsx(d,{value:"completed",children:"Completed"}),e.jsx(d,{value:"overdue",children:"Overdue"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{children:"Start"}
1),e.jsx(M,{type:"date",value:l.start_date||"",onChange:t=>j("start_date",t.target.value||null)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{children:"End"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(M,{type:"date",value:l.end_date||"",onChange:t=>j("end_date",t.target.value||null)}),e.jsx(U,{type:"button",size:"icon",variant:"outline",onClick:Z,"aria-label":"Reset filters",children:e.jsx(he,{className:"h-4 w-4"})})]})]})]})]}),R?e.jsx("div",{className:"flex justify-center py-20",children:e.jsx(G,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):e.jsxs(e.Fragment,{children:[e.jsx(O,{title:"Overall Sprint Summary",items:[["Total Active Sprints",c.total_active_sprints,z],["Completed Sprints",c.completed_sprints,L],["Overdue Sprints",c.overdue_sprints,J],["Upcoming Sprints",c.upcoming_sprints,K]]}),e.jsx(O,{title:"Xtern Performance",items:[["Xterns in Active Sprints",c.total_xterns_in_active_sprints,re],["Completed All Tasks",c.xterns_completed_all_tasks,L],["With Overdue Tasks",c.xterns_with_overdue_tasks,J],["Avg Completion Rate",`${c.average_task_completion_rate}%`,H]]}),e.jsx(O,{title:"Sprint Delivery",items:[["Total Tasks Assigned",c.total_tasks_assigned,H],["Tasks Completed",c.tasks_completed,L],["Tasks In Progress",c.tasks_in_progress,pe],["Tasks Not Started",c.tasks_not_started,K],["Overall Completion",`${c.overall_sprint_completion}%`,z]],wide:!0}),e.jsxs("div",{className:"grid gap-6 xl:grid-cols-[1.1fr_1.4fr]",children:[e.jsx(ge,{sprints:a.sprints,selectedSprintId:(h==null?void 0:h.id)||null,onSelect:X}),e.jsx(_e,{sprint:h,xterns:Y})]}),e.jsx(ve,{pods:a.pods})]})]})},O=({title:s,items:a,wide:i})=>e.jsxs("section",{className:"space-y-3",children:[e.jsx("h2",{className:"text-lg font-semibold",children:s}),e.jsx("div",{className:`grid gap-4 md:grid-cols-2 ${i?"xl:grid-cols-5":"xl:grid-cols-4"}`,children:a.map(([l,C,S])=>e.jsxs(v,{children:[e.jsxs(f,{className:"flex flex-row items-center justify-between pb-2",children:[e.jsx(N,{className:"text-sm",children:l}),e.jsx(S,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(y,{children:e.jsx("div",{className:"text-2xl font-bold",children:C})})]},l))})]}),ge=({sprints:s,selectedSprintId:a,onSelect:i})=>e.jsxs(v,{className:"flex flex-col h-[600px]",children:[e.jsx(f,{children:e.jsx(N,{children:"Sprint Activity Report"})}),e.jsx(y,{className:"flex-1 overflow-auto",children:s.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No sprints match the selected filters."}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs($,{children:[e.jsx(D,{children:e.jsxs(p,{children:[e.jsx(n,{children:"Sprint"}),e.jsx(n,{children:"Pod"}),e.jsx(n,{children:"Status"}),e.jsx(n,{className:"text-right",children:"Completion"})]})}),e.jsx(V,{children:s.map(l=>e.jsxs(p,{className:a===l.id?"bg-muted/60":"cursor-pointer",onClick:()=>i(l.id),children:[e.jsx(r,{children:e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:l.name}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[_(l.start_date)," - ",_(l.end_date)]})]})}),e.jsx(r,{children:l.pod_name}),e.jsx(r,{children:e.jsx(W,{variant:Q(l.display_status),children:q[l.display_status]||l.display_status})}),e.jsxs(r,{className:"text-right",children:[l.completion_rate,"%"]})]},l.id))})]})})})]}),_e=({sprint:s,xterns:a})=>e.jsxs(v,{className:"flex flex-col h-[600px]",children:[e.jsx(f,{children:e.jsx(N,{children:s?s.name:"Sprint Detail"})}),e.jsx(y,{className:"flex-1 space-y-6 overflow-auto",children:s?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-4",children:[e.jsx(F,{label:"Pod",value:s.pod_name}),e.jsx(F,{label:"Duration",value:`${s.duration_days} days`}),e.jsx(F,{label:"Start Date",value:_(s.start_date)}),e.jsx(F,{label:"End Date",value:_(s.end_date)})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx(W,{variant:Q(s.display_status),children:q[s.display_status]||s.display_status}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[s.completed_tasks,"/",s.total_tasks," tasks completed"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ne,{value:s.completion_rate,className:"h-2"}),e.jsxs("span",{className:"w-12 text-right text-sm font-medium",children:[s.completion_rate,"%"]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs($,{children:[e.jsx(D,{children:e.jsxs(p,{children:[e.jsx(n,{children:"Xtern"}),e.jsx(n,{children:"Pathway"}),e.jsx(n,{className:"text-right",children:"Assigned"}),e.jsx(n,{className:"text-right",children:"Completed"}),e.jsx(n,{className:"text-right",children:"Pending"}),e.jsx(n,{className:"text-right",children:"Overdue"}),e.jsx(n,{className:"text-right",children:"Completion"}),e.jsx(n,{children:"Last Activity"})]})}),e.jsx(V,{children:a.length===0?e.jsx(p,{children:e.jsx(r,{colSpan:8,className:"py-8 text-center text-muted-foreground",children:"No assigned Xtern activity in this sprint."})}):a.map(i=>e.jsxs(p,{children:[e.jsx(r,{children:e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:i.full_name}),i.email&&e.jsx("p",{className:"text-xs text-muted-foreground",children:i.email})]})}),e.jsx(r,{children:i.pathway||"Unassigned"}),e.jsx(r,{className:"text-right",children:i.assigned_tasks}),e.jsx(r,{className:"text-right",children:i.completed_tasks}),e.jsx(r,{className:"text-right",children:i.pending_tasks}),e.jsx(r,{className:`text-right ${i.overdue_tasks>0?"font-semibold text-destructive":""}`,children:i.overdue_tasks}),e.jsxs(r,{className:"text-right",children:[i.completion_percentage,"%"]}),e.jsx(r,{children:_(i.last_activity_date)})]},`${i.sprint_id}-${i.user_id}`))})]})})]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Select a sprint to view its report."})})]}),F=({label:s,value:a})=>e.jsxs("div",{className:"rounded-lg border p-3",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s}),e.jsx("p",{className:"font-medium",children:a})]}),ve=({pods:s})=>e.jsxs(v,{children:[e.jsx(f,{children:e.jsx(N,{children:"Pod Summary"})}),e.jsx(y,{children:s.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No pod summary data available."}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs($,{children:[e.jsx(D,{children:e.jsxs(p,{children:[e.jsx(n,{children:"Pod"}),e.jsx(n,{className:"text-right",children:"Active Sprints"}),e.jsx(n,{className:"text-right",children:"Completed Sprints"}),e.jsx(n,{className:"text-right",children:"Completion"}),e.jsx(n,{className:"text-right",children:"Total Xterns"}),e.jsx(n,{className:"text-right",children:"Tasks Completed"}),e.jsx(n,{className:"text-right",children:"Overdue Tasks"})]})}),e.jsx(V,{children:s.map(a=>e.jsxs(p,{children:[e.jsx(r,{className:"font-medium",children:a.pod_name}),e.jsx(r,{className:"text-right",children:a.active_sprints}),e.jsx(r,{className:"text-right",children:a.completed_sprints}),e.jsxs(r,{className:"text-right",children:[a.completion_rate,"%"]}),e.jsx(r,{className:"text-right",children:a.total_xterns}),e.jsx(r,{className:"text-right",children:a.total_tasks_completed}),e.jsx(r,{className:`text-right ${a.total_overdue_tasks>0?"font-semibold text-destructive":""}`,children:a.total_overdue_tasks})]},a.pod_id))})]})})})]});
1export{Ee 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.