import { useState, Fragment } from "react"; import { useRouter } from "next/navigation"; import { Transition, Dialog } from "@headlessui/react"; import type { IProject } from "@plane/types"; // hooks import { Button } from "@plane/ui"; import { useProject, useUser } from "@/hooks/store"; // ui // types // type type TJoinProjectModalProps = { isOpen: boolean; workspaceSlug: string; project: IProject; handleClose: () => void; }; export const JoinProjectModal: React.FC = (props) => { const { handleClose, isOpen, project, workspaceSlug } = props; // states const [isJoiningLoading, setIsJoiningLoading] = useState(false); // store hooks const { membership: { joinProject }, } = useUser(); const { fetchProjects } = useProject(); // router const router = useRouter(); const handleJoin = () => { setIsJoiningLoading(true); joinProject(workspaceSlug, [project.id]) .then(() => { router.push(`/${workspaceSlug}/projects/${project.id}/issues`); fetchProjects(workspaceSlug); handleClose(); }) .finally(() => { setIsJoiningLoading(false); }); }; return (
Join Project?

Are you sure you want to join the project{" "} {project?.name}? Please click the 'Join Project' button below to continue.

); };