diff --git a/admin-spa/src/App.tsx b/admin-spa/src/App.tsx index 7c0f42f..fbe2b48 100644 --- a/admin-spa/src/App.tsx +++ b/admin-spa/src/App.tsx @@ -262,7 +262,7 @@ function AddonRoute({ config }: { config: any }) { return ; } -function Header({ onFullscreen, fullscreen, showToggle = true }: { onFullscreen: () => void; fullscreen: boolean; showToggle?: boolean }) { +function Header({ onFullscreen, fullscreen, showToggle = true, scrollContainerRef }: { onFullscreen: () => void; fullscreen: boolean; showToggle?: boolean; scrollContainerRef?: React.RefObject }) { const [siteTitle, setSiteTitle] = React.useState((window as any).wnw?.siteTitle || 'WooNooW'); const [isVisible, setIsVisible] = React.useState(true); const [lastScrollY, setLastScrollY] = React.useState(0); @@ -282,8 +282,11 @@ function Header({ onFullscreen, fullscreen, showToggle = true }: { onFullscreen: // Hide/show header on scroll (mobile only) React.useEffect(() => { + const scrollContainer = scrollContainerRef?.current; + if (!scrollContainer) return; + const handleScroll = () => { - const currentScrollY = window.scrollY; + const currentScrollY = scrollContainer.scrollTop; // Only apply on mobile (check window width) if (window.innerWidth >= 768) { @@ -302,12 +305,12 @@ function Header({ onFullscreen, fullscreen, showToggle = true }: { onFullscreen: setLastScrollY(currentScrollY); }; - window.addEventListener('scroll', handleScroll, { passive: true }); + scrollContainer.addEventListener('scroll', handleScroll, { passive: true }); return () => { - window.removeEventListener('scroll', handleScroll); + scrollContainer.removeEventListener('scroll', handleScroll); }; - }, [lastScrollY]); + }, [lastScrollY, scrollContainerRef]); const handleLogout = async () => { try { @@ -436,6 +439,7 @@ function Shell() { const toggle = () => setOn(v => !v); const isDesktop = useIsDesktop(); const location = useLocation(); + const scrollContainerRef = React.useRef(null); // Check if standalone mode - force fullscreen and hide toggle const isStandalone = window.WNW_CONFIG?.standaloneMode ?? false; @@ -449,7 +453,7 @@ function Shell() { {!isStandalone && } {!isStandalone && }
-
+
{fullscreen ? ( isDesktop ? (
@@ -468,7 +472,6 @@ function Shell() {
) : (
- {isDashboardRoute ? ( ) : ( @@ -476,7 +479,7 @@ function Shell() { )}
-
+
diff --git a/admin-spa/src/components/nav/BottomNav.tsx b/admin-spa/src/components/nav/BottomNav.tsx index d6978b8..f0190ee 100644 --- a/admin-spa/src/components/nav/BottomNav.tsx +++ b/admin-spa/src/components/nav/BottomNav.tsx @@ -63,7 +63,7 @@ export function BottomNav() { (undefined);