import { useRouter } from "next/router"; import { observer } from "mobx-react-lite"; import { Plus } from "lucide-react"; // hooks import { useApplication, useModule, useUser } from "hooks/store"; import useLocalStorage from "hooks/use-local-storage"; // components import { ModuleCardItem, ModuleListItem, ModulePeekOverview, ModulesListGanttChartView } from "components/modules"; // ui import { Loader } from "@plane/ui"; // constants import { EUserProjectRoles } from "constants/project"; // assets import emptyModule from "public/empty-state/empty_modules.webp"; import { NewEmptyState } from "components/common/new-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 { membership: { currentProjectRole }, } = useUser(); const { projectModuleIds } = useModule(); const { storedValue: modulesView } = useLocalStorage("modules_view", "grid"); const isEditingAllowed = !!currentProjectRole && currentProjectRole >= EUserProjectRoles.MEMBER; if (!projectModuleIds) return ( ); return ( <> {projectModuleIds.length > 0 ? ( <> {modulesView === "list" && (
{projectModuleIds.map((moduleId) => ( ))}
)} {modulesView === "grid" && (
{projectModuleIds.map((moduleId) => ( ))}
)} {modulesView === "gantt_chart" && } ) : ( , text: "Build your first module", onClick: () => commandPaletteStore.toggleCreateModuleModal(true), }} disabled={!isEditingAllowed} /> )} ); });