import React, { useEffect } from "react"; import { observer } from "mobx-react"; import { useRouter } from "next/router"; // hooks import { useModule } from "@/hooks/store"; // components import { ModuleDetailsSidebar } from "./sidebar"; type Props = { projectId: string; workspaceSlug: string; isArchived?: boolean; }; export const ModulePeekOverview: React.FC = observer(({ projectId, workspaceSlug, isArchived = false }) => { // router const router = useRouter(); const { peekModule } = router.query; // refs const ref = React.useRef(null); // store hooks const { fetchModuleDetails, fetchArchivedModuleDetails } = useModule(); const handleClose = () => { delete router.query.peekModule; router.push({ pathname: router.pathname, query: { ...router.query }, }); }; useEffect(() => { if (!peekModule) return; if (isArchived) fetchArchivedModuleDetails(workspaceSlug, projectId, peekModule.toString()); else fetchModuleDetails(workspaceSlug, projectId, peekModule.toString()); }, [fetchArchivedModuleDetails, fetchModuleDetails, isArchived, peekModule, projectId, workspaceSlug]); return ( <> {peekModule && (
)} ); });