1616 * along with this program. If not, see <https://www.gnu.org/licenses/>.
1717 */
1818
19- import { memo , useEffect , useState } from 'react' ;
19+ import { memo , useCallback , useEffect , useRef , useState } from 'react' ;
2020
2121// State Management
2222import { useAtom , useAtomValue } from 'jotai' ;
@@ -42,6 +42,8 @@ interface BottomPanelProps {
4242 currentVersionString : string ;
4343}
4444
45+ const AUTO_HIDE_DELAY_MS = 100 * 1000 ; // 10 seconds
46+
4547const BottomPanel = ( {
4648 latestVersion,
4749 latestVersionString,
@@ -52,6 +54,30 @@ const BottomPanel = ({
5254 const clientSettings = useAtomValue < ClientSettings > ( clientSettingsAtom ) ;
5355
5456 const [ isVisible , setIsVisible ] = useState ( false ) ;
57+ const autoHideTimerRef = useRef < ReturnType < typeof setTimeout > | null > ( null ) ;
58+
59+ // Clear the auto-hide timer
60+ const clearAutoHideTimer = useCallback ( ( ) => {
61+ if ( autoHideTimerRef . current ) {
62+ clearTimeout ( autoHideTimerRef . current ) ;
63+ autoHideTimerRef . current = null ;
64+ }
65+ } , [ ] ) ;
66+
67+ // Start the auto-hide timer
68+ const startAutoHideTimer = useCallback ( ( ) => {
69+ clearAutoHideTimer ( ) ;
70+ autoHideTimerRef . current = setTimeout ( ( ) => {
71+ setIsVisible ( false ) ;
72+ } , AUTO_HIDE_DELAY_MS ) ;
73+ } , [ clearAutoHideTimer ] ) ;
74+
75+ // Clean up timer on unmount
76+ useEffect ( ( ) => {
77+ return ( ) => {
78+ clearAutoHideTimer ( ) ;
79+ } ;
80+ } , [ clearAutoHideTimer ] ) ;
5581
5682 const [ skipVersion , setSkipVersion ] = useAtom ( skipVersionAtom ) ;
5783
@@ -63,6 +89,9 @@ const BottomPanel = ({
6389 // React Router 6 navigate
6490 navigate ( pathname ) ;
6591
92+ // Clear auto-hide timer since user selected a menu item
93+ clearAutoHideTimer ( ) ;
94+
6695 // Close menu
6796 setTimeout ( ( ) => {
6897 setIsVisible ( false ) ;
@@ -88,7 +117,17 @@ const BottomPanel = ({
88117 const clickedNagiosTv = ( e : React . MouseEvent < HTMLElement > ) => {
89118 e . preventDefault ( ) ;
90119 e . stopPropagation ( ) ; // Prevent it from triggering standard menu click
91- setIsVisible ( visible => ! visible ) ;
120+ setIsVisible ( visible => {
121+ const newVisible = ! visible ;
122+ if ( newVisible ) {
123+ // Start auto-hide timer when panel is opened
124+ startAutoHideTimer ( ) ;
125+ } else {
126+ // Clear timer when panel is manually closed
127+ clearAutoHideTimer ( ) ;
128+ }
129+ return newVisible ;
130+ } ) ;
92131 } ;
93132
94133 const clickedUpdateAvailable = ( e : React . MouseEvent < HTMLElement > ) => {
@@ -166,7 +205,7 @@ const BottomPanel = ({
166205
167206 < div className = { isVisible ? 'bottom-panel-nav-area bottom-panel-nav-area-visible' : 'bottom-panel-nav-area' } >
168207
169- < div className = "nav-sidebar-icon" >
208+ < div className = "nav-sidebar-icon nav-dash " >
170209 < span >
171210 < NavLink className = { ( { isActive } ) => ( isActive ? 'is-active' : '' ) } to = "/" onClick = { clickedDashboard } >
172211 < FontAwesomeIcon
@@ -178,7 +217,7 @@ const BottomPanel = ({
178217 </ span >
179218 </ div >
180219
181- < div className = "nav-sidebar-icon" >
220+ < div className = "nav-sidebar-icon nav-settings" >
182221 < span >
183222 < NavLink className = { ( { isActive } ) => ( isActive ? 'is-active' : '' ) } to = "/settings" onClick = { clickedSettings } >
184223 < FontAwesomeIcon
@@ -190,7 +229,7 @@ const BottomPanel = ({
190229 </ span >
191230 </ div >
192231
193- < div className = "nav-sidebar-icon" >
232+ < div className = "nav-sidebar-icon nav-update " >
194233 < span >
195234 < NavLink className = { ( { isActive } ) => ( isActive ? 'is-active' : '' ) } to = "/update" onClick = { clickedUpdate } >
196235 < FontAwesomeIcon
@@ -202,7 +241,7 @@ const BottomPanel = ({
202241 </ span >
203242 </ div >
204243
205- < div className = "nav-sidebar-icon" >
244+ < div className = "nav-sidebar-icon nav-info " >
206245 < span >
207246 < NavLink className = { ( { isActive } ) => ( isActive ? 'is-active' : '' ) } to = "/help" onClick = { clickedInfo } >
208247 < FontAwesomeIcon
0 commit comments