feat(navigation): no change/blink section if already selected

This commit is contained in:
Edouard Vanbelle
2026-04-01 23:59:23 +02:00
parent 744d2c88fb
commit 8d2a45c0ff
+12 -5
View File
@@ -118,8 +118,12 @@ function getSectionFromNavItem(navItem) {
/**
* Set the current active section, updating all view flags and nav UI.
* @param {string} section - The section to activate ('files', 'shared', 'recent', 'favorites', 'trash')
* @returns {boolean} true if the section changed
*/
function setCurrentSection(section) {
if (window.app.currentSection == section) return false;
// Set all view flags - true for active section, false for others
Object.entries(VIEW_FLAGS).forEach(([key, flag]) => {
window.app[flag] = (key === section);
@@ -148,10 +152,13 @@ function setCurrentSection(section) {
if (section !== 'photos' && window.photosView) {
window.photosView.hide();
}
return true;
}
function switchToSharedView() {
setCurrentSection('shared');
if (!setCurrentSection('shared')) return;
// Hide breadcrumb (only shown in Files view)
const breadcrumb = document.querySelector('.breadcrumb');
@@ -175,7 +182,7 @@ function switchToSharedView() {
}
function switchToFilesView() {
setCurrentSection('files');
if (!setCurrentSection('files')) return;
// Set actions bar mode
window.setActionsBarMode('files', true);
@@ -200,7 +207,7 @@ function switchToFilesView() {
}
function switchToFavoritesView() {
setCurrentSection('favorites');
if (!setCurrentSection('favorites')) return;
// Set actions bar mode
window.setActionsBarMode('favorites');
@@ -233,7 +240,7 @@ function switchToFavoritesView() {
}
function switchToRecentFilesView() {
setCurrentSection('recent');
if (!setCurrentSection('recent')) return;
// Set actions bar mode
window.setActionsBarMode('recent');
@@ -266,7 +273,7 @@ function switchToRecentFilesView() {
}
function switchToPhotosView() {
setCurrentSection('photos');
if (!setCurrentSection('photos')) return;
// Hide breadcrumb
const breadcrumb = document.querySelector('.breadcrumb');