import { PencilAltIcon, TrashIcon } from "@heroicons/react/outline"; import classNames from "@calcom/lib/classNames"; import Button from "@calcom/ui/Button"; import { Dialog, DialogTrigger } from "@calcom/ui/Dialog"; import { Tooltip } from "@calcom/ui/Tooltip"; import { useLocale } from "@lib/hooks/useLocale"; import { inferQueryOutput, trpc } from "@lib/trpc"; import { ListItem } from "@components/List"; import ConfirmationDialogContent from "@components/dialog/ConfirmationDialogContent"; export type TWebhook = inferQueryOutput<"viewer.webhook.list">[number]; export default function WebhookListItem(props: { webhook: TWebhook; onEditWebhook: () => void }) { const { t } = useLocale(); const utils = trpc.useContext(); const deleteWebhook = trpc.useMutation("viewer.webhook.delete", { async onSuccess() { await utils.invalidateQueries(["viewer.webhook.list"]); }, }); return (
{props.webhook.subscriberUrl}
{props.webhook.eventTriggers.map((eventTrigger, ind) => ( {t(`${eventTrigger.toLowerCase()}`)} ))}
deleteWebhook.mutate({ id: props.webhook.id, eventTypeId: props.webhook.eventTypeId || undefined, }) }> {t("delete_webhook_confirmation_message")}
); }