import { useState } from "react"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { trpc } from "@calcom/trpc/react"; import { Icon } from "@calcom/ui"; import { Dropdown, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, Button } from "@calcom/ui/v2"; import { Dialog, DialogContent } from "@calcom/ui/v2/core/Dialog"; import Meta from "@calcom/ui/v2/core/Meta"; import { getLayout } from "@calcom/ui/v2/core/layouts/SettingsLayout"; import showToast from "@calcom/ui/v2/core/notifications"; import { SkeletonContainer, SkeletonText } from "@calcom/ui/v2/core/skeleton"; import { List, ListItem, ListItemText, ListItemTitle } from "@calcom/ui/v2/modules/List"; const SkeletonLoader = () => { return ( ); }; const ConferencingLayout = () => { const { t } = useLocale(); const utils = trpc.useContext(); const { data: apps, isLoading } = trpc.useQuery( ["viewer.integrations", { variant: "conferencing", onlyInstalled: true }], { suspense: true, } ); const deleteAppMutation = trpc.useMutation("viewer.deleteCredential", { onSuccess: () => { showToast("Integration deleted successfully", "success"); utils.invalidateQueries(["viewer.integrations", { variant: "conferencing", onlyInstalled: true }]); setDeleteAppModal(false); }, onError: () => { showToast("Error deleting app", "error"); setDeleteAppModal(false); }, }); const [deleteAppModal, setDeleteAppModal] = useState(false); const [deleteCredentialId, setDeleteCredentialId] = useState(0); if (isLoading) return ; return ( {apps?.items && apps.items .map((app) => ({ ...app, title: app.title || app.name })) .map((app) => ( { // eslint-disable-next-line @next/next/no-img-element app.logo && } {app.title} {app.description} { setDeleteCredentialId(app.credentialIds[0]); setDeleteAppModal(true); }}> {t("remove_app")} ))} deleteAppMutation.mutate({ id: deleteCredentialId })} /> ); }; ConferencingLayout.getLayout = getLayout; export default ConferencingLayout;