perf: make module loading synchronous, flip right panel layout

- Remove unnecessary async/await from loadModules (static imports)
- Move game controls to top of right panel
- Move preview header below controls, above preview
- Flip inset shadow to top of preview section
This commit is contained in:
2025-12-30 21:07:00 +01:00
parent 3d71e37828
commit b6655ced44
4 changed files with 21 additions and 21 deletions

View File

@@ -115,7 +115,7 @@ function toggleExpectedResult() {
// ================= LANGUAGE TOGGLE =================
async function toggleLanguage() {
function toggleLanguage() {
const currentLang = getLanguage();
const newLang = currentLang === "en" ? "de" : "en";
@@ -130,7 +130,7 @@ async function toggleLanguage() {
const currentModuleId = engineState.module?.id;
const currentLessonIndex = engineState.lessonIndex;
const modules = await loadModules(newLang);
const modules = loadModules(newLang);
lessonEngine.setModules(modules);
renderModuleList(elements.moduleList, modules, selectModule, selectLesson);
@@ -261,9 +261,9 @@ function clearLoadingTimeout() {
}
}
async function initializeModules() {
function initializeModules() {
try {
const modules = await loadModules(getLanguage());
const modules = loadModules(getLanguage());
lessonEngine.setModules(modules);
// Use the new renderModuleList function with both callbacks
@@ -684,7 +684,7 @@ function init() {
loadingTimeout = setTimeout(showLoadingFallback, 3000);
// Load modules after editor is ready
initializeModules().catch(console.error);
initializeModules();
// Sidebar controls
elements.menuBtn.addEventListener("click", openSidebar);