fix: gantt chart blocks drag and resize logic (#2516)
This commit is contained in:
parent
c739b7235d
commit
05a76c5ee3
8 changed files with 234 additions and 63 deletions
|
|
@ -6,14 +6,14 @@ 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";
|
||||
import { GanttChartRoot, IBlockUpdateData, renderIssueBlocksStructure } from "components/gantt-chart";
|
||||
import { IssueGanttBlock, IssueGanttSidebarBlock } from "components/issues";
|
||||
// types
|
||||
import { IIssueUnGroupedStructure } from "store/issue";
|
||||
|
||||
export const ProjectViewGanttLayout: React.FC = observer(() => {
|
||||
const router = useRouter();
|
||||
const { workspaceSlug, projectId } = router.query;
|
||||
const { workspaceSlug, viewId } = router.query;
|
||||
|
||||
const { projectDetails } = useProjectDetails();
|
||||
|
||||
|
|
@ -23,26 +23,23 @@ export const ProjectViewGanttLayout: React.FC = observer(() => {
|
|||
|
||||
const issues = projectViewIssuesStore.getIssues;
|
||||
|
||||
const updateIssue = (block: any, payload: IBlockUpdateData) => {
|
||||
if (!workspaceSlug || !viewId) return;
|
||||
|
||||
projectViewIssuesStore.updateGanttIssueStructure(workspaceSlug.toString(), viewId.toString(), block, payload);
|
||||
};
|
||||
|
||||
const isAllowed = projectDetails?.member_role === 20 || projectDetails?.member_role === 15;
|
||||
|
||||
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}
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
blockUpdateHandler={(block, payload) => {
|
||||
// TODO: update mutation logic
|
||||
// updateGanttIssue(block, payload, mutateGanttIssues, user, workspaceSlug?.toString())
|
||||
}}
|
||||
blockUpdateHandler={updateIssue}
|
||||
BlockRender={IssueGanttBlock}
|
||||
SidebarBlockRender={IssueGanttSidebarBlock}
|
||||
enableBlockLeftResize={isAllowed}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue