Skip to content

Commit ed079f9

Browse files
committed
Enhance sidebar logic and settings management
- Updated sidebar visibility logic to include the 'user' section in the settings sidebar condition. - Added functionality to clear the settings sidebar preference from localStorage when showing the main sidebar across various sections. - Refined the check for settings-related sections in the HTML template to focus on the current hash, improving clarity and performance.
1 parent 04867a4 commit ed079f9

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

frontend/static/js/new-main.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,11 @@ let huntarrUI = {
7979
const settingsSidebarActive = localStorage.getItem('huntarr-settings-sidebar') === 'true';
8080
const settingsSidebarPreloaded = window.huntarrSettingsSidebarPreload === true;
8181

82-
if ((settingsSidebarActive || settingsSidebarPreloaded) && (this.currentSection === 'settings' || this.currentSection === 'scheduling')) {
82+
if ((settingsSidebarActive || settingsSidebarPreloaded) && (this.currentSection === 'settings' || this.currentSection === 'scheduling' || this.currentSection === 'user')) {
8383
this.showSettingsSidebar();
8484
} else {
85-
// Show main sidebar by default
85+
// Show main sidebar by default and clear settings sidebar preference
86+
localStorage.removeItem('huntarr-settings-sidebar');
8687
this.showMainSidebar();
8788
}
8889

@@ -479,7 +480,8 @@ let huntarrUI = {
479480
newTitle = 'Home';
480481
this.currentSection = 'home';
481482

482-
// Show main sidebar when returning to home
483+
// Show main sidebar when returning to home and clear settings sidebar preference
484+
localStorage.removeItem('huntarr-settings-sidebar');
483485
this.showMainSidebar();
484486

485487
// Disconnect logs if switching away from logs
@@ -497,7 +499,8 @@ let huntarrUI = {
497499
newTitle = 'Logs';
498500
this.currentSection = 'logs';
499501

500-
// Show main sidebar for main sections
502+
// Show main sidebar for main sections and clear settings sidebar preference
503+
localStorage.removeItem('huntarr-settings-sidebar');
501504
this.showMainSidebar();
502505

503506
// Comprehensive LogsModule debugging
@@ -533,7 +536,8 @@ let huntarrUI = {
533536
newTitle = 'Hunt Manager';
534537
this.currentSection = 'hunt-manager';
535538

536-
// Show main sidebar for main sections
539+
// Show main sidebar for main sections and clear settings sidebar preference
540+
localStorage.removeItem('huntarr-settings-sidebar');
537541
this.showMainSidebar();
538542

539543
// Load hunt manager data if the module exists
@@ -575,7 +579,8 @@ let huntarrUI = {
575579
newTitle = 'Apps';
576580
this.currentSection = 'apps';
577581

578-
// Show main sidebar for main sections
582+
// Show main sidebar for main sections and clear settings sidebar preference
583+
localStorage.removeItem('huntarr-settings-sidebar');
579584
this.showMainSidebar();
580585

581586
// Load app connections when switching to Apps
@@ -634,7 +639,8 @@ let huntarrUI = {
634639
newTitle = 'Home';
635640
this.currentSection = 'home';
636641

637-
// Show main sidebar
642+
// Show main sidebar and clear settings sidebar preference
643+
localStorage.removeItem('huntarr-settings-sidebar');
638644
this.showMainSidebar();
639645
}
640646

frontend/templates/index.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@
2222
const settingsSidebarActive = localStorage.getItem('huntarr-settings-sidebar') === 'true';
2323
const currentHash = window.location.hash;
2424

25-
// More comprehensive check for Settings-related sections
26-
const isSettingsSection = settingsSidebarActive ||
27-
currentHash === '#settings' ||
25+
// Check for Settings-related sections based on current hash only
26+
const isSettingsSection = currentHash === '#settings' ||
2827
currentHash === '#scheduling' ||
29-
(settingsSidebarActive && (currentHash === '' || currentHash === '#'));
28+
currentHash === '#user';
3029

3130
if (isSettingsSection) {
3231
// Add CSS to hide main sidebar and show settings sidebar immediately

0 commit comments

Comments
 (0)