import { FC } from "react"; // types import { ICycle } from "@plane/types"; // ui import { LinearProgressIndicator } from "@plane/ui"; // constants import { CYCLE_STATE_GROUPS_DETAILS } from "@/constants/cycle"; export type ActiveCycleProgressProps = { cycle: ICycle; }; export const ActiveCycleProgress: FC = (props) => { const { 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.completed_issues + cycle.cancelled_issues}/${cycle.total_issues - cycle.cancelled_issues} ${ cycle.completed_issues + cycle.cancelled_issues > 1 ? "Issues" : "Issue" } closed`}
{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.`}{" "} )}
); };