Shuffles fixed

This commit is contained in:
Carlos Mesquita
2024-08-22 22:02:37 +01:00
parent c37a1becbf
commit 1315e0b280
10 changed files with 265 additions and 205 deletions

View File

@@ -1,5 +1,5 @@
import {Module} from "@/interfaces";
import {Exam, ShuffleMap, UserSolution} from "@/interfaces/exam";
import {Exam, ShuffleMap, Shuffles, UserSolution} from "@/interfaces/exam";
import {Assignment} from "@/interfaces/results";
import {create} from "zustand";
@@ -18,7 +18,7 @@ export interface ExamState {
exerciseIndex: number;
questionIndex: number;
inactivity: number;
shuffleMaps: ShuffleMap[];
shuffles: Shuffles[];
bgColor: string;
}
@@ -37,7 +37,7 @@ export interface ExamFunctions {
setExerciseIndex: (exerciseIndex: number) => void;
setQuestionIndex: (questionIndex: number) => void;
setInactivity: (inactivity: number) => void;
setShuffleMaps: (shuffleMaps: ShuffleMap[]) => void;
setShuffles: (shuffles: Shuffles[]) => void;
setBgColor: (bgColor: string) => void;
reset: () => void;
}
@@ -57,7 +57,7 @@ export const initialState: ExamState = {
exerciseIndex: -1,
questionIndex: 0,
inactivity: 0,
shuffleMaps: [],
shuffles: [],
bgColor: "bg-white"
};
@@ -78,8 +78,8 @@ const useExamStore = create<ExamState & ExamFunctions>((set) => ({
setExerciseIndex: (exerciseIndex: number) => set(() => ({exerciseIndex})),
setQuestionIndex: (questionIndex: number) => set(() => ({questionIndex})),
setInactivity: (inactivity: number) => set(() => ({inactivity})),
setShuffleMaps: (shuffleMaps) => set(() => ({shuffleMaps})),
setBgColor: (bgColor) => set(()=> ({bgColor})),
setShuffles: (shuffles: Shuffles[]) => set(() => ({shuffles})),
setBgColor: (bgColor) => set(() => ({bgColor})),
reset: () => set(() => initialState),
}));