import { observer } from "mobx-react-lite"; import { useRouter } from "next/router"; // hooks import { useApplication, useEventTracker, useModule } from "hooks/store"; import useLocalStorage from "hooks/use-local-storage"; // components import { ModuleCardItem, ModuleListItem, ModulePeekOverview, ModulesListGanttChartView } from "components/modules"; import { EmptyState } from "components/empty-state"; // ui import { CycleModuleBoardLayout, CycleModuleListLayout, GanttLayoutLoader } from "components/ui"; // constants import { EmptyStateType } from "constants/empty-state"; export const ModulesListView: React.FC = observer(() => { // router const router = useRouter(); const { workspaceSlug, projectId, peekModule } = router.query; // store hooks const { commandPalette: commandPaletteStore } = useApplication(); const { setTrackElement } = useEventTracker(); const { projectModuleIds, loader } = useModule(); const { storedValue: modulesView } = useLocalStorage("modules_view", "grid"); if (loader || !projectModuleIds) return ( <> {modulesView === "list" && } {modulesView === "grid" && } {modulesView === "gantt_chart" && } ); return ( <> {projectModuleIds.length > 0 ? ( <> {modulesView === "list" && (
{projectModuleIds.map((moduleId) => ( ))}
)} {modulesView === "grid" && (
{projectModuleIds.map((moduleId) => ( ))}
)} {modulesView === "gantt_chart" && } ) : ( { setTrackElement("Module empty state"); commandPaletteStore.toggleCreateModuleModal(true); }} /> )} ); });