import { Dialog, Transition } from "@headlessui/react"; import { Fragment, useEffect, useState } from "react"; import Button from "./Low/Button"; interface Props { isOpen: boolean; type?: "module" | "blankQuestions" | "submit"; unanswered?: boolean; onClose: (next?: boolean) => void; } export default function QuestionsModal({ isOpen, onClose, type = "module", unanswered = false }: Props) { const [isClosing, setIsClosing] = useState(false); const blockMultipleClicksClose = (x: boolean) => { if (!isClosing) { setIsClosing(true); onClose(x); } setTimeout(() => { setIsClosing(false); }, 400); } return ( onClose(false)} className="relative z-50">
{type === "module" && ( <> Questions Unanswered Please note that you are finishing the current module and once you proceed to the next module, you will no longer be able to change the answers of the current one, including your unanswered questions.

Are you sure you want to continue without completing those questions?
)} {type === "blankQuestions" && ( <> Questions Unanswered

You have left some questions unanswered in the current part.

If you wish to continue, you can still access this part later using the navigation bar at the top or the "Back" button.

Do you want to proceed to the next part, or would you like to go back and complete the unanswered questions in the current part?

)} {type === "submit" && ( <> Confirm Submission {unanswered ? ( <> By clicking "Submit", you are finalizing your exam with some questions left unanswered. Once you submit, you will not be able to review or change any of your answers, including the unanswered ones.

Are you sure you want to submit and complete the exam with unanswered questions? ) : ( <> By clicking "Submit", you are finalizing your exam. Once you submit, you will not be able to review or change any of your answers.

Are you sure you want to submit and complete the exam? )}
)}
); }