import { FC } from "react"; import useSWR from "swr"; import { observer } from "mobx-react-lite"; // store import { useMobxStore } from "lib/mobx/store-provider"; // components import { CyclesBoard, CyclesList } from "components/cycles"; import { Loader } from "@plane/ui"; export interface ICyclesView { filter: "all" | "current" | "upcoming" | "draft" | "completed" | "incomplete"; view: "list" | "board" | "gantt"; workspaceSlug: string; projectId: string; } export const CyclesView: FC = observer((props) => { const { filter, view, workspaceSlug, projectId } = props; // store const { cycle: cycleStore } = useMobxStore(); // api call to fetch cycles list const { isLoading } = useSWR( workspaceSlug && projectId ? `CYCLES_LIST_${projectId}_${filter}` : null, workspaceSlug && projectId ? () => cycleStore.fetchCycles(workspaceSlug, projectId, filter) : null ); const cyclesList = cycleStore.cycles?.[projectId]; console.log("cyclesList", cyclesList); return ( <> {view === "list" && ( <> {!isLoading ? ( ) : ( )} )} {view === "board" && ( <> {!isLoading ? ( ) : ( )} )} {view === "gantt" && } ); });