From 408cfbb500834f3cdb2278fce933d07b3efc4883 Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Mon, 23 Dec 2024 15:11:20 +0000 Subject: [PATCH] Bug solved with the Practice Modal --- src/exams/Level/index.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/exams/Level/index.tsx b/src/exams/Level/index.tsx index bfd8d739..eb535c80 100644 --- a/src/exams/Level/index.tsx +++ b/src/exams/Level/index.tsx @@ -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> = ({ exam, showSolutions = false, preview = false }) => { @@ -66,6 +67,12 @@ const Level: React.FC> = ({ 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> = ({ exam, showSolutions = false, pr return ( <>
+ > = ({ exam, showSolutions = false, pr (!showPartDivider && !startNow) && } - {(showPartDivider || (startNow && partIndex === 0)) ? + {(showPartDivider || (startNow && partIndex === 0)) ?