"use client"; import { useMemo } from "react"; import { observer } from "mobx-react"; import { Disclosure } from "@headlessui/react"; // plane imports import { useTranslation } from "@plane/i18n"; import { Row } from "@plane/ui"; // components import { ActiveCycleProductivity, ActiveCycleProgress, ActiveCycleStats, CycleListGroupHeader, CyclesListItem, } from "@/components/cycles"; import useCyclesDetails from "@/components/cycles/active-cycle/use-cycles-details"; import { DetailedEmptyState } from "@/components/empty-state"; // hooks import { useCycle } from "@/hooks/store"; import { useResolvedAssetPath } from "@/hooks/use-resolved-asset-path"; import { ActiveCycleIssueDetails } from "@/store/issue/cycle"; interface IActiveCycleDetails { workspaceSlug: string; projectId: string; cycleId?: string; showHeader?: boolean; } export const ActiveCycleRoot: React.FC = observer((props) => { const { workspaceSlug, projectId, cycleId: propsCycleId, showHeader = true } = props; // plane hooks const { t } = useTranslation(); // store hooks const { currentProjectActiveCycleId } = useCycle(); // derived values const cycleId = propsCycleId ?? currentProjectActiveCycleId; const activeCycleResolvedPath = useResolvedAssetPath({ basePath: "/empty-state/cycle/active" }); // fetch cycle details const { handleFiltersUpdate, cycle: activeCycle, cycleIssueDetails, } = useCyclesDetails({ workspaceSlug, projectId, cycleId }); const ActiveCyclesComponent = useMemo( () => ( <> {!cycleId || !activeCycle ? ( ) : (
{cycleId && ( )}
)} ), [cycleId, activeCycle, workspaceSlug, projectId, handleFiltersUpdate, cycleIssueDetails] ); return ( <> {showHeader ? ( {({ open }) => ( <> {ActiveCyclesComponent} )} ) : ( <>{ActiveCyclesComponent} )} ); });