2024-03-20 13:49:14 +00:00
|
|
|
import { FC } from "react";
|
2024-05-27 13:54:11 +00:00
|
|
|
import Link from "next/link";
|
2024-03-20 13:49:14 +00:00
|
|
|
// types
|
|
|
|
import { ICycle } from "@plane/types";
|
|
|
|
// components
|
|
|
|
import ProgressChart from "@/components/core/sidebar/progress-chart";
|
2024-03-25 07:46:53 +00:00
|
|
|
import { EmptyState } from "@/components/empty-state";
|
|
|
|
// constants
|
|
|
|
import { EmptyStateType } from "@/constants/empty-state";
|
2024-03-20 13:49:14 +00:00
|
|
|
|
|
|
|
export type ActiveCycleProductivityProps = {
|
2024-05-27 13:54:11 +00:00
|
|
|
workspaceSlug: string;
|
|
|
|
projectId: string;
|
2024-03-20 13:49:14 +00:00
|
|
|
cycle: ICycle;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const ActiveCycleProductivity: FC<ActiveCycleProductivityProps> = (props) => {
|
2024-05-27 13:54:11 +00:00
|
|
|
const { workspaceSlug, projectId, cycle } = props;
|
2024-03-20 13:49:14 +00:00
|
|
|
|
|
|
|
return (
|
2024-05-27 13:54:11 +00:00
|
|
|
<Link
|
|
|
|
href={`/${workspaceSlug}/projects/${projectId}/cycles/${cycle?.id}`}
|
|
|
|
className="flex flex-col justify-center min-h-[17rem] gap-5 py-4 px-3.5 bg-custom-background-100 border border-custom-border-200 rounded-lg"
|
|
|
|
>
|
2024-03-20 13:49:14 +00:00
|
|
|
<div className="flex items-center justify-between gap-4">
|
|
|
|
<h3 className="text-base text-custom-text-300 font-semibold">Issue burndown</h3>
|
|
|
|
</div>
|
2024-03-25 07:46:53 +00:00
|
|
|
{cycle.total_issues > 0 ? (
|
|
|
|
<>
|
|
|
|
<div className="h-full w-full px-2">
|
|
|
|
<div className="flex items-center justify-between gap-4 py-1 text-xs text-custom-text-300">
|
|
|
|
<div className="flex items-center gap-3 text-custom-text-300">
|
|
|
|
<div className="flex items-center justify-center gap-1">
|
|
|
|
<span className="h-2 w-2 rounded-full bg-[#A9BBD0]" />
|
|
|
|
<span>Ideal</span>
|
|
|
|
</div>
|
|
|
|
<div className="flex items-center justify-center gap-1">
|
|
|
|
<span className="h-2 w-2 rounded-full bg-[#4C8FFF]" />
|
|
|
|
<span>Current</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<span>{`Pending issues - ${cycle.backlog_issues + cycle.unstarted_issues + cycle.started_issues}`}</span>
|
2024-03-20 13:49:14 +00:00
|
|
|
</div>
|
2024-03-25 07:46:53 +00:00
|
|
|
<div className="relative h-full">
|
|
|
|
<ProgressChart
|
|
|
|
className="h-full"
|
|
|
|
distribution={cycle.distribution?.completion_chart ?? {}}
|
|
|
|
startDate={cycle.start_date ?? ""}
|
|
|
|
endDate={cycle.end_date ?? ""}
|
|
|
|
totalIssues={cycle.total_issues}
|
|
|
|
/>
|
2024-03-20 13:49:14 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-03-25 07:46:53 +00:00
|
|
|
</>
|
|
|
|
) : (
|
|
|
|
<>
|
|
|
|
<div className="flex items-center justify-center h-full w-full">
|
|
|
|
<EmptyState type={EmptyStateType.ACTIVE_CYCLE_CHART_EMPTY_STATE} layout="screen-simple" size="sm" />
|
|
|
|
</div>
|
|
|
|
</>
|
|
|
|
)}
|
2024-05-27 13:54:11 +00:00
|
|
|
</Link>
|
2024-03-20 13:49:14 +00:00
|
|
|
);
|
|
|
|
};
|