PageSourceSearch

https://xterns.ai/assets/ClientPodDetail-BgqkRqbp.js

js xterns.ai collected 2026-10-05 13:24:29 UTC 6,620 bytes, 1 lines download raw bytes

1import{j as e,a8 as G,r,B as c,L as k,U as z,J as N,h as o,i as x,k as m,m as h,aa as C,ab as v,ac as y,ae as i}from"./index-DLd_kDlx.js";import{C as J}from"./ClientBusinessGate-CKL9R3zX.js";import{t as K,v as M,w as H,r as O,k as $}from"./businessManagement-BTTXtuIj.js";import{L as w}from"./loader-circle-D2miE2xB.js";import{A as q}from"./arrow-left-BXtn7MCa.js";import{U as F}from"./user-round-check-syjRkPJS.js";import{P as I}from"./plus-0WhrdjYO.js";import{K as Q}from"./key-round-B79BulHq.js";import{C as V}from"./copy-B3ncjnG6.js";import{R as W}from"./refresh-cw-CoPjtj5-.js";import{S as X}from"./shield-off-nhS97Oaj.js";import"./timer-CZhDpZys.js";import"./briefcase-business-CphIeAJd.js";const me=()=>e.jsx(J,{children:({business:n})=>e.jsx(Y,{businessId:n.id})}),Y=({businessId:n})=>{var L;const{podId:l}=G(),[t,R]=r.useState(null),[b,p]=r.useState([]),[S,P]=r.useState(!0),[A,D]=r.useState(!1),[u,j]=r.useState(null),U=async()=>{if(l){P(!0);try{const[s,a]=await Promise.all([K(n,l),M(n,l)]);R(s),p(a)}catch(s){i({title:"Unable to load pod",description:s instanceof Error?s.message:"Please try again.",variant:"destructive"})}finally{P(!1)}}};r.useEffect(()=>{U()},[n,l]);const f=r.useMemo(()=>((t==null?void 0:t.pod_members)||[]).filter(s=>s.role==="member"&&s.status==="active"),[t]),_=async()=>{if(l)try{D(!0);const s=await H(n,l);p(a=>[s,...a]),i({title:"Access code generated",description:s.code})}catch(s){i({title:"Unable to generate code",description:s instanceof Error?s.message:"Please try again.",variant:"destructive"})}finally{D(!1)}},E=async s=>{await navigator.clipboard.writeText(s),i({title:"Access code copied"})},T=async s=>{try{j(s);const a=await O(s);p(d=>[a,...d.map(g=>g.status==="active"?{...g,status:"disabled"}:g)]),i({title:"Access code regenerated",description:a.code})}catch(a){i({title:"Unable to regenerate code",description:a instanceof Error?a.message:"Please try again.",variant:"destructive"})}finally{j(null)}},B=async s=>{try{j(s),await $(s),p(a=>a.map(d=>d.id===s?{...d,status:"disabled"}:d)),i({title:"Access code disabled"})}catch(a){i({title:"Unable to disable code",description:a instanceof Error?a.message:"Please try again.",variant:"destructive"})}finally{j(null)}};return S?e.jsx("div",{className:"flex justify-center py-20",children:e.jsx(w,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):t?e.jsxs("div",{className:"space-y-6",children:[e.jsx(c,{asChild:!0,variant:"ghost",className:"gap-2",children:e.jsxs(k,{to:"/client/pods",children:[e.jsx(q,{className:"h-4 w-4"}),"Back to pods"]})}),e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{className:"h-6 w-6 text-primary"}),e.jsx("h1",{className:"text-2xl font-bold",children:t.pod_name}),e.jsx(N,{variant:"outline",className:"capitalize",children:t.status})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:((L=t.projects)==null?void 0:L.title)||"Unlinked project"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(c,{asChild:!0,variant:"outline",className:"gap-2",children:e.jsxs(k,{to:`/client/pods/${t.id}/setup`,children:[e.jsx(F,{className:"h-4 w-4"}),"Manage Tech Leads"]})}),e.jsxs(c,{onClick:_,disabled:A,className:"gap-2",children:[A?e.jsx(w,{className:"h-4 w-4 animate-spin"}):e.jsx(I,{className:"h-4 w-4"}),"Generate Access Code"]})]})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsxs(o,{children:[e.jsx(x,{children:e.jsx(m,{className:"text-sm",children:"Participants"})}),e.jsx(h,{children:e.jsx("div",{className:"text-2xl font-bold",children:f.length})})]}),e.jsxs(o,{children:[e.jsx(x,{children:e.jsx(m,{className:"text-sm",children:"Capacity"})}),e.jsx(h,{children:e.jsxs("div",{className:"text-2xl font-bold",children:[t.current_members,"/",t.max_members]})})]}),e.jsxs(o,{children:[e.jsx(x,{children:e.jsx(m,{className:"text-sm",children:"Deadline"})}),e.jsx(h,{children:e.jsx("div",{className:"text-2xl font-bold",children:new Date(t.completion_deadline).toLocaleDateString()})})]})]}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[e.jsxs(o,{children:[e.jsx(x,{children:e.jsx(m,{children:"Participants"})}),e.jsx(h,{className:"space-y-3",children:f.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No participants have joined this pod yet."}):f.map(s=>{var a;return e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:((a=s.profiles)==null?void 0:a.full_name)||s.user_id}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Joined ",new Date(s.joined_at).toLocaleDateString()]})]}),e.jsx(N,{variant:"outline",children:s.status})]},s.id)})})]}),e.jsxs(o,{children:[e.jsx(x,{children:e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(Q,{className:"h-5 w-5"}),"Access Codes"]})}),e.jsx(h,{className:"space-y-3",children:b.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No access codes generated yet."}):b.map(s=>e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-mono text-lg font-semibold",children:s.code}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Created ",new Date(s.created_at).toLocaleDateString()]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(N,{variant:s.status==="active"?"secondary":"outline",children:s.status}),e.jsxs(C,{children:[e.jsx(v,{asChild:!0,children:e.jsx(c,{size:"icon",variant:"ghost",onClick:()=>E(s.code),"aria-label":"Copy access code",children:e.jsx(V,{className:"h-4 w-4"})})}),e.jsx(y,{children:"Copy code for participants"})]}),e.jsxs(C,{children:[e.jsx(v,{asChild:!0,children:e.jsx(c,{size:"icon",variant:"ghost",disabled:u===s.id,onClick:()=>T(s.id),"aria-label":"Regenerate access code",children:u===s.id?e.jsx(w,{className:"h-4 w-4 animate-spin"}):e.jsx(W,{className:"h-4 w-4"})})}),e.jsx(y,{children:"Regenerate and invalidate the previous active code"})]}),s.status==="active"&&e.jsxs(C,{children:[e.jsx(v,{asChild:!0,children:e.jsx(c,{size:"icon",variant:"ghost",disabled:u===s.id,onClick:()=>B(s.id),"aria-label":"Disable access code",children:e.jsx(X,{className:"h-4 w-4"})})}),e.jsx(y,{children:"Disable this code immediately"})]})]})]},s.id))})]})]})]}):e.jsx("p",{className:"rounded-lg border bg-white py-12 text-center text-muted-foreground",children:"Pod not found."})};export{me 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.