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"; export default 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 ( ( <>

{t("api_keys")}

{t("api_keys_subtitle")}

{data.length > 0 && ( {data.map((item: any) => ( { 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} /> )} )} /> ); }