mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-11-18 19:46:18 +00:00
Update proxmox-dashboard.tsx
This commit is contained in:
@@ -129,8 +129,9 @@ export function ProxmoxDashboard() {
|
|||||||
return () => clearInterval(interval)
|
return () => clearInterval(interval)
|
||||||
}, [fetchSystemData])
|
}, [fetchSystemData])
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let hideTimeout: NodeJS.Timeout | null = null
|
let hideTimeout: ReturnType<typeof setTimeout> | null = null
|
||||||
|
|
||||||
const handleScroll = () => {
|
const handleScroll = () => {
|
||||||
const currentScrollY = window.scrollY
|
const currentScrollY = window.scrollY
|
||||||
@@ -138,15 +139,12 @@ export function ProxmoxDashboard() {
|
|||||||
const scrollingUp = currentScrollY < lastScrollY
|
const scrollingUp = currentScrollY < lastScrollY
|
||||||
|
|
||||||
if (currentScrollY < 150) {
|
if (currentScrollY < 150) {
|
||||||
// Top of page → always show
|
|
||||||
if (hideTimeout) clearTimeout(hideTimeout)
|
if (hideTimeout) clearTimeout(hideTimeout)
|
||||||
setShowNavigation(true)
|
setShowNavigation(true)
|
||||||
} else if (scrollingDown) {
|
} else if (scrollingDown) {
|
||||||
// Scrolling down → hide smoothly after small delay
|
|
||||||
if (hideTimeout) clearTimeout(hideTimeout)
|
if (hideTimeout) clearTimeout(hideTimeout)
|
||||||
hideTimeout = setTimeout(() => setShowNavigation(false), 100)
|
hideTimeout = setTimeout(() => setShowNavigation(false), 100)
|
||||||
} else if (scrollingUp) {
|
} else if (scrollingUp) {
|
||||||
// Scrolling up → show immediately
|
|
||||||
if (hideTimeout) clearTimeout(hideTimeout)
|
if (hideTimeout) clearTimeout(hideTimeout)
|
||||||
setShowNavigation(true)
|
setShowNavigation(true)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user