import { FC } from "react"; import Link from "next/link"; import { useRouter } from "next/router"; import { IWebhook } from "@plane/types"; // hooks import { ToggleSwitch } from "@plane/ui"; // constants import { WEBHOOK_DISABLED, WEBHOOK_ENABLED } from "@/constants/event-tracker"; import { useWebhook, useEventTracker } from "@/hooks/store"; // ui // types interface IWebhookListItem { webhook: IWebhook; } export const WebhooksListItem: FC = (props) => { const { webhook } = props; // router const router = useRouter(); const { workspaceSlug } = router.query; // store hooks const { updateWebhook } = useWebhook(); const { captureEvent } = useEventTracker(); const handleToggle = () => { if (!workspaceSlug || !webhook.id) return; updateWebhook(workspaceSlug.toString(), webhook.id, { is_active: !webhook.is_active }).then(() => captureEvent(!webhook.is_active ? WEBHOOK_ENABLED : WEBHOOK_DISABLED, { webhook_id: webhook.id, }) ); }; return (
{webhook.url}
); };