quivr/frontend/app/user/components/ApiKeyConfig/ApiKeyConfig.tsx
Stan Girard d955e31f50
feat: 🎸 marketplace (#1657)
added explore button and removed unused feature openai key

# Description

Please include a summary of the changes and the related issue. Please
also include relevant motivation and context.

## Checklist before requesting a review

Please delete options that are not relevant.

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented hard-to-understand areas
- [ ] I have ideally added tests that prove my fix is effective or that
my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged

## Screenshots (if appropriate):
2023-11-19 18:46:12 +01:00

47 lines
1.1 KiB
TypeScript

/* eslint-disable max-lines */
"use client";
import { useTranslation } from "react-i18next";
import { FaCopy } from "react-icons/fa";
import Button from "@/lib/components/ui/Button";
import Field from "@/lib/components/ui/Field";
import { useApiKeyConfig } from "./hooks/useApiKeyConfig";
export const ApiKeyConfig = (): JSX.Element => {
const {
apiKey,
handleCopyClick,
handleCreateClick,
} = useApiKeyConfig();
const { t } = useTranslation(["config"]);
return (
<>
<h3 className="font-semibold mb-2">Quivr {t("apiKey")}</h3>
<div>
{apiKey === "" ? (
<Button
data-testid="create-new-key"
variant="secondary"
onClick={() => void handleCreateClick()}
>
Create New Key
</Button>
) : (
<div className="flex items-center space-x-2">
<Field name="quivrApiKey" disabled={true} value={apiKey} />
<button data-testid="copy-api-key-button" onClick={handleCopyClick}>
<FaCopy />
</button>
</div>
)}
</div>
</>
);
};