From d317bfc9837b9cc62f5956cde123c04a42d865f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Padez?= Date: Mon, 27 Jul 2026 13:56:51 +0000 Subject: [PATCH] dock: lift the nav-dock hide threshold when the music dock is present MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The nav dock rides MUSIC_DOCK_HEIGHT higher while the music dock is up, but the hide threshold was still measured from the bottom — so hovering the raised dock read as past HIDE_THRESHOLD and it slid away under the cursor. Lift hideAt (and the magnify gate) by MUSIC_DOCK_HEIGHT; the reveal trigger stays at the edge. Also read musicDockPresent via a ref so the once-registered mousemove handler reacts to music starting/stopping. Co-Authored-By: Claude Opus 4.8 --- .../Screens/Dashboard/Layout/Dock.tsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/apps/officer-web/Screens/Dashboard/Layout/Dock.tsx b/src/apps/officer-web/Screens/Dashboard/Layout/Dock.tsx index 8a0dfc7a..8aebb6bc 100644 --- a/src/apps/officer-web/Screens/Dashboard/Layout/Dock.tsx +++ b/src/apps/officer-web/Screens/Dashboard/Layout/Dock.tsx @@ -37,17 +37,23 @@ export const Dock = ({ items, className }: DockProps) => { const location = useLocation(); const { current } = useMusicPlayer(); const musicDockPresent = !!current; + // Read the latest value inside the (once-registered) mousemove handler, so it reacts to the music + // dock appearing/disappearing without re-binding the listener. + const musicPresentRef = useRef(musicDockPresent); + musicPresentRef.current = musicDockPresent; const isActive = (to: string) => (to === '/' ? location.pathname === '/' : location.pathname.startsWith(to)); useEffect(() => { const handleMouseMove = (ev: MouseEvent) => { const distFromBottom = window.innerHeight - ev.clientY; - setVisible((prev) => { - if (!prev) return distFromBottom <= SHOW_THRESHOLD; - return distFromBottom <= HIDE_THRESHOLD; - }); - if (distFromBottom <= HIDE_THRESHOLD) { + // When the music dock is present the nav dock rides MUSIC_DOCK_HEIGHT higher, so lift the hide/ + // magnify zone by the same amount — otherwise hovering the raised dock counts as past the hide + // threshold and it slides away under the cursor. The reveal trigger stays at the bottom edge. + const lift = musicPresentRef.current ? MUSIC_DOCK_HEIGHT : 0; + const hideAt = HIDE_THRESHOLD + lift; + setVisible((prev) => (prev ? distFromBottom <= hideAt : distFromBottom <= SHOW_THRESHOLD)); + if (distFromBottom <= hideAt) { const rect = dockRef.current?.getBoundingClientRect(); if (rect) setMouseX(ev.clientX - rect.left); } else {