From a4a3d568dffb378af0704c3bd0ac3d5a940e8d19 Mon Sep 17 00:00:00 2001 From: liyunze <50455574+liyunze-coding@users.noreply.github.com> Date: Wed, 2 Sep 2026 11:20:01 +0800 Subject: [PATCH] added units page and unit rail with better scrolling --- src/lib/components/Navbar.svelte | 60 ++++++++++- src/lib/components/UnitFilter.svelte | 144 ++++++++++++++++++++++++++ src/lib/components/UnitRail.svelte | 119 ++++++++++++++++++++++ src/lib/server/api.ts | 54 ++++++++++ src/lib/server/db.ts | 8 ++ src/routes/+page.svelte | 13 ++- src/routes/layout.css | 26 ++++- src/routes/notes/+page.svelte | 25 +---- src/routes/questions/+page.svelte | 25 +---- src/routes/units/+page.svelte | 146 +++++++++++++++++++++++++++ 10 files changed, 562 insertions(+), 58 deletions(-) create mode 100644 src/lib/components/UnitFilter.svelte create mode 100644 src/lib/components/UnitRail.svelte create mode 100644 src/routes/units/+page.svelte diff --git a/src/lib/components/Navbar.svelte b/src/lib/components/Navbar.svelte index 715614e..7d58d28 100644 --- a/src/lib/components/Navbar.svelte +++ b/src/lib/components/Navbar.svelte @@ -6,6 +6,7 @@ import { page } from "$app/state"; let mobileMenuOpen = $state(false); + let resourcesOpen = $state(false); let auth = $state(false); let admin = $state(false); let searchQuery = $state(""); @@ -33,8 +34,10 @@ }); const path = $derived(page.url.pathname); + const onUnits = $derived(path === "/units" || path.startsWith("/units/")); const onNotes = $derived(path === "/notes" || path.startsWith("/notes/")); const onQuestions = $derived(path === "/questions" || path.startsWith("/questions/")); + const onResources = $derived(onUnits || onNotes || onQuestions); const onAdmin = $derived(path === "/admin" || path.startsWith("/admin/")); @@ -43,10 +46,56 @@ Notebook