diff --git a/components/sidebar.tsx b/components/sidebar.tsx index ccf3a7f..35386ec 100644 --- a/components/sidebar.tsx +++ b/components/sidebar.tsx @@ -15,37 +15,51 @@ function stopPropagation(e: any) { const Sidebar = () => { const isMobile = useWindowSize(); - console.log(isMobile); // DEBUG const router = useRouter(); - const [active, setActive] = useState(!isMobile); - const { maps, isLoading, isError } = useNavbar(); - + const [active, setActive] = useState(isMobile); + const { maps, isLoading, isError }:{ maps: ReadyOrNotMap[], isLoading: boolean, isError: boolean} = useNavbar(); - if (isError) { return (
) } + if(typeof(isMobile) === "boolean" && typeof(active) === "undefined") { + setActive(!isMobile); + } + + if (isError) { + return ( + <> +
+
+ + ) + } else if (isLoading) { return ( -
- -
+ <> +
+ +
+
+ ) } else { - // > is a placeholder return ( -
setActive(!active)}> - -
- {active" : "<" }/> + <> +
setActive(!active)}> + +
+ {active" : "<"} /> +
-
+
+ ); } }