Skip to content

Commit 9e6e153

Browse files
committed
Refactor user navigation and remove user template
- Updated user navigation logic to redirect to the user section using hash routing instead of a separate user page. - Enhanced the main JavaScript file to manage user section visibility and settings sidebar preferences. - Added user section inclusion in the main HTML template and loaded the corresponding user script. - Removed the deprecated user.html template to streamline the codebase.
1 parent 0462389 commit 9e6e153

File tree

6 files changed

+1126
-1274
lines changed

6 files changed

+1126
-1274
lines changed

frontend/static/js/new-main.js

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,23 @@ let huntarrUI = {
607607

608608
// Set localStorage to maintain Settings sidebar preference
609609
localStorage.setItem('huntarr-settings-sidebar', 'true');
610+
} else if (section === 'user' && document.getElementById('userSection')) {
611+
document.getElementById('userSection').classList.add('active');
612+
document.getElementById('userSection').style.display = 'block';
613+
if (document.getElementById('userNav')) document.getElementById('userNav').classList.add('active');
614+
newTitle = 'User';
615+
this.currentSection = 'user';
616+
617+
// Switch to Settings sidebar for user
618+
this.showSettingsSidebar();
619+
620+
// Set localStorage to maintain Settings sidebar preference
621+
localStorage.setItem('huntarr-settings-sidebar', 'true');
622+
623+
// Initialize user module if not already done
624+
if (typeof window.UserModule !== 'undefined' && !this.userModule) {
625+
this.userModule = new window.UserModule();
626+
}
610627
} else {
611628
// Default to home if section is unknown or element missing
612629
if (this.elements.homeSection) {
@@ -3752,15 +3769,12 @@ let huntarrUI = {
37523769
});
37533770
}
37543771

3755-
// User button - navigates to User page
3772+
// User button - shows User page
37563773
const userNav = document.getElementById('settingsUserNav');
37573774
if (userNav) {
37583775
userNav.addEventListener('click', (e) => {
37593776
e.preventDefault();
3760-
// Set localStorage to remember Settings sidebar preference
3761-
localStorage.setItem('huntarr-settings-sidebar', 'true');
3762-
// Navigate to user page with parameter
3763-
window.location.href = './user?from=settings';
3777+
window.location.hash = '#user';
37643778
});
37653779
}
37663780
},

0 commit comments

Comments
 (0)