import { observer } from "mobx-react-lite"; import useSWR from "swr"; // ui import { Loader } from "@plane/ui"; // components import { ActiveCycleHeader, ActiveCycleProductivity, ActiveCycleProgress, ActiveCycleStats, UpcomingCyclesList, } from "@/components/cycles"; import { EmptyState } from "@/components/empty-state"; // constants import { EmptyStateType } from "@/constants/empty-state"; // hooks import { useCycle, useCycleFilter } 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, currentProjectUpcomingCycleIds, getActiveCycleById } = useCycle(); // cycle filters hook const { updateDisplayFilters } = useCycleFilter(); // 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 ); const handleEmptyStateAction = () => updateDisplayFilters(projectId, { active_tab: "all", }); // show loader if active cycle is loading if (!activeCycle && isLoading) return ( ); if (!activeCycle) { // show empty state if no active cycle is present if (currentProjectUpcomingCycleIds?.length === 0) return ; // show upcoming cycles list, if present else return ( <>
No active cycle

Create new cycles to find them here or check
{"'"}All{"'"} cycles tab to see all cycles or{" "}

); } return ( <>
{currentProjectUpcomingCycleIds && } ); });