Reverted Level to only utas placement test exercises, Speaking, bug fixes, placeholder
This commit is contained in:
@@ -1,20 +1,26 @@
|
||||
import defaultModuleSettings from "../defaults";
|
||||
import ExamEditorStore from "../types";
|
||||
import { MODULE_ACTIONS, ModuleActions, moduleReducer } from "./moduleReducer";
|
||||
import { SECTION_ACTIONS, SectionActions, sectionReducer } from "./sectionReducer";
|
||||
|
||||
type UpdateRoot = {
|
||||
type: 'UPDATE_ROOT';
|
||||
payload: {
|
||||
updates: Partial<ExamEditorStore>
|
||||
}
|
||||
};
|
||||
type FullReset = { type: 'FULL_RESET' };
|
||||
|
||||
export type Action = ModuleActions | SectionActions | { type: 'UPDATE_ROOT'; payload: { updates: Partial<ExamEditorStore> } };
|
||||
export type Action = ModuleActions | SectionActions | UpdateRoot | FullReset;
|
||||
|
||||
export const rootReducer = (
|
||||
state: ExamEditorStore,
|
||||
action: Action
|
||||
): Partial<ExamEditorStore> => {
|
||||
console.log(action.type);
|
||||
|
||||
if (MODULE_ACTIONS.includes(action.type as any)) {
|
||||
if (action.type === "REORDER_EXERCISES") {
|
||||
const updatedState = sectionReducer(state, action as SectionActions);
|
||||
if (!updatedState.modules) return state;
|
||||
if (!updatedState.modules) return state;
|
||||
|
||||
return moduleReducer({
|
||||
...state,
|
||||
@@ -45,6 +51,19 @@ export const rootReducer = (
|
||||
...state,
|
||||
...updates
|
||||
};
|
||||
case 'FULL_RESET':
|
||||
return {
|
||||
title: "",
|
||||
currentModule: "reading",
|
||||
speakingAvatars: [],
|
||||
modules: {
|
||||
reading: defaultModuleSettings("reading", 60),
|
||||
writing: defaultModuleSettings("writing", 60),
|
||||
speaking: defaultModuleSettings("speaking", 14),
|
||||
listening: defaultModuleSettings("listening", 30),
|
||||
level: defaultModuleSettings("level", 60)
|
||||
},
|
||||
}
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user