Bug solved with the Practice Modal
This commit is contained in:
@@ -25,6 +25,7 @@ import ProgressButtons from "../components/ProgressButtons";
|
||||
import useExamNavigation from "../Navigation/useExamNavigation";
|
||||
import { calculateExerciseIndex } from "../utils/calculateExerciseIndex";
|
||||
import { defaultExamUserSolutions } from "@/utils/exams";
|
||||
import PracticeModal from "@/components/PracticeModal";
|
||||
|
||||
|
||||
const Level: React.FC<ExamProps<LevelExam>> = ({ exam, showSolutions = false, preview = false }) => {
|
||||
@@ -66,6 +67,12 @@ const Level: React.FC<ExamProps<LevelExam>> = ({ exam, showSolutions = false, pr
|
||||
const [continueAnyways, setContinueAnyways] = useState(false);
|
||||
const [textRender, setTextRender] = useState(false);
|
||||
|
||||
const hasPractice = useMemo(() => {
|
||||
if (partIndex > -1 && partIndex < exam.parts.length) {
|
||||
return exam.parts[partIndex].exercises.some(e => e.isPractice)
|
||||
}
|
||||
return false
|
||||
}, [partIndex, exam.parts])
|
||||
|
||||
const [questionModalKwargs, setQuestionModalKwargs] = useState<{
|
||||
type?: "module" | "blankQuestions" | "submit"; unanswered?: boolean | undefined; onClose: (next?: boolean) => void | undefined;
|
||||
@@ -337,6 +344,7 @@ const Level: React.FC<ExamProps<LevelExam>> = ({ exam, showSolutions = false, pr
|
||||
return (
|
||||
<>
|
||||
<div className={clsx("flex flex-col h-full w-full gap-8 items-center", showPartDivider && "justify-center")}>
|
||||
<PracticeModal key={partIndex} open={hasPractice} />
|
||||
<Modal
|
||||
className={"!w-2/6 !p-8"}
|
||||
titleClassName={"font-bold text-3xl text-mti-rose-light"}
|
||||
@@ -361,7 +369,7 @@ const Level: React.FC<ExamProps<LevelExam>> = ({ exam, showSolutions = false, pr
|
||||
(!showPartDivider && !startNow) &&
|
||||
<Timer minTimer={exam.minTimer} disableTimer={showSolutions || preview} standalone={true} />
|
||||
}
|
||||
{(showPartDivider || (startNow && partIndex === 0)) ?
|
||||
{(showPartDivider || (startNow && partIndex === 0)) ?
|
||||
<PartDivider
|
||||
module="level"
|
||||
sectionLabel="Part"
|
||||
|
||||
Reference in New Issue
Block a user