From be4d2de76f351e346c6339c3a24d85c818ded800 Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Wed, 14 Feb 2024 11:31:35 +0000 Subject: [PATCH] Updated the module title to keep in mind the previous time spent --- src/components/Medium/ModuleTitle.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/Medium/ModuleTitle.tsx b/src/components/Medium/ModuleTitle.tsx index d9eb6df5..15d6b222 100644 --- a/src/components/Medium/ModuleTitle.tsx +++ b/src/components/Medium/ModuleTitle.tsx @@ -21,7 +21,11 @@ export default function ModuleTitle({minTimer, module, label, exerciseIndex, tot const [timer, setTimer] = useState(minTimer * 60); const [showModal, setShowModal] = useState(false); const [warningMode, setWarningMode] = useState(false); + const setHasExamEnded = useExamStore((state) => state.setHasExamEnded); + const {timeSpent} = useExamStore((state) => state); + + useEffect(() => setTimer((prev) => prev - timeSpent), [timeSpent]); useEffect(() => { if (!disableTimer) {