Part and MC question grid jump to, has a bug on next going to refactor the whole thing

This commit is contained in:
Carlos Mesquita
2024-08-23 21:17:32 +01:00
parent b4b078c8c9
commit f0f38b335f
9 changed files with 339 additions and 114 deletions

View File

@@ -20,6 +20,7 @@ export interface ExamState {
inactivity: number;
shuffles: Shuffles[];
bgColor: string;
currentSolution?: UserSolution | undefined;
}
export interface ExamFunctions {
@@ -39,6 +40,7 @@ export interface ExamFunctions {
setInactivity: (inactivity: number) => void;
setShuffles: (shuffles: Shuffles[]) => void;
setBgColor: (bgColor: string) => void;
setCurrentSolution: (currentSolution: UserSolution | undefined) => void;
reset: () => void;
}
@@ -58,7 +60,8 @@ export const initialState: ExamState = {
questionIndex: 0,
inactivity: 0,
shuffles: [],
bgColor: "bg-white"
bgColor: "bg-white",
currentSolution: undefined
};
const useExamStore = create<ExamState & ExamFunctions>((set) => ({
@@ -80,6 +83,7 @@ const useExamStore = create<ExamState & ExamFunctions>((set) => ({
setInactivity: (inactivity: number) => set(() => ({inactivity})),
setShuffles: (shuffles: Shuffles[]) => set(() => ({shuffles})),
setBgColor: (bgColor) => set(() => ({bgColor})),
setCurrentSolution: (currentSolution: UserSolution | undefined) => set(() => ({currentSolution})),
reset: () => set(() => initialState),
}));