mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
9ad1e73666
* dev: fetch project gantt issues using mobx * chore: handle group by options in the kanban layout
60 lines
2.0 KiB
TypeScript
60 lines
2.0 KiB
TypeScript
import { useRouter } from "next/router";
|
|
import { observer } from "mobx-react-lite";
|
|
|
|
// mobx store
|
|
import { useMobxStore } from "lib/mobx/store-provider";
|
|
// hooks
|
|
import useProjectDetails from "hooks/use-project-details";
|
|
// components
|
|
import { GanttChartRoot, renderIssueBlocksStructure } from "components/gantt-chart";
|
|
import { IssueGanttBlock, IssueGanttSidebarBlock, IssuePeekOverview } from "components/issues";
|
|
// types
|
|
import { IIssueUnGroupedStructure } from "store/issue";
|
|
|
|
export const GanttLayout: React.FC = observer(() => {
|
|
const router = useRouter();
|
|
const { workspaceSlug, projectId } = router.query;
|
|
|
|
const { projectDetails } = useProjectDetails();
|
|
|
|
const { issue: issueStore, issueFilter: issueFilterStore } = useMobxStore();
|
|
|
|
const appliedDisplayFilters = issueFilterStore.userDisplayFilters;
|
|
|
|
const issues = issueStore.getIssues;
|
|
|
|
const isAllowed = projectDetails?.member_role === 20 || projectDetails?.member_role === 15;
|
|
|
|
console.log("issues", issues);
|
|
console.log("appliedFilters", issueFilterStore.appliedFilters);
|
|
|
|
return (
|
|
<>
|
|
<IssuePeekOverview
|
|
projectId={projectId?.toString() ?? ""}
|
|
workspaceSlug={workspaceSlug?.toString() ?? ""}
|
|
readOnly={!isAllowed}
|
|
/>
|
|
<div className="w-full h-full">
|
|
<GanttChartRoot
|
|
border={false}
|
|
title="Issues"
|
|
loaderTitle="Issues"
|
|
blocks={issues ? renderIssueBlocksStructure(issues as IIssueUnGroupedStructure) : null}
|
|
blockUpdateHandler={(block, payload) => {
|
|
// TODO: update mutation logic
|
|
// updateGanttIssue(block, payload, mutateGanttIssues, user, workspaceSlug?.toString())
|
|
}}
|
|
BlockRender={IssueGanttBlock}
|
|
SidebarBlockRender={IssueGanttSidebarBlock}
|
|
enableBlockLeftResize={isAllowed}
|
|
enableBlockRightResize={isAllowed}
|
|
enableBlockMove={isAllowed}
|
|
enableReorder={appliedDisplayFilters.order_by === "sort_order" && isAllowed}
|
|
bottomSpacing
|
|
/>
|
|
</div>
|
|
</>
|
|
);
|
|
});
|