import React, { useState } from "react"; // headless ui import { Transition, Dialog } from "@headlessui/react"; // ui import { PrimaryButton, SecondaryButton } from "components/ui"; // types import type { IProject } from "types"; // type type TJoinProjectModalProps = { data?: IProject; onClose: () => void; onJoin: () => Promise; }; export const JoinProjectModal: React.FC = ({ onClose, onJoin, data }) => { const [isJoiningLoading, setIsJoiningLoading] = useState(false); const handleJoin = () => { setIsJoiningLoading(true); onJoin() .then(() => { setIsJoiningLoading(false); handleClose(); }) .catch(() => { setIsJoiningLoading(false); }); }; const handleClose = () => { onClose(); }; return (
Join Project?

Are you sure you want to join{" "} {data?.name}?

Cancel {isJoiningLoading ? "Joining..." : "Join Project"}
); };