import { FC } from "react"; import { observer } from "mobx-react-lite"; import Image from "next/image"; // types import { TCycleLayoutOptions } from "@plane/types"; // components import { CyclesBoard, CyclesList, CyclesListGanttChartView } from "@/components/cycles"; // ui import { CycleModuleBoardLayout, CycleModuleListLayout, GanttLayoutLoader } from "@/components/ui"; // hooks import { useCycle, useCycleFilter } from "@/hooks/store"; // assets import AllFiltersImage from "public/empty-state/cycle/all-filters.svg"; import NameFilterImage from "public/empty-state/cycle/name-filter.svg"; export interface ICyclesView { layout: TCycleLayoutOptions; workspaceSlug: string; projectId: string; peekCycle: string | undefined; } export const CyclesView: FC = observer((props) => { const { layout, workspaceSlug, projectId, peekCycle } = props; // store hooks const { getFilteredCycleIds, getFilteredCompletedCycleIds, loader } = useCycle(); const { searchQuery } = useCycleFilter(); // derived values const filteredCycleIds = getFilteredCycleIds(projectId, layout === "gantt"); const filteredCompletedCycleIds = getFilteredCompletedCycleIds(projectId); if (loader || !filteredCycleIds) return ( <> {layout === "list" && } {layout === "board" && } {layout === "gantt" && } ); if (filteredCycleIds.length === 0 && filteredCompletedCycleIds?.length === 0) return (
No matching cycles
No matching cycles

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

); return ( <> {layout === "list" && ( )} {layout === "board" && ( )} {layout === "gantt" && } ); });