PageSourceSearch

https://www.qoreai.com/assets/AdminTeam-CSSQAZx4.js

js qoreai.com collected 2026-09-24 13:11:41 UTC 4,695 bytes, 1 lines download raw bytes

1import{r as n,j as e}from"./vendor-react-B5Wrj-9W.js";import{supabase as d}from"./client-DhL_Z3GM.js";import{a as m,e as a}from"./index-DxzR_Sz1.js";import{I as _}from"./input-kgZG-UR5.js";import{L as v}from"./label-BJQtjs12.js";import{d as y,e as w}from"./admin-hHnxGjv8.js";import"./vendor-supabase-DljY4R_6.js";import"./vendor-radix-DJaxbWLn.js";import"./vendor-icons-Cz8Y71Nn.js";import"./vendor-router-B_GMu44Q.js";const N=["admin","editor","writer"],q=()=>{const[h,f]=n.useState([]),[c,o]=n.useState(null),[i,x]=n.useState({display_name:"",title:"",bio:"",avatar_url:"",linkedin_url:"",twitter_url:"",website_url:""}),u=async()=>{const[r,t]=await Promise.all([y(),w()]),l=new Map;t.forEach(s=>{const p=l.get(s.user_id)??[];p.push(s.role),l.set(s.user_id,p)}),f(r.map(s=>({...s,roles:l.get(s.id)??[]})))};n.useEffect(()=>{u()},[]);const b=async(r,t,l)=>{if(l){const{error:s}=await d.from("user_roles").delete().eq("user_id",r).eq("role",t);if(s)return a.error(s.message)}else{const{error:s}=await d.from("user_roles").insert({user_id:r,role:t});if(s)return a.error(s.message)}a.success("Role updated"),u()},g=r=>{o(r.id),d.from("profiles").select("*").eq("id",r.id).single().then(({data:t})=>{t&&x({display_name:t.display_name??"",title:t.title??"",bio:t.bio??"",avatar_url:t.avatar_url??"",linkedin_url:t.linkedin_url??"",twitter_url:t.twitter_url??"",website_url:t.website_url??""})})},j=async()=>{if(!c)return;const{error:r}=await d.from("profiles").update({display_name:i.display_name,title:i.title||null,bio:i.bio||null,avatar_url:i.avatar_url||null,linkedin_url:i.linkedin_url||null,twitter_url:i.twitter_url||null,website_url:i.website_url||null}).eq("id",c);if(r)return a.error(r.message);a.success("Profile updated"),o(null),u()};return e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-display font-bold text-foreground tracking-tight mb-2",children:"Team"}),e.jsxs("p",{className:"text-sm text-muted-foreground mb-6",children:["Invite teammates from the Cloud auth dashboard, then grant roles here. Roles: ",e.jsx("strong",{children:"admin"})," (everything) · ",e.jsx("strong",{children:"editor"})," (all posts) · ",e.jsx("strong",{children:"writer"})," (own drafts only)."]}),e.jsx("div",{className:"rounded-2xl border border-border/15 bg-card/10 overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"text-left text-xs uppercase text-muted-foreground border-b border-border/10",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-5 py-3",children:"Name"}),e.jsx("th",{className:"px-5 py-3",children:"Title"}),e.jsx("th",{className:"px-5 py-3",children:"Roles"}),e.jsx("th",{className:"px-5 py-3"})]})}),e.jsx("tbody",{children:h.map(r=>e.jsxs("tr",{className:"border-b border-border/5 align-top",children:[e.jsx("td",{className:"px-5 py-3 text-foreground",children:e.jsxs("div",{className:"flex items-center gap-2",children:[r.avatar_url&&e.jsx("img",{src:r.avatar_url,alt:"",className:"w-8 h-8 rounded-full object-cover"}),e.jsxs("div",{children:[e.jsx("div",{children:r.display_name}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["/",r.slug]})]})]})}),e.jsx("td",{className:"px-5 py-3 text-muted-foreground",children:r.title??"—"}),e.jsx("td",{className:"px-5 py-3",children:e.jsx("div",{className:"flex gap-2",children:N.map(t=>{const l=r.roles.includes(t);return e.jsx("button",{onClick:()=>b(r.id,t,l),className:`text-2xs px-2 py-1 rounded-md border ${l?"border-primary/40 bg-primary/15 text-primary":"border-border/20 text-muted-foreground hover:text-foreground"}`,children:t},t)})})}),e.jsx("td",{className:"px-5 py-3 text-right",children:e.jsx(m,{variant:"outline",size:"sm",onClick:()=>g(r),children:"Edit profile"})})]},r.id))})]})}),c&&e.jsx("div",{className:"fixed inset-0 bg-background/80 backdrop-blur z-50 flex items-center justify-center p-6",onClick:()=>o(null),children:e.jsxs("div",{className:"bg-card border border-border/20 rounded-2xl p-6 max-w-lg w-full space-y-3",onClick:r=>r.stopPropagation(),children:[e.jsx("h2",{className:"text-lg font-display font-semibold text-foreground mb-2",children:"Edit profile"}),[["display_name","Display name"],["title","Title"],["bio","Bio"],["avatar_url","Avatar URL"],["linkedin_url","LinkedIn URL"],["twitter_url","Twitter/X URL"],["website_url","Website URL"]].map(([r,t])=>e.jsxs("div",{children:[e.jsx(v,{className:"text-xs",children:t}),e.jsx(_,{value:i[r],onChange:l=>x({...i,[r]:l.target.value})})]},r)),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(m,{variant:"ghost",onClick:()=>o(null),children:"Cancel"}),e.jsx(m,{variant:"cta",onClick:j,children:"Save"})]})]})})]})};export{q 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.