More navigation bugs and fixed broken modal during transition

This commit is contained in:
Carlos-Mesquita
2024-11-26 15:46:20 +00:00
parent 1fc439cb25
commit efb153a33d
5 changed files with 75 additions and 31 deletions

View File

@@ -75,10 +75,10 @@ const useExamNavigation: UseExamNavigation = ({
// when navbar is used
useEffect(()=> {
if(startNow && partIndex !== 0) {
if(startNow && !showPartDivider && partIndex !== 0) {
setStartNow(false);
}
} , [partIndex, startNow])
} , [partIndex, startNow, showPartDivider])
useEffect(() => {
if (!showSolutions && hasDivider(exam, isPartExam ? partIndex : exerciseIndex) && !seenParts.has(partIndex)) {
@@ -161,8 +161,7 @@ const useExamNavigation: UseExamNavigation = ({
return;
}
console.log(modalBetweenParts);
if (modalBetweenParts && !answeredEveryQuestion(exam as PartExam, userSolutions) && !keepGoing && setShowBlankModal && !showSolutions && !preview) {
if (modalBetweenParts && !seenParts.has(partIndex + 1) && !answeredEveryQuestion(exam as PartExam, userSolutions) && !keepGoing && setShowBlankModal && !showSolutions && !preview) {
if (modalKwargs) modalKwargs();
setShowBlankModal(true);
return;
@@ -197,7 +196,7 @@ const useExamNavigation: UseExamNavigation = ({
const previousPartExam = () => {
if (partIndex === 0 && exerciseIndex === 0 && !startNow) {
if (!showPartDivider && partIndex === 0 && exerciseIndex === 0 && questionIndex === 0 && !startNow) {
setStartNow(true);
return;
}