PageSourceSearch

https://zeropointlabs.ai/assets/TeamManagement-xPNaNo08.js

js zeropointlabs.ai collected 2026-10-05 15:19:39 UTC 12,017 bytes, 1 lines download raw bytes

1import{r as w,ak as E,s as S,j as e,I as h,a1 as q,g as T,u as O,w as R}from"./index-CLtGP32Z.js";import{u as I}from"./useMutation-BvxM86re.js";import{o as A,s as d,l as u,a as v,b as B,n as P,u as H,t as Q}from"./types-BMHrb74q.js";import{s as G,t as D,F as K,a as i,b as n,c as a,d as o,e as c,T as L,D as V}from"./DeleteConfirmDialog-DE-kX4hh.js";import{d as U,u as z}from"./index-mC58iiqr.js";import{D as Y,a as W,b as $,c as J,d as X}from"./dialog-x1Gc4z_6.js";import{S as Z}from"./switch-BuJuE40j.js";import{S as ee,a as se,b as re,c as le,d as C}from"./select-Bq2l4yDN.js";import{I as te}from"./ImageUpload-DhJhk6u0.js";import{T as ie,a as ne,b as M,c as y,d as ae,e as _}from"./table-VQ_0MYAS.js";import"./label-C5P13FKO.js";import"./badge-BKvD35-V.js";import"./alert-dialog-nG4Kb3iB.js";import"./index-PT8koDjQ.js";import"./index-DAJOau0q.js";import"./index-CMZ90543.js";const oe=A({full_name:d().min(1,"Name is required"),title:d().min(1,"Title is required"),role:d().min(1,"Role is required"),bio:d().optional(),email:d().email().optional().or(u("")),linkedin:d().url().optional().or(u("")),twitter:d().url().optional().or(u("")),google_scholar:d().url().optional().or(u("")),github:d().url().optional().or(u("")),orcid:d().url().optional().or(u("")),researchgate:d().url().optional().or(u("")),website:d().url().optional().or(u("")),instagram:d().url().optional().or(u("")),facebook:d().url().optional().or(u("")),youtube:d().url().optional().or(u("")),medium:d().url().optional().or(u("")),expertise:v(d()).default([]),research_interests:v(d()).default([]),is_featured:B().default(!1),display_order:P().optional(),image_url:d().optional()}),ce=({open:k,onOpenChange:j,member:r})=>{const[g,m]=w.useState(null),f=E(),t=H({resolver:Q(oe),defaultValues:{full_name:"",title:"",role:"",bio:"",email:"",linkedin:"",twitter:"",google_scholar:"",github:"",orcid:"",researchgate:"",website:"",instagram:"",facebook:"",youtube:"",medium:"",expertise:[],research_interests:[],is_featured:!1,display_order:0,image_url:""}});w.useEffect(()=>{r?t.reset({full_name:r.full_name,title:r.title,role:r.role,bio:r.bio||"",email:r.email||"",linkedin:r.linkedin||"",twitter:r.twitter||"",google_scholar:r.google_scholar||"",github:r.github||"",orcid:r.orcid||"",researchgate:r.researchgate||"",website:r.website||"",instagram:r.instagram||"",facebook:r.facebook||"",youtube:r.youtube||"",medium:r.medium||"",expertise:r.expertise||[],research_interests:r.research_interests||[],is_featured:r.is_featured,display_order:r.display_order||0,image_url:r.image_url||""}):(t.reset(),m(null))},[r,t,k]);const p=I({mutationFn:async s=>{let l=s.image_url;g&&(r!=null&&r.image_url&&await U(r.image_url,"team-photos"),l=await z({bucket:"team-photos",file:g}));const x=G(s.full_name),F={full_name:s.full_name,title:s.title,role:s.role,slug:x,image_url:l,email:s.email||null,linkedin:s.linkedin||null,twitter:s.twitter||null,google_scholar:s.google_scholar||null,github:s.github||null,orcid:s.orcid||null,researchgate:s.researchgate||null,website:s.website||null,instagram:s.instagram||null,facebook:s.facebook||null,youtube:s.youtube||null,medium:s.medium||null,bio:s.bio||null,expertise:s.expertise,research_interests:s.research_interests,is_featured:s.is_featured,display_order:s.display_order};if(r){const{error:b}=await S.from("team_members").update(F).eq("id",r.id);if(b)throw b}else{const{error:b}=await S.from("team_members").insert([F]);if(b)throw b}},onSuccess:()=>{f.invalidateQueries({queryKey:["team-members"]}),D({title:"Success",description:`Team member ${r?"updated":"created"} successfully`}),j(!1),t.reset(),m(null)},onError:s=>{D({title:"Error",description:s.message,variant:"destructive"})}}),N=s=>{p.mutate(s)};return e.jsx(Y,{open:k,onOpenChange:j,children:e.jsxs(W,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsx($,{children:e.jsxs(J,{children:[r?"Edit":"Add"," Team Member"]})}),e.jsx(K,{...t,children:e.jsxs("form",{onSubmit:t.handleSubmit(N),className:"space-y-4",children:[e.jsx(i,{control:t.control,name:"image_url",render:({field:s})=>e.jsxs(n,{children:[e.jsx(a,{children:"Photo"}),e.jsx(o,{children:e.jsx(te,{value:s.value,onChange:s.onChange,onFileSelect:m})}),e.jsx(c,{})]})}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(i,{control:t.control,name:"full_name",render:({field:s})=>e.jsxs(n,{children:[e.jsx(a,{children:"Full Name *"}),e.jsx(o,{children:e.jsx(h,{...s})}),e.jsx(c,{})]})}),e.jsx(i,{control:t.control,name:"title",render:({field:s})=>e.jsxs(n,{children:[e.jsx(a,{children:"Title *"}),e.jsx(o,{children:e.jsx(h,{...s,placeholder:"e.g. Senior Researcher"})}),e.jsx(c,{})]})})]}),e.jsx(i,{control:t.control,name:"role",render:({field:s})=>e.jsxs(n,{children:[e.jsx(a,{children:"Role *"}),e.jsxs(ee,{onValueChange:s.onChange,value:s.value,children:[e.jsx(o,{children:e.jsx(se,{children:e.jsx(re,{placeholder:"Select role"})})}),e.jsxs(le,{children:[e.jsx(C,{value:"Leadership",children:"Leadership"}),e.jsx(C,{value:"Research",children:"Research"}),e.jsx(C,{value:"Engineering",children:"Engineering"}),e.jsx(C,{value:"Operations",children:"Operations"})]})]}),e.jsx(c,{})]})}),e.jsx(i,{control:t.control,name:"bio",render:({field:s})=>e.jsxs(n,{children:[e.jsx(a,{children:"Bio"}),e.jsx(o,{children:e.jsx(q,{...s,rows:4})}),e.jsx(c,{})]})}),e.jsx(i,{control:t.control,name:"expertise",render:({field:s})=>e.jsxs(n,{children:[e.jsx(a,{children:"Expertise Areas"}),e.jsx(o,{children:e.jsx(L,{value:s.value,onChange:s.onChange})}),e.jsx(c,{})]})}),e.jsx(i,{control:t.control,name:"research_interests",render:({field:s})=>e.jsxs(n,{children:[e.jsx(a,{children:"Research Interests"}),e.jsx(o,{children:e.jsx(L,{value:s.value,onChange:s.onChange})}),e.jsx(c,{})]})}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(i,{control:t.control,name:"email",render:({field:s})=>e.jsxs(n,{children:[e.jsx(a,{children:"Email"}),e.jsx(o,{children:e.jsx(h,{...s,type:"email"})}),e.jsx(c,{})]})}),e.jsx(i,{control:t.control,name:"linkedin",render:({field:s})=>e.jsxs(n,{children:[e.jsx(a,{children:"LinkedIn URL"}),e.jsx(o,{children:e.jsx(h,{...s,type:"url"})}),e.jsx(c,{})]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(i,{control:t.control,name:"twitter",render:({field:s})=>e.jsxs(n,{children:[e.jsx(a,{children:"Twitter URL"}),e.jsx(o,{children:e.jsx(h,{...s,type:"url",placeholder:"https://twitter.com/username"})}),e.jsx(c,{})]})}),e.jsx(i,{control:t.control,name:"google_scholar",render:({field:s})=>e.jsxs(n,{children:[e.jsx(a,{children:"Google Scholar URL"}),e.jsx(o,{children:e.jsx(h,{...s,type:"url",placeholder:"https://scholar.google.com/..."})}),e.jsx(c,{})]})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-sm font-medium text-muted-foreground",children:"Professional Networks"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(i,{control:t.control,name:"github",render:({field:s})=>e.jsxs(n,{children:[e.jsx(a,{children:"GitHub URL"}),e.jsx(o,{children:e.jsx(h,{...s,type:"url",placeholder:"https://github.com/username"})}),e.jsx(c,{})]})}),e.jsx(i,{control:t.control,name:"orcid",render:({field:s})=>e.jsxs(n,{children:[e.jsx(a,{children:"ORCID URL"}),e.jsx(o,{children:e.jsx(h,{...s,type:"url",placeholder:"https://orcid.org/..."})}),e.jsx(c,{})]})}),e.jsx(i,{control:t.control,name:"researchgate",render:({field:s})=>e.jsxs(n,{children:[e.jsx(a,{children:"ResearchGate URL"}),e.jsx(o,{children:e.jsx(h,{...s,type:"url",placeholder:"https://researchgate.net/profile/..."})}),e.jsx(c,{})]})}),e.jsx(i,{control:t.control,name:"website",render:({field:s})=>e.jsxs(n,{children:[e.jsx(a,{children:"Personal Website"}),e.jsx(o,{children:e.jsx(h,{...s,type:"url",placeholder:"https://yourwebsite.com"})}),e.jsx(c,{})]})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-sm font-medium text-muted-foreground",children:"Social Media (Optional)"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(i,{control:t.control,name:"instagram",render:({field:s})=>e.jsxs(n,{children:[e.jsx(a,{children:"Instagram URL"}),e.jsx(o,{children:e.jsx(h,{...s,type:"url",placeholder:"https://instagram.com/username"})}),e.jsx(c,{})]})}),e.jsx(i,{control:t.control,name:"facebook",render:({field:s})=>e.jsxs(n,{children:[e.jsx(a,{children:"Facebook URL"}),e.jsx(o,{children:e.jsx(h,{...s,type:"url",placeholder:"https://facebook.com/username"})}),e.jsx(c,{})]})}),e.jsx(i,{control:t.control,name:"youtube",render:({field:s})=>e.jsxs(n,{children:[e.jsx(a,{children:"YouTube URL"}),e.jsx(o,{children:e.jsx(h,{...s,type:"url",placeholder:"https://youtube.com/@channel"})}),e.jsx(c,{})]})}),e.jsx(i,{control:t.control,name:"medium",render:({field:s})=>e.jsxs(n,{children:[e.jsx(a,{children:"Medium/Blog URL"}),e.jsx(o,{children:e.jsx(h,{...s,type:"url",placeholder:"https://medium.com/@username"})}),e.jsx(c,{})]})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(i,{control:t.control,name:"display_order",render:({field:s})=>e.jsxs(n,{children:[e.jsx(a,{children:"Display Order"}),e.jsx(o,{children:e.jsx(h,{...s,type:"number",onChange:l=>s.onChange(parseInt(l.target.value)||0)})}),e.jsx(c,{})]})}),e.jsx(i,{control:t.control,name:"is_featured",render:({field:s})=>e.jsxs(n,{className:"flex items-center justify-between space-y-0 pt-8",children:[e.jsx(a,{children:"Featured Member"}),e.jsx(o,{children:e.jsx(Z,{checked:s.value,onCheckedChange:s.onChange})})]})})]}),e.jsxs(X,{children:[e.jsx(T,{type:"button",variant:"outline",onClick:()=>j(!1),children:"Cancel"}),e.jsx(T,{type:"submit",disabled:p.isPending,children:p.isPending?"Saving...":r?"Update":"Create"})]})]})})]})})},Se=()=>{const[k,j]=w.useState(!1),[r,g]=w.useState(!1),[m,f]=w.useState(null),t=E(),{data:p,isLoading:N}=O({queryKey:["admin-team-members"],queryFn:async()=>{const{data:l,error:x}=await S.from("team_members").select("*").order("display_order",{ascending:!0});if(x)throw x;return l}}),s=I({mutationFn:async l=>{l.image_url&&await U(l.image_url,"team-photos");const{error:x}=await S.from("team_members").delete().eq("id",l.id);if(x)throw x},onSuccess:()=>{t.invalidateQueries({queryKey:["team-members"]}),R.success("Team member deleted successfully"),g(!1),f(null)},onError:l=>{R.error("Error",{description:l.message})}});return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold",children:"Team Members"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"Manage your team member profiles"})]}),e.jsx(T,{onClick:()=>{f(null),j(!0)},children:"Add Team Member"})]}),N?e.jsx("div",{children:"Loading..."}):e.jsx("div",{className:"border rounded-lg",children:e.jsxs(ie,{children:[e.jsx(ne,{children:e.jsxs(M,{children:[e.jsx(y,{children:"Name"}),e.jsx(y,{children:"Title"}),e.jsx(y,{children:"Role"}),e.jsx(y,{children:"Social Links"}),e.jsx(y,{children:"Featured"}),e.jsx(y,{children:"Actions"})]})}),e.jsx(ae,{children:p==null?void 0:p.map(l=>{const x=[l.email,l.linkedin,l.twitter,l.github,l.google_scholar,l.orcid,l.researchgate,l.website,l.instagram,l.facebook,l.youtube,l.medium].filter(
1Boolean).length;return e.jsxs(M,{children:[e.jsx(_,{className:"font-medium",children:l.full_name}),e.jsx(_,{children:l.title}),e.jsx(_,{children:l.role}),e.jsx(_,{children:e.jsxs("span",{className:x>0?"text-foreground":"text-muted-foreground",children:[x," / 12"]})}),e.jsx(_,{children:l.is_featured?"Yes":"No"}),e.jsx(_,{children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(T,{variant:"outline",size:"sm",onClick:()=>{f(l),j(!0)},children:"Edit"}),e.jsx(T,{variant:"destructive",size:"sm",onClick:()=>{f(l),g(!0)},children:"Delete"})]})})]},l.id)})})]})}),e.jsx(ce,{open:k,onOpenChange:j,member:m}),e.jsx(V,{open:r,onOpenChange:g,onConfirm:()=>m&&s.mutate(m),title:"Delete Team Member",description:"Are you sure you want to delete this team member? This action cannot be undone."})]})};export{Se 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.