import { useState } from "react"; import { TApiKeys } from "@calcom/ee/api-keys/components/ApiKeyListItem"; import LicenseRequired from "@calcom/ee/common/components/v2/LicenseRequired"; import ApiKeyDialogForm from "@calcom/features/ee/api-keys/components/ApiKeyDialogForm"; import ApiKeyListItem from "@calcom/features/ee/api-keys/components/ApiKeyListItem"; import { APP_NAME } from "@calcom/lib/constants"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { trpc } from "@calcom/trpc/react"; import { Button, Dialog, DialogContent, EmptyScreen, getSettingsLayout as getLayout, Icon, Meta, SkeletonLoader, } from "@calcom/ui"; const ApiKeysView = () => { const { t } = useLocale(); const { data, isLoading } = trpc.viewer.apiKeys.list.useQuery(); const [apiKeyModal, setApiKeyModal] = useState(false); const [apiKeyToEdit, setApiKeyToEdit] = useState<(TApiKeys & { neverExpires?: boolean }) | undefined>( undefined ); const NewApiKeyButton = () => { return ( { setApiKeyToEdit(undefined); setApiKeyModal(true); }}> {t("new_api_key")} ); }; return ( <> <> {isLoading && } {isLoading ? null : data?.length ? ( <> {data.map((apiKey, index) => ( { setApiKeyToEdit(apiKey); setApiKeyModal(true); }} /> ))} > ) : ( } /> )} > setApiKeyModal(false)} defaultValues={apiKeyToEdit} /> > ); }; ApiKeysView.getLayout = getLayout; export default ApiKeysView;