import classNames from "classnames"; import Image from "next/image"; import { useState } from "react"; import Button from "@calcom/ui/Button"; import { Dialog, DialogContent } from "@calcom/ui/Dialog"; import { QueryCell } from "@lib/QueryCell"; import { useLocale } from "@lib/hooks/useLocale"; import { trpc } from "@lib/trpc"; import { List, ListItem, ListItemText, ListItemTitle } from "@components/List"; import { ShellSubHeading } from "@components/Shell"; import WebhookDialogForm from "@components/webhook/WebhookDialogForm"; import WebhookListItem, { TWebhook } from "@components/webhook/WebhookListItem"; export type WebhookListContainerType = { title: string; subtitle: string; eventTypeId?: number; }; export default function WebhookListContainer(props: WebhookListContainerType) { const { t } = useLocale(); const query = props.eventTypeId ? trpc.useQuery(["viewer.webhook.list", { eventTypeId: props.eventTypeId }], { suspense: true, }) : trpc.useQuery(["viewer.webhook.list"], { suspense: true, }); const [newWebhookModal, setNewWebhookModal] = useState(false); const [editModalOpen, setEditModalOpen] = useState(false); const [editing, setEditing] = useState(null); return ( ( <>
Webhooks
Webhooks {t("automation")}
{data.length ? ( {data.map((item) => ( { setEditing(item); setEditModalOpen(true); }} /> ))} ) : null} {/* New webhook dialog */} !isOpen && setNewWebhookModal(false)}> setNewWebhookModal(false)} /> {/* Edit webhook dialog */} !isOpen && setEditModalOpen(false)}> {editing && ( setEditModalOpen(false)} defaultValues={editing} /> )} )} /> ); }