diff --git a/web/components/issues/issue-layouts/gantt/base-gantt-root.tsx b/web/components/issues/issue-layouts/gantt/base-gantt-root.tsx index c0b93ce31..f467df208 100644 --- a/web/components/issues/issue-layouts/gantt/base-gantt-root.tsx +++ b/web/components/issues/issue-layouts/gantt/base-gantt-root.tsx @@ -54,20 +54,19 @@ export const BaseGanttRoot: React.FC = observer((props: IBaseGan const issues = issueIds.map((id) => issuesResponse?.[id]); - const updateIssue = async (issue: IIssue, payload: IBlockUpdateData) => { + const updateIssueBlockStructure = async (issue: IIssue, data: IBlockUpdateData) => { if (!workspaceSlug) return; - //Todo fix sort order in the structure - await issueStore.updateIssue( - workspaceSlug.toString(), - issue.project, - issue.id, - { - start_date: payload.start_date, - target_date: payload.target_date, - }, - viewId - ); + const payload: any = { ...data }; + if (data.sort_order) payload.sort_order = data.sort_order.newSortOrder; + + await issueStore.updateIssue(workspaceSlug.toString(), issue.project, issue.id, payload, viewId); + }; + + const updateIssue = async (projectId: string, issueId: string, payload: Partial) => { + if (!workspaceSlug) return; + + await issueStore.updateIssue(workspaceSlug.toString(), projectId, issueId, payload, viewId); }; const isAllowed = !!currentProjectRole && currentProjectRole >= EUserWorkspaceRoles.MEMBER; @@ -80,7 +79,7 @@ export const BaseGanttRoot: React.FC = observer((props: IBaseGan title="Issues" loaderTitle="Issues" blocks={issues ? renderIssueBlocksStructure(issues as IIssueUnGroupedStructure) : null} - blockUpdateHandler={updateIssue} + blockUpdateHandler={updateIssueBlockStructure} blockToRender={(data: IIssue) => } sidebarToRender={(props) => ( = observer((props: IBaseGan projectId={peekProjectId.toString()} issueId={peekIssueId.toString()} handleIssue={async (issueToUpdate) => { - // TODO: update the logic here - await updateIssue(issueToUpdate as IIssue, {}); + await updateIssue(peekProjectId.toString(), peekIssueId.toString(), issueToUpdate); }} /> )} diff --git a/web/components/issues/issue-layouts/gantt/cycle-root.tsx b/web/components/issues/issue-layouts/gantt/cycle-root.tsx index 70f92a933..536650694 100644 --- a/web/components/issues/issue-layouts/gantt/cycle-root.tsx +++ b/web/components/issues/issue-layouts/gantt/cycle-root.tsx @@ -7,9 +7,15 @@ import { useRouter } from "next/router"; export const CycleGanttLayout: React.FC = observer(() => { const router = useRouter(); - const { cycleId } = router.query as { cycleId: string }; + const { cycleId } = router.query; const { cycleIssues: cycleIssueStore, cycleIssuesFilter: cycleIssueFilterStore } = useMobxStore(); - return ; + return ( + + ); }); diff --git a/web/components/issues/issue-layouts/gantt/module-root.tsx b/web/components/issues/issue-layouts/gantt/module-root.tsx index 49467c558..79d1996dc 100644 --- a/web/components/issues/issue-layouts/gantt/module-root.tsx +++ b/web/components/issues/issue-layouts/gantt/module-root.tsx @@ -7,9 +7,15 @@ import { useRouter } from "next/router"; export const ModuleGanttLayout: React.FC = observer(() => { const router = useRouter(); - const { moduleId } = router.query as { moduleId: string }; + const { moduleId } = router.query; const { moduleIssues: moduleIssueStore, moduleIssuesFilter: moduleIssueFilterStore } = useMobxStore(); - return ; + return ( + + ); });