import { useEffect } from "react"; import { useLocation } from "react-router-dom"; import { resolution } from "../utils/layout"; import { useLayoutStore, useUserStore } from "../store/module"; import ShortcutList from "./ShortcutList"; import TagList from "./TagList"; import SearchBar from "./SearchBar"; import UsageHeatMap from "./UsageHeatMap"; const HomeSidebar = () => { const location = useLocation(); const layoutStore = useLayoutStore(); const userStore = useUserStore(); const showHomeSidebar = layoutStore.state.showHomeSidebar; useEffect(() => { let lastStatus = layoutStore.state.showHomeSidebar; const handleWindowResize = () => { const nextStatus = window.innerWidth < resolution.md; if (lastStatus !== nextStatus) { layoutStore.setHomeSidebarStatus(nextStatus); lastStatus = nextStatus; } }; window.addEventListener("resize", handleWindowResize); handleWindowResize(); return () => { window.removeEventListener("resize", handleWindowResize); }; }, [location]); return (
layoutStore.setHomeSidebarStatus(false)} >
); }; export default HomeSidebar;