diff --git a/src/app.tsx b/src/app.tsx index eaf5de0..fce6b23 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -5,9 +5,7 @@ import { ErrorBoundary, onMount, onCleanup, - Suspense, - Show, - createSignal + Suspense } from "solid-js"; import "./app.css"; import { LeftBar, RightBar } from "./components/Bars"; @@ -20,56 +18,30 @@ import { createWindowWidth, isMobile } from "~/lib/resize-utils"; function AppLayout(props: { children: any }) { const { - leftBarSize, - rightBarSize, - setCenterWidth, - centerWidth, leftBarVisible, rightBarVisible, setLeftBarVisible, - setRightBarVisible, - barsInitialized + setRightBarVisible } = useBars(); let lastScrollY = 0; const SCROLL_THRESHOLD = 75; - // Track if we're on the client (hydrated) - starts false on server - const [isClient, setIsClient] = createSignal(false); - // Use onMount to avoid hydration issues - window operations are client-only onMount(() => { - setIsClient(true); const windowWidth = createWindowWidth(); createEffect(() => { - const handleResize = () => { - const currentIsMobile = isMobile(windowWidth()); + const currentIsMobile = isMobile(windowWidth()); - // Show bars when switching to desktop - if (!currentIsMobile) { - setLeftBarVisible(true); - setRightBarVisible(true); - } - - // On mobile, leftBarSize() is always 0 (overlay mode) - const newWidth = window.innerWidth - leftBarSize() - rightBarSize(); - setCenterWidth(newWidth); - }; - - // Call immediately and whenever dependencies change - handleResize(); + // Show bars when switching to desktop + if (!currentIsMobile) { + setLeftBarVisible(true); + setRightBarVisible(true); + } }); }); - // Recalculate when bar sizes change (visibility or actual resize) - createEffect(() => { - if (typeof window === "undefined") return; - // On mobile, leftBarSize() is always 0 (overlay mode) - const newWidth = window.innerWidth - leftBarSize() - rightBarSize(); - setCenterWidth(newWidth); - }); - // Auto-hide on scroll (mobile only) onMount(() => { const windowWidth = createWindowWidth(); @@ -194,40 +166,20 @@ function AppLayout(props: { children: any }) { <>