// ui import { CustomMenu, LineGraph } from "components/ui"; // constants import { MONTHS } from "constants/project"; type Props = { issues: | { week_in_month: number; completed_count: number; }[] | undefined; month: number; setMonth: React.Dispatch>; }; export const CompletedIssuesGraph: React.FC = ({ month, issues, setMonth }) => { const weeks = month === 2 ? 4 : 5; const data: any[] = []; for (let i = 1; i <= weeks; i++) { data.push({ week_in_month: `Week ${i}`, completed_count: issues?.find((item) => item.week_in_month === i)?.completed_count ?? 0, }); } return (

Issues closed by you

{MONTHS[month - 1]}} noBorder> {MONTHS.map((month, index) => ( setMonth(index + 1)}> {month} ))}
{data.every((item) => item.completed_count === 0) ? (

No issues closed this month

) : ( <> ({ x: item.week_in_month, y: item.completed_count, })), }, ]} margin={{ top: 20, right: 20, bottom: 20, left: 20 }} customYAxisTickValues={data.map((item) => item.completed_count)} colors={(datum) => datum.color} enableSlices="x" sliceTooltip={(datum) => (
{datum.slice.points[0].data.yFormatted} issues closed in {datum.slice.points[0].data.xFormatted}
)} theme={{ background: "rgb(var(--color-background-100))", }} />

Completed Issues

)}
); };