ENCOA-260, ENCOA-259
This commit is contained in:
@@ -15,6 +15,7 @@ export const defaultSettings = (module: Module) => {
|
||||
isCategoryDropdownOpen: false,
|
||||
isIntroDropdownOpen: false,
|
||||
isExerciseDropdownOpen: false,
|
||||
isTypeDropdownOpen: false,
|
||||
}
|
||||
|
||||
switch (module) {
|
||||
@@ -163,6 +164,9 @@ const defaultModuleSettings = (module: Module, minTimer: number): ModuleState =>
|
||||
importing: false,
|
||||
edit: [],
|
||||
};
|
||||
if (["reading", "writing"].includes(module)) {
|
||||
state["type"] = "general";
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,15 +7,12 @@ import { Module } from "@/interfaces";
|
||||
import { updateExamWithUserSolutions } from "@/stores/exam/utils";
|
||||
import { defaultExamUserSolutions } from "@/utils/exams";
|
||||
|
||||
type UpdateRoot = {
|
||||
type: 'UPDATE_ROOT';
|
||||
payload: {
|
||||
updates: Partial<ExamEditorStore>
|
||||
}
|
||||
};
|
||||
type RootActions = { type: 'FULL_RESET' } | { type: "INIT_EXAM_EDIT", payload: { exam: Exam; examModule: Module; id: string } };
|
||||
type RootActions = { type: 'FULL_RESET' } |
|
||||
{ type: 'INIT_EXAM_EDIT', payload: { exam: Exam; examModule: Module; id: string } } |
|
||||
{ type: 'UPDATE_ROOT'; payload: { updates: Partial<ExamEditorStore> } } |
|
||||
{ type: 'RESET_MODULE'; payload: { module: Module } };
|
||||
|
||||
export type Action = ModuleActions | SectionActions | UpdateRoot | RootActions;
|
||||
export type Action = ModuleActions | SectionActions | RootActions;
|
||||
|
||||
export const rootReducer = (
|
||||
state: ExamEditorStore,
|
||||
@@ -55,6 +52,16 @@ export const rootReducer = (
|
||||
...state,
|
||||
...updates
|
||||
};
|
||||
case 'RESET_MODULE':
|
||||
const { module } = action.payload;
|
||||
const timer = ["reading", "writing", "level"].includes(module) ?
|
||||
60 : (module === "speaking" ? 14 : 30);
|
||||
return {
|
||||
modules: {
|
||||
...state.modules,
|
||||
[module]: defaultModuleSettings(module, timer),
|
||||
},
|
||||
};
|
||||
case 'FULL_RESET':
|
||||
return {
|
||||
title: "",
|
||||
|
||||
@@ -16,6 +16,7 @@ export interface SectionSettings {
|
||||
currentIntro: string | undefined;
|
||||
isCategoryDropdownOpen: boolean;
|
||||
isIntroDropdownOpen: boolean;
|
||||
isTypeDropdownOpen: boolean;
|
||||
}
|
||||
|
||||
export interface SpeakingSectionSettings extends SectionSettings {
|
||||
@@ -114,6 +115,7 @@ export interface ModuleState {
|
||||
importModule: boolean;
|
||||
importing: boolean;
|
||||
edit: number[];
|
||||
type?: "general" | "academic";
|
||||
}
|
||||
|
||||
export interface Avatar {
|
||||
|
||||
Reference in New Issue
Block a user