import React, { useState } from "react"; import { observer } from "mobx-react-lite"; import { useRouter } from "next/router"; import { AlertTriangle } from "lucide-react"; import { Dialog, Transition } from "@headlessui/react"; // types import { IUserLite } from "@plane/types"; // ui import { Button } from "@plane/ui"; // hooks import { useProject, useUser } from "@/hooks/store"; type Props = { data: IUserLite; onSubmit: () => Promise; isOpen: boolean; onClose: () => void; }; export const ConfirmProjectMemberRemove: React.FC = observer((props) => { const { data, onSubmit, isOpen, onClose } = props; // router const router = useRouter(); const { projectId } = router.query; // states const [isDeleteLoading, setIsDeleteLoading] = useState(false); // store hooks const { currentUser } = useUser(); const { getProjectById } = useProject(); const handleClose = () => { onClose(); setIsDeleteLoading(false); }; const handleDeletion = async () => { setIsDeleteLoading(true); await onSubmit(); handleClose(); }; if (!projectId) return <>; const isCurrentUser = currentUser?.id === data?.id; const currentProjectDetails = getProjectById(projectId.toString()); return (
{isCurrentUser ? "Leave project?" : `Remove ${data?.display_name}?`}

{isCurrentUser ? ( <> Are you sure you want to leave the{" "} {currentProjectDetails?.name} project? You will be able to join the project if invited again or if it{"'"}s public. ) : ( <> Are you sure you want to remove member-{" "} {data?.display_name}? They will no longer have access to this project. This action cannot be undone. )}

); });