mirror of
https://github.com/StanGirard/quivr.git
synced 2024-12-19 00:22:14 +03:00
3529222b95
* 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
42 lines
1.1 KiB
TypeScript
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>
|
|
</>
|
|
);
|
|
};
|