diff options
| author | Bobby <[email protected]> | 2026-03-08 04:10:55 +0530 |
|---|---|---|
| committer | Bobby <[email protected]> | 2026-03-08 04:10:55 +0530 |
| commit | d21ea918864a8b18fef94bbfaec8097444be1b17 (patch) | |
| tree | eb30d9020b2f8b04127fd4cd2436a24921fb3fb3 /static/js | |
| parent | 44e056c26936b302478fa4e64e3f8e3e6a9a30cf (diff) | |
| download | dove-d21ea918864a8b18fef94bbfaec8097444be1b17.tar.xz dove-d21ea918864a8b18fef94bbfaec8097444be1b17.zip | |
feat: Update sidebar navigation and enhance mail management UI with improved links and descriptions
Diffstat (limited to 'static/js')
| -rw-r--r-- | static/js/sidebar.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/static/js/sidebar.js b/static/js/sidebar.js index 6a889e4..8384c6f 100644 --- a/static/js/sidebar.js +++ b/static/js/sidebar.js @@ -40,6 +40,7 @@ function initSidebar() { document.querySelectorAll("[data-sidebar-section]").forEach(function (section) { var prefix = section.dataset.sectionPrefix; var trigger = section.querySelector("[data-sidebar-trigger]"); + var chevron = section.querySelector("[data-sidebar-chevron]"); var pathMatchesSection = currentPath.indexOf(prefix) === 0; if (pathMatchesSection && state[prefix] === undefined) { @@ -48,6 +49,11 @@ function initSidebar() { toggleSection(section, !!state[prefix]); + trigger.classList.remove("active"); + if (currentPath === prefix || currentPath === prefix + "/") { + trigger.classList.add("active"); + } + section.querySelectorAll("[data-sidebar-children] .nav-link").forEach(function (link) { link.classList.remove("active"); var href = link.getAttribute("href"); @@ -58,7 +64,14 @@ function initSidebar() { if (!trigger.dataset.sidebarBound) { trigger.dataset.sidebarBound = "true"; - trigger.addEventListener("click", function (event) { + + trigger.addEventListener("click", function () { + state[prefix] = true; + saveSidebarState(state); + toggleSection(section, true); + }); + + chevron.addEventListener("click", function (event) { event.preventDefault(); event.stopPropagation(); state[prefix] = !state[prefix]; |
