import { GetServerSidePropsContext } from "next"; import { useState } from "react"; import { getLayout } from "@calcom/features/settings/layouts/SettingsLayout"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { trpc } from "@calcom/trpc/react"; import { Button, Dialog, DialogClose, DialogContent, DialogFooter, Dropdown, DropdownMenuContent, DropdownMenuItem, DropdownItem, DropdownMenuTrigger, Icon, List, ListItem, ListItemText, ListItemTitle, Meta, showToast, SkeletonContainer, SkeletonText, } from "@calcom/ui"; import { ssrInit } from "@server/lib/ssr"; const SkeletonLoader = ({ title, description }: { title: string; description: string }) => { return ( ); }; const ConferencingLayout = () => { const { t } = useLocale(); const utils = trpc.useContext(); const { data: apps, isLoading } = trpc.viewer.integrations.useQuery( { variant: "conferencing", onlyInstalled: true }, { suspense: true, } ); const deleteAppMutation = trpc.viewer.deleteCredential.useMutation({ onSuccess: () => { showToast("Integration deleted successfully", "success"); utils.viewer.integrations.invalidate({ 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 })}> {t("yes_remove_app")} ); }; ConferencingLayout.getLayout = getLayout; export const getServerSideProps = async (context: GetServerSidePropsContext) => { const ssr = await ssrInit(context); return { props: { trpcState: ssr.dehydrate(), }, }; }; export default ConferencingLayout;