PageSourceSearch

https://skinnovation.at/assets/teams-eEUHlLqG.js

js skinnovation.at collected 2026-10-04 01:47:58 UTC 8,517 bytes, 1 lines download raw bytes

1import{aB as S,ap as i,E as y,q as e,aD as x,X as k,h as j}from"./index-BiZh21pO.js";import{u as p}from"./useMutation-De6n0Lgb.js";import{l as _,a as E,b as L,r as M,c as q,u as D,d as K,e as P,f as $,s as Q}from"./work-teams.functions-UtJzaiWn.js";import{P as w}from"./PersonPicker-CJL24Pcn.js";import{S as R}from"./shield-check-D-nuBP3d.js";import{P as A}from"./plus-DZ46z9WM.js";import{T as z}from"./trash-2-D_SwAcYq.js";import{S as B}from"./star-DrFUZLrg.js";import"./popover-C-o7gjyP.js";import"./index-DVYrm6bS.js";function F({name:s,url:n}){const d=s.split(/\s+/).map(o=>o[0]).filter(Boolean).slice(0,2).join("").toUpperCase();return n?e.jsx("img",{src:n,alt:s,className:"h-6 w-6 rounded-full object-cover"}):e.jsx("span",{className:"inline-flex h-6 w-6 items-center justify-center rounded-full bg-muted text-[10px] font-semibold uppercase text-muted-foreground",children:d||"?"})}function I(){const s=S(),n=i(_),d=i(E),o=y({queryKey:["control-teams"],queryFn:()=>n()}),l=y({queryKey:["control-event-leads"],queryFn:()=>d()}),m=()=>{s.invalidateQueries({queryKey:["control-teams"]}),s.invalidateQueries({queryKey:["control-event-leads"]}),s.invalidateQueries({queryKey:["works","my-team-scope"]})};return e.jsxs("div",{className:"space-y-8",children:[e.jsx(O,{leads:l.data??[],onChange:m}),e.jsx(W,{teams:o.data??[],loading:o.isLoading,onChange:m})]})}function O({leads:s,onChange:n}){const d=i(L),o=i(M),l=p({mutationFn:a=>d({data:{user_id:a}}),onSuccess:n,onError:a=>x.error(a.message)}),m=p({mutationFn:a=>o({data:{user_id:a}}),onSuccess:n,onError:a=>x.error(a.message)}),c=s.map(a=>a.user_id);return e.jsxs("section",{className:"rounded-lg border border-border bg-card p-5 shadow-[var(--shadow-app-xs)]",children:[e.jsxs("header",{className:"mb-4 flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"flex items-center gap-2 text-base font-semibold",children:[e.jsx(R,{className:"h-4 w-4 text-primary"})," Event leads"]}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Can see everyone's work in Works · Team work. Kathrin + Valentin typically live here."})]}),e.jsx("div",{className:"w-56",children:e.jsx(w,{value:c,onChange:a=>{const b=a.find(u=>!c.includes(u)),r=c.find(u=>!a.includes(u));b&&l.mutate(b),r&&m.mutate(r)},placeholder:"+ Add event lead",compact:!0})})]}),s.length===0?e.jsx("p",{className:"text-sm italic text-muted-foreground",children:"No event leads yet."}):e.jsx("ul",{className:"flex flex-wrap gap-2",children:s.map(a=>e.jsxs("li",{className:"inline-flex items-center gap-2 rounded-full border border-border bg-muted/40 py-1 pl-1 pr-2 text-sm",children:[e.jsx(F,{name:a.name,url:a.photo_url}),e.jsx("span",{className:"font-medium",children:a.name}),e.jsx("button",{type:"button",onClick:()=>m.mutate(a.user_id),className:"rounded-full p-0.5 text-muted-foreground hover:bg-destructive/10 hover:text-destructive","aria-label":`Remove ${a.name}`,children:e.jsx(k,{className:"h-3.5 w-3.5"})})]},a.user_id))})]})}function W({teams:s,loading:n,onChange:d}){const[o,l]=j.useState(!1),[m,c]=j.useState(""),a=i(q),b=p({mutationFn:r=>a({data:{name:r}}),onSuccess:()=>{c(""),l(!1),d()},onError:r=>x.error(r.message)});return e.jsxs("section",{className:"rounded-lg border border-border bg-card p-5 shadow-[var(--shadow-app-xs)]",children:[e.jsxs("header",{className:"mb-4 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold",children:"Teams"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Team leads see their members' work. Star a person to mark them as a team lead."})]}),e.jsxs("button",{type:"button",onClick:()=>l(r=>!r),className:"inline-flex items-center gap-1.5 rounded-md border border-border bg-background px-3 py-1.5 text-sm font-medium transition hover:bg-muted",children:[e.jsx(A,{className:"h-3.5 w-3.5"})," New team"]})]}),o&&e.jsxs("form",{className:"mb-4 flex gap-2",onSubmit:r=>{r.preventDefault();const u=m.trim();u&&b.mutate(u)},children:[e.jsx("input",{autoFocus:!0,value:m,onChange:r=>c(r.target.value),placeholder:"Team name (e.g. Marketing, Ops)",className:"h-9 flex-1 rounded-md border border-border bg-background px-3 text-sm"}),e.jsx("button",{type:"submit",className:"h-9 rounded-md bg-primary px-3 text-sm font-medium text-primary-foreground disabled:opacity-50",disabled:!m.trim()||b.isPending,children:"Create"}),e.jsx("button",{type:"button",onClick:()=>l(!1),className:"h-9 rounded-md border border-border px-3 text-sm",children:"Cancel"})]}),n?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading…"}):s.length===0?e.jsx("p",{className:"text-sm italic text-muted-foreground",children:"No teams yet."}):e.jsx("div",{className:"space-y-4",children:s.map(r=>e.jsx(U,{team:r,onChange:d},r.id))})]})}function U({team:s,onChange:n}){const[d,o]=j.useState(null),l=i(D),m=i(K),c=i(P),a=i($),b=i(Q),r=p({mutationFn:t=>l({data:{id:s.id,name:t}}),onSuccess:()=>{o(null),n()},onError:t=>x.error(t.message)}),u=p({mutationFn:()=>m({data:{id:s.id}}),onSuccess:n,onError:t=>x.error(t.message)}
1),C=p({mutationFn:t=>c({data:{team_id:s.id,user_id:t,is_lead:!1}}),onSuccess:n,onError:t=>x.error(t.message)}),v=p({mutationFn:t=>a({data:{team_id:s.id,user_id:t}}),onSuccess:n,onError:t=>x.error(t.message)}),T=p({mutationFn:t=>b({data:{team_id:s.id,...t}}),onSuccess:n,onError:t=>x.error(t.message)}),f=s.members.map(t=>t.user_id);return e.jsxs("div",{className:"rounded-md border border-border bg-background/70 p-4",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3",children:[d!==null?e.jsxs("form",{className:"flex flex-1 gap-2",onSubmit:t=>{t.preventDefault();const h=d.trim();h&&r.mutate(h)},children:[e.jsx("input",{autoFocus:!0,value:d,onChange:t=>o(t.target.value),className:"h-8 flex-1 rounded-md border border-border bg-background px-2 text-sm font-semibold"}),e.jsx("button",{type:"submit",className:"text-xs font-medium text-primary hover:underline",children:"Save"}),e.jsx("button",{type:"button",onClick:()=>o(null),className:"text-xs text-muted-foreground hover:text-foreground",children:"Cancel"})]}):e.jsx("button",{type:"button",onDoubleClick:()=>o(s.name),className:"text-base font-semibold hover:underline",title:"Double-click to rename",children:s.name}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:()=>o(s.name),className:"text-xs text-muted-foreground hover:text-foreground",children:"Rename"}),e.jsx("button",{type:"button",onClick:()=>{confirm(`Delete team "${s.name}"?`)&&u.mutate()},className:"text-muted-foreground hover:text-destructive","aria-label":`Delete ${s.name}`,children:e.jsx(z,{className:"h-3.5 w-3.5"})})]})]}),e.jsx("div",{className:"mb-3 w-56",children:e.jsx(w,{value:f,onChange:t=>{const h=t.find(g=>!f.includes(g)),N=f.find(g=>!t.includes(g));h&&C.mutate(h),N&&v.mutate(N)},placeholder:"+ Add member",compact:!0})}),s.members.length===0?e.jsx("p",{className:"text-sm italic text-muted-foreground",children:"No members yet."}):e.jsx("ul",{className:"divide-y divide-border",children:s.members.map(t=>e.jsxs("li",{className:"flex items-center gap-3 py-2",children:[e.jsx(F,{name:t.name,url:t.photo_url}),e.jsx("span",{className:"flex-1 truncate text-sm font-medium",children:t.name}),t.is_lead&&e.jsx("span",{className:"rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-primary",children:"Lead"}),e.jsx("button",{type:"button",onClick:()=>T.mutate({user_id:t.user_id,is_lead:!t.is_lead}),className:`rounded-md p-1 transition ${t.is_lead?"text-amber-500 hover:text-amber-600":"text-muted-foreground hover:text-amber-500"}`,title:t.is_lead?"Remove lead":"Make team lead","aria-label":"Toggle team lead",children:e.jsx(B,{className:`h-4 w-4 ${t.is_lead?"fill-current":""}`})}),e.jsx("button",{type:"button",onClick:()=>v.mutate(t.user_id),className:"rounded-md p-1 text-muted-foreground hover:text-destructive","aria-label":`Remove ${t.name}`,children:e.jsx(k,{className:"h-3.5 w-3.5"})})]},t.user_id))})]})}function ae(){return e.jsxs("div",{className:"max-w-4xl space-y-6",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsx("h1",{className:"text-[22px] font-semibold tracking-tight",children:"Teams"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Organize organizers into teams. Team leads see their members' work in Works · Team work. Event leads see everyone."})]}),e.jsx(I,{})]})}export{ae 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.