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 useExamNavigation from "../Navigation/useExamNavigation";
|
||||||
import { calculateExerciseIndex } from "../utils/calculateExerciseIndex";
|
import { calculateExerciseIndex } from "../utils/calculateExerciseIndex";
|
||||||
import { defaultExamUserSolutions } from "@/utils/exams";
|
import { defaultExamUserSolutions } from "@/utils/exams";
|
||||||
|
import PracticeModal from "@/components/PracticeModal";
|
||||||
|
|
||||||
|
|
||||||
const Level: React.FC<ExamProps<LevelExam>> = ({ exam, showSolutions = false, preview = false }) => {
|
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 [continueAnyways, setContinueAnyways] = useState(false);
|
||||||
const [textRender, setTextRender] = 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<{
|
const [questionModalKwargs, setQuestionModalKwargs] = useState<{
|
||||||
type?: "module" | "blankQuestions" | "submit"; unanswered?: boolean | undefined; onClose: (next?: boolean) => void | undefined;
|
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 (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className={clsx("flex flex-col h-full w-full gap-8 items-center", showPartDivider && "justify-center")}>
|
<div className={clsx("flex flex-col h-full w-full gap-8 items-center", showPartDivider && "justify-center")}>
|
||||||
|
<PracticeModal key={partIndex} open={hasPractice} />
|
||||||
<Modal
|
<Modal
|
||||||
className={"!w-2/6 !p-8"}
|
className={"!w-2/6 !p-8"}
|
||||||
titleClassName={"font-bold text-3xl text-mti-rose-light"}
|
titleClassName={"font-bold text-3xl text-mti-rose-light"}
|
||||||
|
|||||||
Reference in New Issue
Block a user