From 0b27c3b4007b72246206d115a224fcc0e66ebc2b Mon Sep 17 00:00:00 2001 From: Edouard Vanbelle Date: Wed, 15 Apr 2026 00:39:14 +0200 Subject: [PATCH] fix(navigation): correct hash url and navigation to music --- static/js/app/main.js | 11 ++++++++--- static/js/app/navigation.js | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/static/js/app/main.js b/static/js/app/main.js index fdba54f0..d7dba76d 100644 --- a/static/js/app/main.js +++ b/static/js/app/main.js @@ -21,7 +21,8 @@ import { switchToPhotosSection, switchToRecentFilesSection, switchToSharedSection, - switchToTrashSection + switchToTrashSection, + VIEW_FLAGS } from './navigation.js'; import { performSearch } from './searchView.js'; import { app, appElements as elements } from './state.js'; @@ -246,8 +247,7 @@ function deserializeHash() { const section = hash_elements[1]; - // FIXME: use navigation.VIEW_FLAGS - if (section && ['files', 'shared', 'recent', 'favorites', 'trash', 'photos'].includes(section)) { + if (section in VIEW_FLAGS) { hashContext.section = section; } @@ -306,6 +306,7 @@ function switchSectionTo(section) { // no change ... return; + //TODO: better to use a registry for the future (easier to add new section) switch (section) { case 'files': switchToFilesSection(); @@ -327,6 +328,10 @@ function switchSectionTo(section) { switchToPhotosSection(); break; + case 'music': + switchToMusicSection(); + break; + case 'trash': switchToTrashSection(); break; diff --git a/static/js/app/navigation.js b/static/js/app/navigation.js index 6884eff3..749babd7 100644 --- a/static/js/app/navigation.js +++ b/static/js/app/navigation.js @@ -108,7 +108,7 @@ function initSidebarToggle() { document.addEventListener('DOMContentLoaded', initSidebarToggle); // Mapping of section names to their corresponding view flags -const VIEW_FLAGS = { +export const VIEW_FLAGS = { files: 'isFilesView', shared: 'isSharedView', recent: 'isRecentView',