fix(navigation): correct hash url and navigation to music

This commit is contained in:
Edouard Vanbelle
2026-04-15 00:39:14 +02:00
parent 761d159a92
commit 0b27c3b400
2 changed files with 9 additions and 4 deletions
+8 -3
View File
@@ -21,7 +21,8 @@ import {
switchToPhotosSection, switchToPhotosSection,
switchToRecentFilesSection, switchToRecentFilesSection,
switchToSharedSection, switchToSharedSection,
switchToTrashSection switchToTrashSection,
VIEW_FLAGS
} from './navigation.js'; } from './navigation.js';
import { performSearch } from './searchView.js'; import { performSearch } from './searchView.js';
import { app, appElements as elements } from './state.js'; import { app, appElements as elements } from './state.js';
@@ -246,8 +247,7 @@ function deserializeHash() {
const section = hash_elements[1]; const section = hash_elements[1];
// FIXME: use navigation.VIEW_FLAGS if (section in VIEW_FLAGS) {
if (section && ['files', 'shared', 'recent', 'favorites', 'trash', 'photos'].includes(section)) {
hashContext.section = section; hashContext.section = section;
} }
@@ -306,6 +306,7 @@ function switchSectionTo(section) {
// no change ... // no change ...
return; return;
//TODO: better to use a registry for the future (easier to add new section)
switch (section) { switch (section) {
case 'files': case 'files':
switchToFilesSection(); switchToFilesSection();
@@ -327,6 +328,10 @@ function switchSectionTo(section) {
switchToPhotosSection(); switchToPhotosSection();
break; break;
case 'music':
switchToMusicSection();
break;
case 'trash': case 'trash':
switchToTrashSection(); switchToTrashSection();
break; break;
+1 -1
View File
@@ -108,7 +108,7 @@ function initSidebarToggle() {
document.addEventListener('DOMContentLoaded', initSidebarToggle); document.addEventListener('DOMContentLoaded', initSidebarToggle);
// Mapping of section names to their corresponding view flags // Mapping of section names to their corresponding view flags
const VIEW_FLAGS = { export const VIEW_FLAGS = {
files: 'isFilesView', files: 'isFilesView',
shared: 'isSharedView', shared: 'isSharedView',
recent: 'isRecentView', recent: 'isRecentView',