PageSourceSearch

https://rankroot.ai/assets/TeamPage-pw6aHjyz.js

js rankroot.ai collected 2026-10-05 12:40:36 UTC 12,512 bytes, 1 lines download raw bytes

1import{d as te,u as Q,a as n,b as w,j as e}from"./vendor-query-KIqPKL62.js";import{P as se}from"./PageHeader-Diazf5ms.js";import{b as re,T as u,d as h,i as F,k as ae,l as ne,e as p,j as le}from"./index-Kn8_sQ1R.js";import{u as ie}from"./useDashboardTranslation-BhtYSrIf.js";import{u as oe}from"./useDocumentMeta-BaLm5S8t.js";import{C as me}from"./ConfirmDialog-CmBr-yNO.js";import{U as S,h as L,E as I,af as de,r as M,aw as ce,ax as xe,K as U,y as ue,J as he,X as B,j as H}from"./vendor-icons-ay6WqPhI.js";import"./vendor-react-DHuYjmqr.js";import"./vendor-motion-0x81uQcl.js";import"./vendor-charts-DHTMaBQ6.js";import"./vendor-posthog-CxGLPvq9.js";const J={owner:ce,admin:M,editor:de,viewer:I},pe={owner:"amber",admin:"green",editor:"cyan",viewer:"dim"};function Ee(){const s=ie();oe(s.meta.team.title,s.meta.team.description);const y=te(),a=re(t=>t.currentOrganizationId),{data:f}=Q({queryKey:["usage-limits"],queryFn:()=>le.getUsage().then(t=>t.data)}),b=(f==null?void 0:f.plan_tier)==="free",[V,o]=n.useState(!1),[j,_]=n.useState(""),[C,T]=n.useState("viewer"),[D,m]=n.useState(null),[r,g]=n.useState(null),[d,c]=n.useState(null),[x,k]=n.useState(""),[R,q]=n.useState(null),X={owner:s.team.roleLabels.owner,admin:s.team.roleLabels.admin,editor:s.team.roleLabels.editor,viewer:s.team.roleLabels.viewer},O=[{value:"admin",label:s.team.roleLabels.admin,desc:s.team.roleDescriptions.admin},{value:"editor",label:s.team.roleLabels.editor,desc:s.team.roleDescriptions.editor},{value:"viewer",label:s.team.roleLabels.viewer,desc:s.team.roleDescriptions.viewer}],v=Q({queryKey:["members",a],queryFn:()=>p.getMembers(a).then(t=>t.data),enabled:!!a}),N=w({mutationFn:t=>p.inviteMember(a,t),onSuccess:()=>{y.invalidateQueries({queryKey:["members",a]}),o(!1),_(""),T("viewer"),i("success",s.team.inviteSuccess)},onError:()=>i("error",s.team.inviteError)}),G=w({mutationFn:t=>p.removeMember(a,t),onSuccess:()=>y.invalidateQueries({queryKey:["members",a]})}),E=w({mutationFn:({userId:t,role:l})=>p.changeMemberRole(a,t,l),onSuccess:()=>{y.invalidateQueries({queryKey:["members",a]}),c(null),k(""),i("success",s.team.roleChanged)},onError:()=>i("error",s.team.roleChangeError)}),W=w({mutationFn:t=>p.resetMemberPassword(a,t),onSuccess:()=>i("success",s.team.resetPasswordSent),onError:()=>i("error",s.team.resetPasswordError)}),P=v.data??[];function i(t,l){q({type:t,message:l}),setTimeout(()=>q(null),3e3)}const z=()=>{j.trim()&&N.mutate({email:j.trim(),role:C})},Y=()=>{!d||!x||E.mutate({userId:d.user,role:x})},Z=t=>{m(null),g({type:"resetPassword",member:t})},$=t=>{m(null),g({type:"remove",member:t})},A=()=>{r&&(r.type==="remove"?G.mutate(r.member.user):W.mutate(r.member.user),g(null))},ee=t=>{c(t),k(t.role),m(null)};return e.jsxs("div",{children:[e.jsx(se,{title:s.team.title,description:s.team.description,actions:e.jsxs("div",{className:"relative group",children:[e.jsxs(u,{onClick:()=>!b&&o(!0),disabled:b,className:b?"opacity-50":"cursor-pointer",children:[e.jsx(S,{className:"w-4 h-4 inline mr-1"}),s.team.invite]}),b&&e.jsx("div",{className:"absolute right-0 top-full mt-1 px-3 py-1.5 rounded-lg bg-terminal-card border border-terminal-border text-xs text-terminal-dim whitespace-nowrap opacity-0 pointer-events-none group-hover:opacity-100 transition-opacity z-50 shadow-lg",children:s.team.requiresPaidPlan})]})}),R&&e.jsx("div",{className:h("mb-4 px-4 py-2.5 rounded-lg border text-sm shadow-sm",R.type==="success"?"border-terminal-green/50 text-terminal-green bg-terminal-green/5":"border-terminal-red/50 text-terminal-red bg-terminal-red/5"),children:R.message}),v.isLoading&&e.jsxs(F,{className:"text-center py-12",children:[e.jsx(L,{className:"w-8 h-8 text-terminal-dim mx-auto mb-4 animate-spin"}),e.jsx("p",{className:"text-terminal-dim",children:s.team.loadingTeam})]}),!v.isLoading&&P.length>0&&e.jsx(F,{children:e.jsx("div",{children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-terminal-border text-xs text-terminal-dim",children:[e.jsx("th",{className:"text-left py-2 px-2 font-medium",children:s.team.userColumn}),e.jsx("th",{className:"text-left py-2 px-2 font-medium",children:s.team.roleColumn}),e.jsx("th",{className:"text-right py-2 px-2 font-medium hidden sm:table-cell",children:s.team.joinedColumn}),e.jsx("th",{className:"text-right py-2 px-2 font-medium w-16",children:s.team.actionsColumn})]})}),e.jsx("tbody",{children:P.map(t=>{var K;const l=J[t.role]||I;return e.jsxs("tr",{className:"border-b border-terminal-border/50 hover:bg-terminal-bg/50 transition-colors",children:[e.jsx("td",{className:"py-2.5 px-2",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-7 h-7 rounded-full bg-terminal-green/10 border border-terminal-green/30 flex items-center justify-center",children:e.jsx("span",{className:"text-xs text-terminal-green font-bold",children:((K=t.user_email)==null?void 0:K.charAt(0).toUpperCase())||"?"})}),e.jsxs("div",{className:"min-w-0",children:[t.user_name&&e.jsx("div",{className:"text-terminal-text text-xs font-medium truncate",children:t.user_name}),e.jsx("div",{className:h("text-xs truncate",t.user_name?"text-terminal-dim":"text-terminal-text"),children:t.user_email})]})]})}),e.jsx("td",{className:"py-2.5 px-2",children:e.jsxs(ae,{variant:pe[t.role]||"dim",children:[e.jsx(l,{className:"w-3 h-3 inline mr-1"}),X[t.role]||t.role]})}),e.jsx("td",{className:"py-2.5 px-2 text-right text-xs text-terminal-dim hidden sm:table-cell",children:new Date(t.created_at).toLocaleDateString("pl")}),e.jsx("td",{className:"py-2.5 px-2 text-right",children:e.jsxs("div",{className:"relative inline-block",children:[e.jsx("button",{onClick:()=>m(D===t.id?null:t.id),className:"p-1.5 text-terminal-dim hover:text-terminal-text transition-colors cursor-pointer rounded hover:bg-terminal-bg",children:e.jsx(xe,{className:"w-4 h-4"})}),D===t.id&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>m(null)}),e.jsxs("div",{className:"absolute right-0 top-full mt-1 z-50 min-w-[180px] bg-terminal-card border border-terminal-border rounded-lg shadow-lg py-1",children:[t.role!=="owner"&&e.jsxs("button",{onClick:()=>ee(t),className:"w-full text-left px-3 py-1.5 text-xs text-terminal-text hover:bg-terminal-bg transition-colors cursor-pointer flex items-center gap-2",children:[e.jsx(M,{className:"w-3.5 h-3.5 text-terminal-dim"}),s.team.changeRole]}),t.has_password&&e.jsxs("button",{onClick:()=>Z(t),className:"w-full text-left px-3 py-1.5 text-xs text-terminal-text hover:bg-terminal-bg transition-colors cursor-pointer flex items-center gap-2",children:[e.jsx(U,{className:"w-3.5 h-3.5 text-terminal-dim"}),s.team.resetPassword]}),!t.has_password&&e.jsxs("div",{className:"px-3 py-1.5 text-xs text-terminal-dim flex items-center gap-2",children:[e.jsx(U,{className:"w-3.5 h-3.5"}),s.team.googleAccount]}),t.role!=="owner"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-t border-terminal-border my-1"}),e.jsxs("button",{onClick:()=>$(t),className:"w-full text-left px-3 py-1.5 text-xs text-terminal-red hover:bg-terminal-red/5 transition-colors cursor-pointer flex items-center gap-2",children:[e.jsx(ue,{className:"w-3.5 h-3.5"}),s.team.removeFromTeam]})]})]})]})]})})]},t.id)})})]})})}),!v.isLoading&&P.length===0&&e.jsxs(F,{className:"text-center py-12",children:[e.jsx(he,{className:"w-12 h-12 text-terminal-dim mx-auto mb-4"}),e.jsx("p",{className:"text-terminal-dim",children:s.team.noMembers})]}),V&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-50 bg-black/60",onClick:()=>o(!1)}),e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:e.jsxs("div",{className:"bg-terminal-card border border-terminal-border rounded-lg shadow-xl w-full max-w-md pointer-events-auto",children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-terminal-border",children:[e.jsxs("h3",{className:"text-sm font-bold text-terminal-text",children:[e.jsx(S,{className:"w-4 h-4 inline mr-1.5 text-terminal-green"}),s.team.inviteNew]}),e.jsx("button",{onClick:()=>o(!1),className:"text-terminal-dim hover:text-terminal-text transition-colors cursor-pointer",children:e.jsx(B,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"px-5 py-4 space-y-4",children:[e.jsx("p",{className:"text-xs text-terminal-dim",children:s.team.inviteDescription}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-terminal-dim block mb-1",children:"Email"}),e.jsx(ne,{prefix:">",type:"email",placeholder:s.team.emailPlaceholder,value:j,onChange:t=>_(t.target.value),onKeyDown:t=>t.key==="Enter"&&z()})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-terminal-dim block mb-1.5",children:s.team.selectRole}),e.jsx("div",{className:"space-y-1.5",children:O.map(t=>e.jsxs("button",{onClick:()=>T(t.value),className:h("w-full text-left px-3 py-2.5 border rounded-lg transition-colors cursor-pointer",C===t.value?"border-terminal-green/50 bg-terminal-green/5":"border-terminal-border hover:border-terminal-green/30"),children:[e.jsx("span",{className:h("text-xs font-medium",C===t.value?"text-terminal-green":"text-terminal-text"),children:t.label}),e.jsx("p",{className:"text-xs text-terminal-dim mt-0.5 leading-snug",children:t.desc})]},t.value))})]}),N.isError&&e.jsx("p",{className:"text-xs text-terminal-red",children:s.team.inviteError})]}),e.jsxs("div",{className:"flex justify-end gap-2 px-5 py-3 border-t border-terminal-border",children:[e.jsx(u,{variant:"secondary",onClick:()=>o(!1),className:"cursor-pointer",children:s.common.cancel}),e.jsx(u,{onClick:z,disabled:!j.trim()||N.isPending,className:"cursor-pointer",children:N.isPending?e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"w-4 h-4 inline mr-1 animate-spin"}),s.team.sending]}):e.jsxs(e.Fragment,{children:[e.jsx(S,{className:"w-4 h-4 inline mr-1"}),s.team.sendInvite]})})]})]})})]}),d&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-50 bg-black/60",onClick:()=>c(null)}),e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:e.jsxs("div",{className:"bg-terminal-card border border-terminal-border rounded-lg shadow-xl w-full max-w-sm pointer-events-auto",children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-terminal-border",children:[e.jsxs("h3",{className:"text-sm font-bold text-terminal-text",children:[e.jsx(M,{className:"w-4 h-4 inline mr-1.5 text-terminal-green"}),s.team.changeRole]}),e.jsx("button",{onClick:()=>c(null),className:"text-terminal-dim hover:text-terminal-text transition-colors cursor-pointer",children:e.jsx(B,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"px-5 py-4 space-y-4",children:[e.jsx("p",{className:"text-xs text-terminal-dim",children:s.team.changeRoleFor.replace("{email}",d.user_email)}),e.jsx("div",{className:"space-y-2",children:O.map(t=>{const l=J[t.value]||I;return e.jsxs("button",{onClick:()=>k(t.value),className:h("w-full text-left px-3 py-2.5 text-xs border rounded-lg transition-colors cursor-pointer flex items-center gap-2",x===t.value?"border-terminal-green/50 text-terminal-green bg-terminal-green/5":"border-terminal-border text-terminal-dim hover:text-terminal-text"),children:[e.jsx(l,{className:"w-4 h-4"}),t.label,x===t.value&&e.jsx(H,{className:"w-3.5 h-3.5 ml-auto"})]},t.value)})})]}),e.jsxs("div",{className:"flex justify-end gap-2 px-5 py-3 border-t border-terminal-border",children:[e.jsx(u,{variant:"secondary",onClick:()=>c(null),className:"cursor-pointer",children:s.common.cancel}),e.jsx(u,{onClick:Y,disabled:E.isPending||x===d.role,className:"cursor-pointer",children:E.isPending?e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"w-4 h-4 inline mr-1 animate-spin"}),s.common.loading]}):e.jsxs(e.Fragment,{children:[e.jsx(H,{className:"w-4 h-4 inline mr-1"}),s.common.confirm]})})]})]})})]}),e.jsx(me,{open:!!r,title:(r==null?void 0:r.type)==="remove"?s.team.removeFromTeam:s.team.resetPassword,message:(r==null?void 0:r.type)==="remove"?s.team.removeConfirm.replace("{email}",(r==null?void 0:r.member.user_email)||""):s.team.resetPasswordConfirm.replace("{email}",(r==null?void 0:r.member.user_email)||""),confirmLabel:(r==null?void 0:r.type)==="remove"?s.common.delete:s.team.resetPassword,cancelLabel:s.common.cancel,variant:(r==null?void 0:r.type)==="remove"?"danger":"warning",onConfirm:A,onCancel:()=>g(null)})]})}export{Ee as TeamPage};

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.