import { PlusIcon } from "@heroicons/react/outline"; import { useState } from "react"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import Button from "@calcom/ui/Button"; import { Dialog, DialogContent } from "@calcom/ui/Dialog"; import ApiKeyDialogForm from "@ee/components/apiKeys/ApiKeyDialogForm"; import ApiKeyListItem, { TApiKeys } from "@ee/components/apiKeys/ApiKeyListItem"; import { QueryCell } from "@lib/QueryCell"; import { trpc } from "@lib/trpc"; import { List } from "@components/List"; import { ShellSubHeading } from "@components/Shell"; import SkeletonLoader from "@components/apps/SkeletonLoader"; import LicenseRequired from "../LicenseRequired"; function ApiKeyListContainer() { const { t } = useLocale(); const query = trpc.useQuery(["viewer.apiKeys.list"]); const [newApiKeyModal, setNewApiKeyModal] = useState(false); const [editModalOpen, setEditModalOpen] = useState(false); const [apiKeyToEdit, setApiKeyToEdit] = useState<(TApiKeys & { neverExpires?: boolean }) | null>(null); return (
setNewApiKeyModal(true)} /> } /> } success={({ data }) => ( <> {data.length > 0 && ( {data.map((item) => ( { setApiKeyToEdit(item); setEditModalOpen(true); }} /> ))} )} {/* New api key dialog */} !isOpen && setNewApiKeyModal(false)}> setNewApiKeyModal(false)} /> {/* Edit api key dialog */} !isOpen && setEditModalOpen(false)}> {apiKeyToEdit && ( setEditModalOpen(false)} defaultValues={apiKeyToEdit} /> )} )} />
); } export default ApiKeyListContainer;