/** * Copyright (c) 2023-present Plane Software, Inc. and contributors * SPDX-License-Identifier: AGPL-3.0-only * See the LICENSE file for details. */ import { useState } from "react"; // types import { Button } from "@plane/propel/button"; import type { IProject } from "@plane/types"; // ui import { EModalPosition, EModalWidth, ModalCore } from "@plane/ui"; // hooks import { useUserPermissions } from "@/hooks/store/user"; import { useAppRouter } from "@/hooks/use-app-router"; // type type TJoinProjectModalProps = { isOpen: boolean; workspaceSlug: string; project: IProject; handleClose: () => void; }; export function JoinProjectModal(props: TJoinProjectModalProps) { const { handleClose, isOpen, project, workspaceSlug } = props; // states const [isJoiningLoading, setIsJoiningLoading] = useState(false); // store hooks const { joinProject } = useUserPermissions(); // router const router = useAppRouter(); const handleJoin = async () => { setIsJoiningLoading(true); await joinProject(workspaceSlug, project.id) .then(() => { router.push(`/${workspaceSlug}/projects/${project.id}/issues`); handleClose(); return; }) .catch(() => { console.error("Error joining project"); }) .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.

); }