UNPKG

byokay-kit

Version:

Byokay Kit lets users bring their own AI API keys and store them securely in their browser. This eliminates the need for your app to manage sensitive credentials or maintain AI API backend infrastructure.

17 lines (16 loc) 1.96 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; // src/ui/components/KeyManagerContent.tsx import { useState } from "react"; import { ProviderList } from "./ProviderList"; import { ClearAllSection } from "./ClearAllSection"; export function KeyManagerContent({ providers, providerNames, keys, saved, validating, validated, validationMessages, isUnverifiedDueToCors, onKeyChange, onValidate, onClear, onClearAll, }) { const [confirmingClearAll, setConfirmingClearAll] = useState(false); const hasAnyEnteredKeys = Object.values(keys).some((key) => Boolean(key)); const handleStartClearAll = () => setConfirmingClearAll(true); const handleCancelClearAll = () => setConfirmingClearAll(false); const handleConfirmClearAllAndReset = () => { onClearAll(); setConfirmingClearAll(false); }; return (_jsxs("div", { className: "flex flex-col h-full text-gray-800", children: [_jsx("div", { className: "flex-grow overflow-y-auto p-4", children: _jsx(ProviderList, { providers: providers, providerNames: providerNames, keys: keys, saved: saved, validating: validating, validated: validated, validationMessages: validationMessages, isUnverifiedDueToCors: isUnverifiedDueToCors, onKeyChange: onKeyChange, onValidate: onValidate, onClear: onClear }) }), _jsx("div", { className: "shrink-0 px-4 py-3 border-t border-gray-200", children: _jsxs("div", { className: "flex justify-between items-center", children: [_jsx("div", { children: _jsx(ClearAllSection, { hasKeys: hasAnyEnteredKeys, isConfirming: confirmingClearAll, onStartClear: handleStartClearAll, onConfirmClear: handleConfirmClearAllAndReset, onCancelClear: handleCancelClearAll }) }), _jsx("div", { className: "text-xs text-gray-400", children: _jsx("a", { href: "https://github.com/byokay/byokay-kit", target: "_blank", rel: "noopener noreferrer", className: "hover:text-gray-600 transition-colors", children: "Powered by Byokay" }) })] }) })] })); }