"use client"; import { FC, useEffect, useRef } from "react"; import { observer } from "mobx-react-lite"; // hooks import { HelpSection, SidebarMenu, SidebarDropdown } from "@/components/admin-sidebar"; import { useTheme } from "@/hooks/store"; import useOutsideClickDetector from "hooks/use-outside-click-detector"; // components 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 (
); });