import { FC } from "react"; import Link from "next/link"; // types import { ICycle } from "@plane/types"; // ui import { LinearProgressIndicator } from "@plane/ui"; // components import { EmptyState } from "@/components/empty-state"; // constants import { CYCLE_STATE_GROUPS_DETAILS } from "@/constants/cycle"; import { EmptyStateType } from "@/constants/empty-state"; export type ActiveCycleProgressProps = { workspaceSlug: string; projectId: string; cycle: ICycle; }; export const ActiveCycleProgress: FC = (props) => { const { workspaceSlug, projectId, cycle } = props; const progressIndicatorData = CYCLE_STATE_GROUPS_DETAILS.map((group, index) => ({ id: index, name: group.title, value: cycle.total_issues > 0 ? (cycle[group.key as keyof ICycle] as number) : 0, color: group.color, })); const groupedIssues: any = { completed: cycle.completed_issues, started: cycle.started_issues, unstarted: cycle.unstarted_issues, backlog: cycle.backlog_issues, }; return (

Progress

{cycle.total_issues > 0 && ( {`${cycle.completed_issues + cycle.cancelled_issues}/${cycle.total_issues - cycle.cancelled_issues} ${ cycle.completed_issues + cycle.cancelled_issues > 1 ? "Issues" : "Issue" } closed`} )}
{cycle.total_issues > 0 && }
{cycle.total_issues > 0 ? (
{Object.keys(groupedIssues).map((group, index) => ( <> {groupedIssues[group] > 0 && (
{group}
{`${groupedIssues[group]} ${ groupedIssues[group] > 1 ? "Issues" : "Issue" }`}
)} ))} {cycle.cancelled_issues > 0 && ( {`${cycle.cancelled_issues} cancelled ${ cycle.cancelled_issues > 1 ? "issues are" : "issue is" } excluded from this report.`}{" "} )}
) : (
)} ); };