@@ -443,6 +443,7 @@ async function renderDashboard() {
443443 </ a >
444444 </ div >
445445 < nav class ="sidebar-nav ">
446+ < div class ="nav-indicator " id ="nav-indicator "> </ div >
446447 < div class ="nav-section-label "> Main</ div >
447448 < a class ="nav-item active " data-page ="overview " href ="/overview ">
448449 < svg viewBox ="0 0 24 24 " fill ="none " stroke ="currentColor " stroke-width ="2 "> < rect x ="3 " y ="3 " width ="7 " height ="7 " rx ="1 "/> < rect x ="14 " y ="3 " width ="7 " height ="7 " rx ="1 "/> < rect x ="3 " y ="14 " width ="7 " height ="7 " rx ="1 "/> < rect x ="14 " y ="14 " width ="7 " height ="7 " rx ="1 "/> </ svg >
@@ -584,11 +585,25 @@ function navigateTo(page) {
584585 }
585586 }
586587
588+ updateNavIndicator ( ) ;
589+
587590 if ( window . innerWidth <= 768 ) {
588591 $ ( '#sidebar' ) . classList . remove ( 'open' ) ;
589592 }
590593}
591594
595+ function updateNavIndicator ( ) {
596+ const activeNav = document . querySelector ( '.nav-item.active' ) ;
597+ const indicator = document . getElementById ( 'nav-indicator' ) ;
598+ if ( activeNav && indicator ) {
599+ indicator . style . top = activeNav . offsetTop + 'px' ;
600+ indicator . style . height = activeNav . offsetHeight + 'px' ;
601+ indicator . style . opacity = '1' ;
602+ } else if ( indicator ) {
603+ indicator . style . opacity = '0' ;
604+ }
605+ }
606+
592607window . addEventListener ( 'popstate' , ( ) => {
593608 const path = window . location . pathname ;
594609 const parts = path . replace ( / ^ \/ / , '' ) . split ( '/' ) ;
@@ -625,6 +640,7 @@ window.addEventListener('popstate', () => {
625640 renderLog ( ) ;
626641 }
627642 }
643+ updateNavIndicator ( ) ;
628644} ) ;
629645
630646// ===== OVERVIEW =====
0 commit comments