1import{u as h,n as f,bZ as b,b$ as C,r as y,j as a,T as l,v as j}from"./index-d2-R7FBD.js";import{D as N}from"./data-table-CRDbUA9k.js";import{C as T}from"./team-dialogs-BmKIuSlQ.js";import"./Rows.es-C9wCdr8c.js";import"./SquaresFour.es-C-jz8Y6F.js";import"./GearSix.es-DR2YMu-5.js";import"./person-cell-DFMpNJJH.js";function E(){const c=h(),{organization:s}=f(),o=(s==null?void 0:s.id)??null,{teams:r,isLoadingTeams:i}=b(o),{createTeam:t}=C(o),[u,n]=y.useState(!1),m=e=>{c({to:"/settings/organization/teams/$teamId",params:{teamId:e.id}})},g=[{id:"name",header:"Team",sortValue:e=>e.name.toLowerCase(),cell:e=>a.jsx("span",{className:"font-medium text-foreground",children:e.name})},{id:"members",header:"People",sortValue:e=>e.memberCount,cell:e=>a.jsx("span",{className:e.memberCount===0?"text-muted-foreground":"text-foreground",children:e.memberCount===0?"Nobody yet":`${e.memberCount} ${e.memberCount===1?"person":"people"}`})},{id:"assignments",header:"Assigned to",sortValue:e=>e.assignmentCount,cell:e=>e.assignmentCount===0?a.jsx("span",{className:"text-muted-foreground",children:"Nothing of its own â grouping only"}):a.jsxs("span",{className:"text-foreground",children:[e.assignmentCount," ",e.assignmentCount===1?"client or brand":"clients and brands"]})},{id:"created",header:"Created",sortValue:e=>e.createdAt,cell:e=>a.jsx("span",{className:"text-muted-foreground",children:new Date(e.createdAt).toLocaleDateString()})}],d=a.jsxs("button",{type:"button",onClick:()=>n(!0),className:"inline-flex items-center gap-2 rounded-lg bg-foreground px-3 py-1.5 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",children:[a.jsx(j,{size:14,"aria-hidden":"true"}),"New team"]}),p=!i&&r.length===0;return a.jsxs("div",{className:"flex flex-col gap-3",children:[p?a.jsxs("div",{className:"flex flex-col items-start gap-4 roun
1ded-xl border border-border/50 bg-card p-8",children:[a.jsx(l,{variant:"small",className:"max-w-lg text-muted-foreground",children:"Teams decide which clients and brands their people can reach. Owners and admins already see everything â you need a team once you have members."}),d]}):a.jsxs(a.Fragment,{children:[a.jsx(N,{rows:r,columns:g,getRowId:e=>e.id,searchText:e=>e.name,searchPlaceholder:"Search teamsâ¦",loading:i,defaultSort:{columnId:"name",dir:"asc"},onRowClick:m,toolbarExtra:d,emptyMessage:"No teams."}),a.jsx(l,{variant:"muted",className:"px-1 text-xs",children:"Open a team to manage its people and what it is assigned to."})]}),a.jsx(T,{open:u,onClose:()=>{n(!1),t.reset()},isPending:t.isPending,error:t.error,onConfirm:e=>t.mutate(e,{onSuccess:x=>{n(!1),m(x.team)}})})]})}export{E as component};
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.