import { Fragment, useState } from "react"; // next import { useRouter } from "next/router"; import { Dialog, Transition } from "@headlessui/react"; import { observer } from "mobx-react-lite"; import { AlertTriangle } from "lucide-react"; // components import { Button } from "@plane/ui"; // hooks import useToast from "hooks/use-toast"; // types import { ICycle } from "types"; // mobx store import { useMobxStore } from "lib/mobx/store-provider"; interface ICycleDelete { cycle: ICycle; isOpen: boolean; handleClose: () => void; workspaceSlug: string; projectId: string; } export const CycleDeleteModal: React.FC = observer((props) => { const { isOpen, handleClose, cycle, workspaceSlug, projectId } = props; // store const { cycle: cycleStore } = useMobxStore(); // toast const { setToastAlert } = useToast(); // states const [loader, setLoader] = useState(false); const router = useRouter(); const { cycleId } = router.query; const formSubmit = async () => { setLoader(true); if (cycle?.id) try { await cycleStore.removeCycle(workspaceSlug, projectId, cycle?.id); setToastAlert({ type: "success", title: "Success!", message: "Cycle deleted successfully.", }); if (cycleId) router.replace(`/${workspaceSlug}/projects/${projectId}/cycles`); handleClose(); } catch (error) { setToastAlert({ type: "error", title: "Warning!", message: "Something went wrong please try again later.", }); } else setToastAlert({ type: "error", title: "Warning!", message: "Something went wrong please try again later.", }); setLoader(false); }; return (
Delete Cycle

Are you sure you want to delete cycle{' "'} {cycle?.name} {'"'}? All of the data related to the cycle will be permanently removed. This action cannot be undone.

); });