import Image from "next/image"; import { observer } from "mobx-react-lite"; import { useRouter } from "next/router"; // hooks import { useApplication, useEventTracker, useModule, useModuleFilter } from "hooks/store"; // components import { ModuleCardItem, ModuleListItem, ModulePeekOverview, ModulesListGanttChartView } from "components/modules"; import { EmptyState } from "components/empty-state"; // ui import { CycleModuleBoardLayout, CycleModuleListLayout, GanttLayoutLoader } from "components/ui"; // assets import NameFilterImage from "public/empty-state/module/name-filter.svg"; import AllFiltersImage from "public/empty-state/module/all-filters.svg"; // 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 { getFilteredModuleIds, loader } = useModule(); const { currentProjectDisplayFilters: displayFilters, searchQuery } = useModuleFilter(); // derived values const filteredModuleIds = projectId ? getFilteredModuleIds(projectId.toString()) : undefined; if (loader || !filteredModuleIds) return ( <> {displayFilters?.layout === "list" && } {displayFilters?.layout === "board" && } {displayFilters?.layout === "gantt" && } ); if (filteredModuleIds.length === 0) return (
No matching modules
No matching modules

{searchQuery.trim() === "" ? "Remove the filters to see all modules" : "Remove the search criteria to see all modules"}

); return ( <> {filteredModuleIds.length > 0 ? ( <> {displayFilters?.layout === "list" && (
{filteredModuleIds.map((moduleId) => ( ))}
)} {displayFilters?.layout === "board" && (
{filteredModuleIds.map((moduleId) => ( ))}
)} {displayFilters?.layout === "gantt" && } ) : ( { setTrackElement("Module empty state"); commandPaletteStore.toggleCreateModuleModal(true); }} /> )} ); });