"use client"; import { observer } from "mobx-react-lite"; import useSWR from "swr"; // ui import { Disclosure } from "@headlessui/react"; import { Loader } from "@plane/ui"; // components import { ActiveCycleProductivity, ActiveCycleProgress, ActiveCycleStats, CycleListGroupHeader, CyclesListItem, } from "@/components/cycles"; import { EmptyState } from "@/components/empty-state"; // constants import { EmptyStateType } from "@/constants/empty-state"; // hooks import { useCycle } from "@/hooks/store"; interface IActiveCycleDetails { workspaceSlug: string; projectId: string; } export const ActiveCycleRoot: React.FC = observer((props) => { // props const { workspaceSlug, projectId } = props; // store hooks const { fetchActiveCycle, currentProjectActiveCycleId, getActiveCycleById } = useCycle(); // derived values const activeCycle = currentProjectActiveCycleId ? getActiveCycleById(currentProjectActiveCycleId) : null; // fetch active cycle details const { isLoading } = useSWR( workspaceSlug && projectId ? `PROJECT_ACTIVE_CYCLE_${projectId}` : null, workspaceSlug && projectId ? () => fetchActiveCycle(workspaceSlug, projectId) : null ); // show loader if active cycle is loading if (!activeCycle && isLoading) return ( ); return ( <> {({ open }) => ( <> {!activeCycle ? ( ) : (
{currentProjectActiveCycleId && ( )}
)}
)}
); });