import React from "react"; import { useTranslation } from "react-i18next"; import { I18nKey } from "#/i18n/declaration"; import { BrandButton } from "#/components/features/settings/brand-button"; import { CreateApiKeyResponse } from "#/api/api-keys"; import { displaySuccessToast } from "#/utils/custom-toast-handlers"; import { ApiKeyModalBase } from "./api-key-modal-base"; interface NewApiKeyModalProps { isOpen: boolean; newlyCreatedKey: CreateApiKeyResponse | null; onClose: () => void; } export function NewApiKeyModal({ isOpen, newlyCreatedKey, onClose, }: NewApiKeyModalProps) { const { t } = useTranslation(); const handleCopyToClipboard = () => { if (newlyCreatedKey) { navigator.clipboard.writeText(newlyCreatedKey.key); displaySuccessToast(t(I18nKey.SETTINGS$API_KEY_COPIED)); } }; if (!newlyCreatedKey) return null; const modalFooter = ( <> {t(I18nKey.BUTTON$COPY_TO_CLIPBOARD)} {t(I18nKey.BUTTON$CLOSE)} ); return (

{t(I18nKey.SETTINGS$API_KEY_WARNING)}

{newlyCreatedKey.key}
); }