"use client"; import { FC, useEffect, useRef } from "react"; import { observer } from "mobx-react-lite"; // hooks import { useTheme } from "@/hooks"; import useOutsideClickDetector from "hooks/use-outside-click-detector"; // components import { HelpSection, SidebarMenu, SidebarDropdown } from "@/components/auth-sidebar"; export interface IInstanceSidebar {} export const InstanceSidebar: FC = observer(() => { // store const { isSidebarCollapsed, toggleSidebar } = useTheme(); const ref = useRef(null); useOutsideClickDetector(ref, () => { if (isSidebarCollapsed === false) { if (window.innerWidth < 768) { toggleSidebar(!isSidebarCollapsed); } } }); useEffect(() => { const handleResize = () => { if (window.innerWidth <= 768) { toggleSidebar(true); } }; handleResize(); window.addEventListener("resize", handleResize); return () => { window.removeEventListener("resize", handleResize); }; }, [toggleSidebar]); return (
); });