Made it so when the timer ends, the module ends

This commit is contained in:
Tiago Ribeiro
2023-07-27 13:59:00 +01:00
parent f5c3abb310
commit 77692d270e
16 changed files with 155 additions and 22 deletions

View File

@@ -1,13 +1,14 @@
import {Module} from "@/interfaces";
import {Exam, UserSolution} from "@/interfaces/exam";
import {Stat} from "@/interfaces/user";
import {create} from "zustand";
export interface ExamState {
exams: Exam[];
userSolutions: UserSolution[];
showSolutions: boolean;
hasExamEnded: boolean;
selectedModules: Module[];
setHasExamEnded: (hasExamEnded: boolean) => void;
setUserSolutions: (userSolutions: UserSolution[]) => void;
setExams: (exams: Exam[]) => void;
setShowSolutions: (showSolutions: boolean) => void;
@@ -20,6 +21,7 @@ export const initialState = {
userSolutions: [],
showSolutions: false,
selectedModules: [],
hasExamEnded: false,
};
const useExamStore = create<ExamState>((set) => ({
@@ -28,6 +30,7 @@ const useExamStore = create<ExamState>((set) => ({
setExams: (exams: Exam[]) => set(() => ({exams})),
setShowSolutions: (showSolutions: boolean) => set(() => ({showSolutions})),
setSelectedModules: (modules: Module[]) => set(() => ({selectedModules: modules})),
setHasExamEnded: (hasExamEnded: boolean) => set(() => ({hasExamEnded})),
reset: () => set(() => initialState),
}));