Fixed some navigation issues and updated Listening
This commit is contained in:
@@ -34,20 +34,20 @@ const Reading: React.FC<ExamProps<ReadingExam>> = ({ exam, showSolutions = false
|
||||
exerciseIndex, partIndex, questionIndex,
|
||||
userSolutions, flags, timeSpentCurrentModule,
|
||||
setBgColor, setUserSolutions, setTimeIsUp,
|
||||
dispatch
|
||||
dispatch,
|
||||
} = !preview ? examState : persistentExamState;
|
||||
|
||||
|
||||
const timer = useRef(exam.minTimer - timeSpentCurrentModule / 60);
|
||||
|
||||
const { finalizeModule, timeIsUp } = flags;
|
||||
const [isFirstTimeRender, setIsFirstTimeRender] = useState(partIndex === 0 && exerciseIndex == 0 && !showSolutions);
|
||||
|
||||
const {
|
||||
nextExercise, previousExercise,
|
||||
showPartDivider, setShowPartDivider,
|
||||
seenParts, setSeenParts,
|
||||
isBetweenParts, setIsBetweenParts
|
||||
isBetweenParts, setIsBetweenParts,
|
||||
startNow
|
||||
} = useExamNavigation({ exam, module: "reading", showBlankModal, setShowBlankModal, showSolutions, preview, disableBetweenParts: showSolutions });
|
||||
|
||||
useEffect(() => {
|
||||
@@ -118,7 +118,6 @@ const Reading: React.FC<ExamProps<ReadingExam>> = ({ exam, showSolutions = false
|
||||
setShowPartDivider(false);
|
||||
setBgColor("bg-white");
|
||||
setSeenParts((prev) => new Set(prev).add(partIndex));
|
||||
if (isFirstTimeRender) setIsFirstTimeRender(false);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
@@ -171,7 +170,7 @@ const Reading: React.FC<ExamProps<ReadingExam>> = ({ exam, showSolutions = false
|
||||
<div
|
||||
className={clsx(
|
||||
"mb-20 w-full",
|
||||
((isFirstTimeRender || isBetweenParts) && !showSolutions) ? "flex flex-col gap-2" : "grid grid-cols-2 gap-4",
|
||||
((startNow || isBetweenParts) && !showSolutions) ? "flex flex-col gap-2" : "grid grid-cols-2 gap-4",
|
||||
)}>
|
||||
<ReadingPassage
|
||||
exam={exam}
|
||||
@@ -180,7 +179,7 @@ const Reading: React.FC<ExamProps<ReadingExam>> = ({ exam, showSolutions = false
|
||||
isTextMinimized={isTextMinimized}
|
||||
setIsTextMinimized={setIsTextMinimzed}
|
||||
/>
|
||||
{!isFirstTimeRender && !showPartDivider && !showSolutions && !isBetweenParts && renderExercise(currentExercise, exam.id, registerSolution, preview, progressButtons, progressButtons)}
|
||||
{!startNow && !showPartDivider && !showSolutions && !isBetweenParts && renderExercise(currentExercise, exam.id, registerSolution, preview, progressButtons, progressButtons)}
|
||||
{showSolutions && renderSolution(currentExercise, progressButtons, progressButtons)}
|
||||
</div>
|
||||
{/*exerciseIndex > -1 && partIndex > -1 && exerciseIndex < exam.parts[partIndex].exercises.length && (
|
||||
@@ -193,12 +192,12 @@ const Reading: React.FC<ExamProps<ReadingExam>> = ({ exam, showSolutions = false
|
||||
</Button>
|
||||
)*/}
|
||||
</div>
|
||||
{((isFirstTimeRender || isBetweenParts) && !showPartDivider && !showSolutions) &&
|
||||
{((startNow || isBetweenParts) && !showPartDivider && !showSolutions) &&
|
||||
<ProgressButtons
|
||||
hidePrevious={partIndex == 0 && isBetweenParts || isFirstTimeRender}
|
||||
nextLabel={isFirstTimeRender ? "Start now" : "Next Page"}
|
||||
hidePrevious={partIndex == 0 && isBetweenParts || startNow}
|
||||
nextLabel={startNow ? "Start now" : "Next Page"}
|
||||
handlePrevious={previousExercise}
|
||||
handleNext={() => isFirstTimeRender ? setIsFirstTimeRender(false) : nextExercise()} />
|
||||
handleNext={() => nextExercise()} />
|
||||
}
|
||||
</>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user