From a5326c7a24c85fd9be04eeb10b535261d51e84fe Mon Sep 17 00:00:00 2001 From: Markus Graf Date: Sun, 29 Mar 2026 13:46:45 +0200 Subject: [PATCH] feat(03-05): wire parent area into app.ts - Import showParentCodePrompt and initParentScreen from ui/parent - Register global Ctrl+Shift+E keyboard listener in initApp - Initialize parent screen with back-to-forest callback --- src/app.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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