From 5ce6b0c417d4cdde4e9659926664b9739245a2df Mon Sep 17 00:00:00 2001 From: Wim Brand Date: Thu, 29 Jan 2026 23:41:30 +0100 Subject: [PATCH] Add file tree to menu --- svelte/src/filesystem/FSNavigator.ts | 2 + svelte/src/filesystem/Filesystem.svelte | 4 +- svelte/src/filesystem/edit_window/Branding.ts | 6 +- .../filesystem/edit_window/EditWindow.svelte | 12 +- .../filesystem/filemanager/ListView.svelte | 1 - svelte/src/filesystem/viewers/Audio.svelte | 94 ++++---- svelte/src/lib/FilesystemAPI.svelte.ts | 4 + svelte/src/lib/HighlightCurrentPage.ts | 7 +- .../src/user_home/dashboard/UploadLib.svelte | 212 ------------------ svelte/src/wrap/Bookmarks.svelte | 30 +-- svelte/src/wrap/MainMenu.svelte | 13 +- svelte/src/wrap/Router.svelte | 1 - svelte/src/wrap/Tree.svelte | 98 ++++++++ 13 files changed, 199 insertions(+), 285 deletions(-) delete mode 100644 svelte/src/user_home/dashboard/UploadLib.svelte create mode 100644 svelte/src/wrap/Tree.svelte diff --git a/svelte/src/filesystem/FSNavigator.ts b/svelte/src/filesystem/FSNavigator.ts index 689ed95..f3180ac 100644 --- a/svelte/src/filesystem/FSNavigator.ts +++ b/svelte/src/filesystem/FSNavigator.ts @@ -273,3 +273,5 @@ const sort_children = (children: FSNode[], field: string, asc: boolean) => { } }) } + +export let global_navigator = new FSNavigator(true) diff --git a/svelte/src/filesystem/Filesystem.svelte b/svelte/src/filesystem/Filesystem.svelte index 8bfc980..d8887c2 100644 --- a/svelte/src/filesystem/Filesystem.svelte +++ b/svelte/src/filesystem/Filesystem.svelte @@ -7,7 +7,7 @@ import DetailsWindow from "./DetailsWindow.svelte"; import FilePreview from "./viewers/FilePreview.svelte"; import FSUploadWidget from "./upload_widget/FSUploadWidget.svelte"; import { type FSPath } from "lib/FilesystemAPI.svelte"; -import { FSNavigator } from "./FSNavigator" +import { global_navigator } from "./FSNavigator" import { css_from_path } from "filesystem/edit_window/Branding"; import AffiliatePrompt from "user_home/AffiliatePrompt.svelte"; import { current_page_store } from "wrap/RouterStore"; @@ -20,7 +20,7 @@ let edit_window: EditWindow = $state() let edit_visible = $state(false) let details_window: DetailsWindow = $state() -const nav = $state(new FSNavigator(true)) +const nav = global_navigator onMount(() => { if ((window as any).intial_node !== undefined) { diff --git a/svelte/src/filesystem/edit_window/Branding.ts b/svelte/src/filesystem/edit_window/Branding.ts index cc1ba37..6238666 100644 --- a/svelte/src/filesystem/edit_window/Branding.ts +++ b/svelte/src/filesystem/edit_window/Branding.ts @@ -113,9 +113,9 @@ const add_styles = (style: Style, properties: FSNodeProperties) => { const add_contrast = (color: string, amt: number) => { let hsl = rgb2hsl(parse(color)) // Convert hex to hsl - // If the lightness is less than 40 it is considered a dark colour. This - // threshold is 40 instead of 50 because overall dark text is more legible - if (hsl[2] < 40) { + // If the lightness is less than 30 it is considered a dark colour. This + // threshold is 30 instead of 50 because overall dark text is more legible + if (hsl[2] < 30) { hsl[2] = hsl[2] + amt // Dark color, add lightness } else { hsl[2] = hsl[2] - amt // Light color, remove lightness diff --git a/svelte/src/filesystem/edit_window/EditWindow.svelte b/svelte/src/filesystem/edit_window/EditWindow.svelte index 1f6f762..e561aa3 100644 --- a/svelte/src/filesystem/edit_window/EditWindow.svelte +++ b/svelte/src/filesystem/edit_window/EditWindow.svelte @@ -1,5 +1,5 @@ - - - - - - - -{#if upload_queue.length > 1} -
- Create an album
-
-
Name:
- - -
-
-{/if} - -{#each upload_queue as file} - -{/each} - - diff --git a/svelte/src/wrap/Bookmarks.svelte b/svelte/src/wrap/Bookmarks.svelte index 2c2532a..3895aaa 100644 --- a/svelte/src/wrap/Bookmarks.svelte +++ b/svelte/src/wrap/Bookmarks.svelte @@ -19,21 +19,23 @@ const toggle_edit = () => { edit -{/if} -{#each $bookmarks_store as bookmark} -
- - {bookmark.icon} - {bookmark.label} - - {#if editing} - - {/if} -
-{/each} + {#each $bookmarks_store as bookmark} +
+ + {bookmark.icon} + {bookmark.label} + + {#if editing} + + {/if} +
+ {/each} + +
+{/if}