import React, { useState } from "react"; // types import type { TIssue } from "@plane/types"; // components import { AlertModalCore } from "@/components/core"; // hooks import { useProject } from "@/hooks/store"; type Props = { data: Partial; isOpen: boolean; onClose: () => void; onSubmit: () => Promise; }; export const DeclineIssueModal: React.FC = (props) => { const { isOpen, onClose, data, onSubmit } = props; // states const [isDeclining, setIsDeclining] = useState(false); // store hooks const { getProjectById } = useProject(); // derived values const projectDetails = data.project_id ? getProjectById(data?.project_id) : undefined; const handleClose = () => { setIsDeclining(false); onClose(); }; const handleDecline = async () => { setIsDeclining(true); await onSubmit().finally(() => setIsDeclining(false)); }; return ( {" "} Are you sure you want to decline issue{" "} {projectDetails?.identifier}-{data?.sequence_id} {""}? This action cannot be undone. } primaryButtonText={{ loading: "Declining", default: "Decline", }} /> ); };