1import{r,j as e,m as p}from"./index-xk6YniB_.js";import{u as h}from"./useServerFn-BwNOP_gp.js";import{l as u}from"./admin-workspaces.functions-K55u8FrC.js";import{P as j,a as g,c as f,L as N,S as c,H as y}from"./primitives-B2V4jnxm.js";import{B as w}from"./badge-Dgqc0Awv.js";import"./admin.functions-BnRLU4oz.js";import"./circle-alert--Z2MoSPZ.js";import"./loader-circle-B1d1je0G.js";import"./arrow-right-mY0ryx2A.js";function P(){const i=h(u),[a,o]=r.useState(null),[d,x]=r.useState(null),[n,m]=r.useState("");r.useEffect(()=>{i().then(o).catch(s=>x(s.message))},[i]);const l=r.useMemo(()=>{if(!a)return[];const s=n.trim().toLowerCase();return s?a.filter(t=>(t.email??"").toLowerCase().includes(s)||(t.display_name??"").toLowerCase().includes(s)||t.id.toLowerCase().includes(s)):a},[a,n]);return e.jsxs(j,{size:"wide",children:[e.jsx(g,{eyebrow:"Admin",title:"Users",description:"All signed-up users."}),d?e.jsx(f,{description:d}):a===null?e.jsx(N,{}):e.jsxs(e.Fragment,{children:[e.jsx(c,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(p,{placeholder:"Search by email, name or user IDâ¦",value:n,onChange:s=>m(s.target.value),className:"max-w-md"}),e.jsxs("span",{className:"ml-auto text-xs text-muted-foreground",children:[l.length," of ",a.length]})]})}),e.jsx(c,{padding:"none",contentClassName:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"border-b border-border bg-muted/40 text-left text-xs uppercase tracking-wider text-muted-foreground",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-3 py-2",children:"Email"}),e.jsx("th",{className:"px-3 py-2",children:"Name"}),e.jsx("th",{className:"px-3 py-2",children:"Roles"}),e.jsx("th",{className:"px-3 py-2 text-right",children:"Workspaces"}),e.jsx("th",{className:"px-3 py-2",children:"Confirmed"}),e.jsx("th",{className:"px-3 py-2",children:"Last sign-in"}),e.jsx("th",{className:"px-3 py-2",children:"Created"})]})}),e.jsxs("tbody",{className:"divide-y divide-border",children:[l.map(s=>e.jsxs("tr",{children:[e.jsx("td",{className:"px-3 py-2 font-medium",children:s.email??"â"}),e.jsx("td",{className:"px-3 py-2 text-xs",children:s.display_name??"â"}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("div",{className:"flex flex-wrap gap-1",children:s.roles.length===0?e.jsx("span",{className:"text-xs text-muted-foreground",children:"â"}):s.roles.map(t=>e.jsx(w,{variant:t==="super_admin"||t==="admin"?"default":"secondary",className:"text-[10px]",children:t},t))})}),e.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:s.workspaces_count}),e.jsx("td",{className:"px-3 py-2 text-xs text-muted-foreground",children:s.email_confirmed_at?new Date(s.email_confirmed_at).toLocaleDateString():"â"}),e.jsx("td",{className:"px-3 py-2 text-xs text-muted-foreground",children:s.last_sign_in_at?new Date(s.last_sign_in_at).toLocaleDateString():"â"}),e.jsx("td",{className:"px-3 py-2 text-xs text-muted-foreground",children:new Date(s.created_at).toLocaleDateString()})]},s.id)),l.length===0&&e.jsx("tr",{children:e.jsx("td",{className:"px-3 py-6",colSpan:7,children:e.jsx(y,{children:"No users match your search."})})})]})]})})]})]})}export{P 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.