import { observer } from "mobx-react-lite"; import Image from "next/image"; import { useRouter } from "next/router"; // components import { ListLayout } from "@/components/core/list"; import { EmptyState } from "@/components/empty-state"; import { ModuleCardItem, ModuleListItem, ModulePeekOverview, ModulesListGanttChartView } from "@/components/modules"; import { CycleModuleBoardLayout, CycleModuleListLayout, GanttLayoutLoader } from "@/components/ui"; // constants import { EmptyStateType } from "@/constants/empty-state"; // hooks import { useCommandPalette, useEventTracker, useModule, useModuleFilter } from "@/hooks/store"; import AllFiltersImage from "public/empty-state/module/all-filters.svg"; import NameFilterImage from "public/empty-state/module/name-filter.svg"; export const ModulesListView: React.FC = observer(() => { // router const router = useRouter(); const { workspaceSlug, projectId, peekModule } = router.query; // store hooks const { toggleCreateModuleModal } = useCommandPalette(); const { setTrackElement } = useEventTracker(); const { getProjectModuleIds, getFilteredModuleIds, loader } = useModule(); const { currentProjectDisplayFilters: displayFilters, searchQuery } = useModuleFilter(); // derived values const projectModuleIds = projectId ? getProjectModuleIds(projectId.toString()) : undefined; const filteredModuleIds = projectId ? getFilteredModuleIds(projectId.toString()) : undefined; if (loader || !projectModuleIds || !filteredModuleIds) return ( <> {displayFilters?.layout === "list" && } {displayFilters?.layout === "board" && } {displayFilters?.layout === "gantt" && } > ); if (projectModuleIds.length === 0) return ( { setTrackElement("Module empty state"); toggleCreateModuleModal(true); }} /> ); if (filteredModuleIds.length === 0) return ( No matching modules {searchQuery.trim() === "" ? "Remove the filters to see all modules" : "Remove the search criteria to see all modules"} ); return ( <> {displayFilters?.layout === "list" && ( {filteredModuleIds.map((moduleId) => ( ))} )} {displayFilters?.layout === "board" && ( {filteredModuleIds.map((moduleId) => ( ))} )} {displayFilters?.layout === "gantt" && } > ); });
{searchQuery.trim() === "" ? "Remove the filters to see all modules" : "Remove the search criteria to see all modules"}