quivr/frontend/app/user/components/ApiKeyConfig/ApiKeyConfig.tsx
Mamadou DICKO 3529222b95
Brain management 4 (#762)
* feat: add <ApiKeyConfig/>

* feat(SDK): add update brain

* feat: add removeUndefined helper

* feat: remove unnecessary autofocus flag

* add brain settings tab

* ui: add tab delimitor

* feat: improve ux
2023-07-25 23:12:46 +02:00

42 lines
1.1 KiB
TypeScript

"use client";
import Button from "@/lib/components/ui/Button";
import { Divider } from "@/lib/components/ui/Divider";
import { useApiKeyConfig } from "./hooks/useApiKeyConfig";
export const ApiKeyConfig = (): JSX.Element => {
const { apiKey, handleCopyClick, handleCreateClick } = useApiKeyConfig();
return (
<>
<Divider text="API Key Config" className="mt-4" />
<div className="flex justify-center items-center mt-4">
<div className="flex items-center space-x-4">
{apiKey === "" && (
<Button
data-testid="create-new-key"
variant="secondary"
onClick={() => void handleCreateClick()}
>
Create New Key
</Button>
)}
</div>
{apiKey !== "" && (
<div className="flex items-center space-x-4">
<span className="text-gray-600">{apiKey}</span>
<Button
data-testid="copy-api-key-button"
variant="secondary"
onClick={handleCopyClick}
>
📋
</Button>
</div>
)}
</div>
</>
);
};