ENCOA-298
This commit is contained in:
@@ -67,13 +67,6 @@ 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;
|
||||||
}>({
|
}>({
|
||||||
@@ -108,6 +101,14 @@ const Level: React.FC<ExamProps<LevelExam>> = ({ exam, showSolutions = false, pr
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const hasPractice = useMemo(() => {
|
||||||
|
if (partIndex > -1 && partIndex < exam.parts.length && !showPartDivider) {
|
||||||
|
console.log(exam.parts[partIndex].exercises.some(e => e.isPractice))
|
||||||
|
return exam.parts[partIndex].exercises.some(e => e.isPractice)
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}, [partIndex, showPartDivider, exam.parts])
|
||||||
|
|
||||||
const registerSolution = useCallback((updateSolution: () => UserSolution) => {
|
const registerSolution = useCallback((updateSolution: () => UserSolution) => {
|
||||||
userSolutionRef.current = updateSolution;
|
userSolutionRef.current = updateSolution;
|
||||||
setSolutionWasUpdated(true);
|
setSolutionWasUpdated(true);
|
||||||
@@ -344,7 +345,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} />
|
<PracticeModal key={`${partIndex}_${showPartDivider}`} 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