ENCOA-228 Now when user navigates between modules the generation items persist. Reading, listening and writing added to level module

This commit is contained in:
Carlos-Mesquita
2024-11-12 14:17:54 +00:00
parent 696c968ebc
commit fdf411d133
66 changed files with 2546 additions and 1635 deletions

View File

@@ -1,5 +1,5 @@
import { Module } from "@/interfaces"
import { Difficulty} from "@/interfaces/exam"
import { Difficulty } from "@/interfaces/exam"
import { sample } from "lodash"
import { ExamPart, ModuleState, SectionState } from "./types"
import { levelPart, listeningSection, readingPart, speakingTask, writingTask } from "@/stores/examEditor/sections"
@@ -18,21 +18,59 @@ const defaultSettings = (module: Module) => {
}
switch (module) {
case 'writing':
return {
...baseSettings,
writingTopic: '',
isWritingTopicOpen: false
}
case 'reading':
return {
...baseSettings,
isPassageOpen: false,
readingTopic: '',
isReadingTopicOpean: false,
}
case 'listening':
case 'listening':
return {
...baseSettings,
isAudioContextOpen: false,
isAudioGenerationOpen: false,
listeningTopic: '',
isListeningTopicOpen: false,
}
case 'speaking':
return {
...baseSettings,
isGenerateAudioOpen: false
speakingTopic: '',
speakingSecondTopic: '',
isSpeakingTopicOpen: false,
isGenerateVideoOpen: false,
}
case 'level':
return {
...baseSettings,
isReadingDropdownOpen: false,
isWritingDropdownOpen: false,
isSpeakingDropdownOpen: false,
isListeningDropdownOpen: false,
isWritingTopicOpen: false,
writingTopic: '',
isPassageOpen: false,
readingTopic: '',
isReadingTopicOpean: false,
isAudioContextOpen: false,
isAudioGenerationOpen: false,
listeningTopic: '',
isListeningTopicOpen: false,
speakingTopic: '',
speakingSecondTopic: '',
isSpeakingTopicOpen: false,
isGenerateVideoOpen: false,
}
default:
return baseSettings;
@@ -47,16 +85,16 @@ const sectionLabels = (module: Module) => {
label: `Passage ${index + 1}`
}));
case 'writing':
return [{id: 1, label: "Task 1"}, {id: 2, label: "Task 2"}];
return [{ id: 1, label: "Task 1" }, { id: 2, label: "Task 2" }];
case 'speaking':
return [{id: 1, label: "Speaking 1"}, {id: 2, label: "Speaking 2"}, {id: 3, label: "Interactive Speaking"}];
return [{ id: 1, label: "Speaking 1" }, { id: 2, label: "Speaking 2" }, { id: 3, label: "Interactive Speaking" }];
case 'listening':
return Array.from({ length: 4 }, (_, index) => ({
id: index + 1,
label: `Section ${index + 1}`
}));
case 'level':
return [{id: 1, label: "Part 1"}];
return [{ id: 1, label: "Part 1" }];
}
}
@@ -85,7 +123,7 @@ const defaultSection = (module: Module, sectionId: number) => {
return listeningSection(sectionId)
case 'speaking':
return speakingTask(sectionId)
case 'level':
case 'level':
return levelPart(sectionId)
}
}
@@ -99,8 +137,8 @@ export const defaultSectionSettings = (module: Module, sectionId: number, part?:
generating: undefined,
genResult: undefined,
expandedSubSections: [],
exercisePickerState: [],
selectedExercises: [],
levelGenerating: [],
levelGenResults: []
}
}