import{t as s,R as m,r as f,j as e}from"./index-B-YXshIJ.js";import{I as b}from"./InfoBox-XHysCRaX.js";const N=()=>{var u;const a=s.auth.verifySession.useQuery().data,o=a?s.organization.getOrganizationsForUser.useQuery({userEmail:a==null?void 0:a.email}):null,t=localStorage.getItem("currentOrganization"),[r,p]=m.useState(t?JSON.parse(t):null),[l,d]=m.useState((u=r==null?void 0:r.label)!=null?u:""),g=s.organization.updateOrganizationName.useMutation(),x=async n=>{var c;if(!t||!a)return;n.preventDefault();const i=await g.mutateAsync({userEmail:a.email,orgId:(c=r==null?void 0:r.value)!=null?c:"",newName:l});return i&&localStorage.setItem("currentOrganization",JSON.stringify({value:i._id,label:i.name})),null};return f.useEffect(()=>{if(t){const n=JSON.parse(t);p(n)}},[t]),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("h3",{className:"text-gray-900 text-2xl font-semibold",children:"General Settings"}),e.jsx("hr",{className:"my-2"}),e.jsx("p",{children:"Lorem ipsum dolor sit amet, consectetur adipisicing elit. Vel obcaecati repudiandae illum quidem doloremque. Porro voluptas asperiores, tempora eos voluptatibus eveniet corrupti. Distinctio aliquam eligendi consequatur? Harum iste quam dolorem."}),o!=null&&o.data&&o.data.length>0?e.jsxs("form",{onSubmit:x,children:[e.jsxs("div",{className:"pb-6 flex flex-col align-center justify-between mt-4",children:[e.jsx("label",{className:"pr-2 pb-2 text-gray-900 text-base font-semibold",htmlFor:"organization-name",children:"Organization Name"}),e.jsx("input",{className:"border border-gray-300 rounded-md px-3 py-3 placeholder-gray-400",id:"organization-name",type:"text",value:l||"",onChange:n=>d(n.target.value),placeholder:"Organization Name",required:!0})]}),e.jsx("button",{type:"submit",className:"bg-gradient-to-r from-purple-950 to-purple-800 text-white cursor-pointer px-5 py-3 rounded-md w-full text-base font-semibold",children:"Update Organization Name"})]}):e.jsx(b,{className:"mt-4 bg-purple-100",infoIconColorClass:"text-purple-900",children:e.jsx("p",{children:'You are not part of any organization. Please contact your organization owner to add you to an organization. If you are the owner, please create an organization by by clicking on the "Add new organization" button at the top right corner.'})})]})};export{N as default};
