import{Y as u,t as i,r as d,j as e}from"./index-B-YXshIJ.js";import{I as m}from"./InfoBox-XHysCRaX.js";import{E as p}from"./edit-2-DHSaoIVm.js";import{T as x}from"./trash-2-VFq_6Gbx.js";const j=()=>{const o=u(),r=i.auth.verifySession.useQuery().data,l=localStorage.getItem("currentOrganization"),s=l?JSON.parse(l).value:null,a=s?i.apiToken.getOrganizationApiTokens.useQuery({organizationId:s},{refetchOnMount:"always"}):null,n=i.apiToken.deleteToken.useMutation(),c=d.useCallback(async t=>{if(!(!r||!s))return n.mutateAsync({organizationId:s,tokenId:t})},[n,r,s]);return e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:"flex flex-row justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-gray-900 text-2xl font-semibold mb-2",children:"Tokens"}),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."})]}),e.jsx("div",{children:e.jsx("button",{className:"ml-4 bg-gradient-to-r from-purple-950 to-purple-800 text-white font-medium cursor-pointer rounded-md px-4 py-1 w-48 h-12",type:"button",onClick:()=>o("/settings/tokens/create-token?auth=true"),children:"Generate New Token"})})]}),e.jsx(m,{className:"mt-4 bg-purple-100",infoIconColorClass:"text-purple-900",children:e.jsx("p",{children:"Now that your organization is created, you may generate your token which will be used in CI. 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."})}),a!=null&&a.data?e.jsxs("div",{className:"pt-5",children:[e.jsx("h3",{className:"text-gray-900 text-2xl font-semibold mb-2",children:"All Tokens"}),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."}),e.jsx("div",{className:"flex flex-col",children:a.data.map(t=>e.jsx("div",{className:"border border-gray-300 p-3 rounded-md mt-4",children:e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("p",{className:"block text-gray-700 text-base font-bold mb-1",children:t.tokenName}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{type:"button",className:"ml-2 text-purple-950 flex items-center gap-2",onClick:()=>{o("/settings/tokens/edit-token/".concat(t._id.toString(),"?auth=true"))},children:[e.jsx(p,{className:"w-4 h-4 text-purple-950"}),e.jsx("span",{children:"Edit"})]}),e.jsxs("button",{type:"button",className:"ml-2 text-red-500 flex items-center gap-2",onClick:async()=>{await c(t._id.toString()),await a.refetch()},children:[e.jsx(x,{className:"w-4 h-4  text-red-500"}),e.jsx("span",{children:"Delete"})]})]})]})},t._id.toString()))})]}):null]})};export{j as default};
