diff --git a/src/app.ts b/src/app.ts index a648ac7..e571e6f 100644 --- a/src/app.ts +++ b/src/app.ts @@ -4,6 +4,7 @@ import { initWelcomeScreen, initLessonScreen } from "./ui/screens"; import { initForestScreen } from "./forest/scene"; import { getGreeting } from "./companion/companion"; import { companions } from "./companion/characters"; +import { showParentCodePrompt, initParentScreen } from "./ui/parent"; let db: IDBDatabase; let lessonCleanup: (() => void) | null = null; @@ -86,6 +87,21 @@ function startLessonFromForest(level: number): void { export async function initApp(): Promise { db = await openDB(); + + // Wire parent screen back button + initParentScreen(db, async () => { + await initForestScreen(db, startLessonFromForest); + showScreen("forest"); + }); + + // Global keyboard shortcut for parent area (Ctrl+Shift+E) + document.addEventListener("keydown", (e) => { + if (e.ctrlKey && e.shiftKey && e.key === "E") { + e.preventDefault(); + showParentCodePrompt(); + } + }); + const progress = await getProgress(db); if (progress && progress.selectedCharacter) { // Returning user -- init forest and go there