import { useState, Fragment } from "react"; import { useRouter } from "next/router"; import { Transition, Dialog } from "@headlessui/react"; // hooks import { useProject, useUser } from "hooks/store"; // ui import { Button } from "@plane/ui"; // types import type { IProject } from "@plane/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.

); };