Appmanager: menu scrolling fix

Change-Id: I62762dd1bfb4a9be6eec0279e6e18d04990fb4ec
diff --git a/core/installer/welcome/static/app-manager.js b/core/installer/welcome/static/app-manager.js
new file mode 100644
index 0000000..ff10c1b
--- /dev/null
+++ b/core/installer/welcome/static/app-manager.js
@@ -0,0 +1,21 @@
+document.addEventListener("DOMContentLoaded", function () {
+    const page = document.documentElement;
+    const headerHeight = parseFloat(getComputedStyle(page).getPropertyValue('--pico-header-height').replace("px", ""));
+    const nav = document.getElementById("menu");
+    const windowHeight = window.innerHeight - headerHeight;
+    nav.style.setProperty("--max-height", `${windowHeight}px`);
+});
+
+let prevWindowHeight = window.innerHeight;
+
+window.addEventListener("resize", function () {
+    const nav = document.getElementById("menu");
+    const windowHeight = window.innerHeight;
+    const heightDiff = prevWindowHeight - windowHeight;
+    const currentMaxHeight = parseFloat(nav.style.getPropertyValue("--max-height").replace("px", ""));
+    if (!isNaN(currentMaxHeight)) {
+        const newMaxHeight = currentMaxHeight - heightDiff;
+        nav.style.setProperty("--max-height", `${newMaxHeight}px`);
+    }
+    prevWindowHeight = windowHeight;
+});