feat: Puente Mayúscula-Minúscula + TTS SpeechSynthesis + E2E fixes
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
import type { Exercise, Stage, TopicCurriculum } from "./types"
|
||||
|
||||
const lecturaModules: Record<string, Stage> = {}
|
||||
const numerosModules: Record<string, Stage> = {}
|
||||
|
||||
async function loadStages(
|
||||
topic: string,
|
||||
modules: Record<string, Stage>,
|
||||
stageFiles: number[],
|
||||
) {
|
||||
for (const s of stageFiles) {
|
||||
try {
|
||||
const mod = await import(`./${topic}/etapa-${s}`)
|
||||
modules[s] = mod.default
|
||||
} catch {
|
||||
// stage not yet implemented
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let lecturaLoaded = false
|
||||
let numerosLoaded = false
|
||||
|
||||
export function getAllLecturaExercises(): Exercise[] {
|
||||
const stages = Object.values(getLecturaStages())
|
||||
return stages.flatMap((s) => s.exercises || [])
|
||||
}
|
||||
|
||||
export function getLecturaStages(): Record<string, Stage> {
|
||||
return lecturaModules as Record<string, Stage>
|
||||
}
|
||||
|
||||
export function getNumerosStages(): Record<string, Stage> {
|
||||
return numerosModules as Record<string, Stage>
|
||||
}
|
||||
|
||||
export async function initCurriculum() {
|
||||
if (!lecturaLoaded) {
|
||||
await loadStages("lectura", lecturaModules, [1, 2, 3, 4, 5, 6, 7, 8, 9])
|
||||
lecturaLoaded = true
|
||||
}
|
||||
if (!numerosLoaded) {
|
||||
await loadStages("numeros", numerosModules, [1, 2, 3, 4, 5, 6, 7, 8])
|
||||
numerosLoaded = true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user