2023-05-20 12:00:15 +00:00
|
|
|
import { useRouter } from "next/router";
|
2023-08-11 10:29:13 +00:00
|
|
|
|
2023-05-20 12:00:15 +00:00
|
|
|
// hooks
|
2023-08-11 10:29:13 +00:00
|
|
|
import useIssuesView from "hooks/use-issues-view";
|
|
|
|
import useUser from "hooks/use-user";
|
2023-05-20 12:00:15 +00:00
|
|
|
import useGanttChartCycleIssues from "hooks/gantt-chart/cycle-issues-view";
|
2023-08-11 10:29:13 +00:00
|
|
|
import { updateGanttIssue } from "components/gantt-chart/hooks/block-update";
|
|
|
|
// components
|
2023-08-28 07:55:47 +00:00
|
|
|
import { GanttChartRoot, renderIssueBlocksStructure } from "components/gantt-chart";
|
|
|
|
import { IssueGanttBlock, IssueGanttSidebarBlock } from "components/issues";
|
2023-08-11 10:29:13 +00:00
|
|
|
// types
|
|
|
|
import { IIssue } from "types";
|
|
|
|
|
|
|
|
export const CycleIssuesGanttChartView = () => {
|
2023-05-20 12:00:15 +00:00
|
|
|
const router = useRouter();
|
|
|
|
const { workspaceSlug, projectId, cycleId } = router.query;
|
|
|
|
|
2023-08-11 10:29:13 +00:00
|
|
|
const { orderBy } = useIssuesView();
|
|
|
|
|
|
|
|
const { user } = useUser();
|
|
|
|
|
2023-05-20 12:00:15 +00:00
|
|
|
const { ganttIssues, mutateGanttIssues } = useGanttChartCycleIssues(
|
|
|
|
workspaceSlug as string,
|
|
|
|
projectId as string,
|
|
|
|
cycleId as string
|
|
|
|
);
|
|
|
|
|
|
|
|
return (
|
2023-08-28 07:55:47 +00:00
|
|
|
<div className="w-full h-full">
|
2023-05-20 12:00:15 +00:00
|
|
|
<GanttChartRoot
|
2023-08-28 07:55:47 +00:00
|
|
|
border={false}
|
|
|
|
title="Issues"
|
|
|
|
loaderTitle="Issues"
|
2023-08-11 10:29:13 +00:00
|
|
|
blocks={ganttIssues ? renderIssueBlocksStructure(ganttIssues as IIssue[]) : null}
|
|
|
|
blockUpdateHandler={(block, payload) =>
|
|
|
|
updateGanttIssue(block, payload, mutateGanttIssues, user, workspaceSlug?.toString())
|
|
|
|
}
|
2023-08-28 07:55:47 +00:00
|
|
|
SidebarBlockRender={IssueGanttSidebarBlock}
|
|
|
|
BlockRender={IssueGanttBlock}
|
2023-08-11 10:29:13 +00:00
|
|
|
enableReorder={orderBy === "sort_order"}
|
2023-08-28 07:55:47 +00:00
|
|
|
bottomSpacing
|
2023-05-20 12:00:15 +00:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|