mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
efd3ebf067
* refactor: updated preloaded function for the list view quick add * fix: resolved bug in the assignee dropdown * chore: issue sidebar link improvement * fix: resolved subscription store bug * chore: updated preloaded function for the kanban layout quick add * chore: resolved issues in the list filters and component * chore: filter store updated * fix: issue serializer changed * chore: quick add preload function updated * fix: build error * fix: serializer changed * fix: minor request change * chore: resolved build issues and updated the prepopulated data in the quick add issue. * fix: build fix and code refactor * fix: spreadsheet layout quick add fix * fix: issue peek overview link section updated * fix: cycle status bug fix * fix: serializer changes * fix: assignee and labels listing * chore: issue modal parent_id default value updated * fix: cycle and module issue serializer change * fix: cycle list serializer changed * chore: prepopulated validation in both list and kanban for quick add and group header add issues * chore: group header validation added * fix: issue response payload change * dev: make cycle and module issue create response simillar * chore: custom control link component added * dev: make issue create and update response simillar to list and retrieve * fix: build error * chore: control link component improvement * chore: globalise issue peek overview * chore: control link component improvement * chore: made changes and optimised the issue peek overview root * build-error: resolved build erros for issueId dependancy from issue detail store * chore: peek overview link fix * dev: update state nullable rule --------- Co-authored-by: gurusainath <gurusainath007@gmail.com> Co-authored-by: NarayanBavisetti <narayan3119@gmail.com> Co-authored-by: pablohashescobar <nikhilschacko@gmail.com>
90 lines
3.2 KiB
TypeScript
90 lines
3.2 KiB
TypeScript
import React from "react";
|
|
import { useRouter } from "next/router";
|
|
import { observer } from "mobx-react-lite";
|
|
// hooks
|
|
import { useIssues, useUser } from "hooks/store";
|
|
// components
|
|
import { IssueGanttBlock } from "components/issues";
|
|
import {
|
|
GanttChartRoot,
|
|
IBlockUpdateData,
|
|
renderIssueBlocksStructure,
|
|
IssueGanttSidebar,
|
|
} from "components/gantt-chart";
|
|
// types
|
|
import { TIssue, TUnGroupedIssues } from "@plane/types";
|
|
import { EUserProjectRoles } from "constants/project";
|
|
import { ICycleIssues, ICycleIssuesFilter } from "store/issue/cycle";
|
|
import { IModuleIssues, IModuleIssuesFilter } from "store/issue/module";
|
|
import { IProjectIssues, IProjectIssuesFilter } from "store/issue/project";
|
|
import { IProjectViewIssues, IProjectViewIssuesFilter } from "store/issue/project-views";
|
|
import { EIssueActions } from "../types";
|
|
|
|
interface IBaseGanttRoot {
|
|
issueFiltersStore: IProjectIssuesFilter | IModuleIssuesFilter | ICycleIssuesFilter | IProjectViewIssuesFilter;
|
|
issueStore: IProjectIssues | IModuleIssues | ICycleIssues | IProjectViewIssues;
|
|
viewId?: string;
|
|
issueActions: {
|
|
[EIssueActions.DELETE]: (issue: TIssue) => Promise<void>;
|
|
[EIssueActions.UPDATE]?: (issue: TIssue) => Promise<void>;
|
|
[EIssueActions.REMOVE]?: (issue: TIssue) => Promise<void>;
|
|
};
|
|
}
|
|
|
|
export const BaseGanttRoot: React.FC<IBaseGanttRoot> = observer((props: IBaseGanttRoot) => {
|
|
const { issueFiltersStore, issueStore, viewId } = props;
|
|
// router
|
|
const router = useRouter();
|
|
const { workspaceSlug } = router.query;
|
|
// store hooks
|
|
const {
|
|
membership: { currentProjectRole },
|
|
} = useUser();
|
|
const { issueMap } = useIssues();
|
|
const appliedDisplayFilters = issueFiltersStore.issueFilters?.displayFilters;
|
|
|
|
const issueIds = (issueStore.groupedIssueIds ?? []) as TUnGroupedIssues;
|
|
const { enableIssueCreation } = issueStore?.viewFlags || {};
|
|
|
|
const issues = issueIds.map((id) => issueMap?.[id]);
|
|
|
|
const updateIssueBlockStructure = async (issue: TIssue, data: IBlockUpdateData) => {
|
|
if (!workspaceSlug) return;
|
|
|
|
const payload: any = { ...data };
|
|
if (data.sort_order) payload.sort_order = data.sort_order.newSortOrder;
|
|
|
|
await issueStore.updateIssue(workspaceSlug.toString(), issue.project_id, issue.id, payload, viewId);
|
|
};
|
|
|
|
const isAllowed = !!currentProjectRole && currentProjectRole >= EUserProjectRoles.MEMBER;
|
|
|
|
return (
|
|
<>
|
|
<div className="h-full w-full">
|
|
<GanttChartRoot
|
|
border={false}
|
|
title="Issues"
|
|
loaderTitle="Issues"
|
|
blocks={issues ? renderIssueBlocksStructure(issues as TIssue[]) : null}
|
|
blockUpdateHandler={updateIssueBlockStructure}
|
|
blockToRender={(data: TIssue) => <IssueGanttBlock data={data} />}
|
|
sidebarToRender={(props) => (
|
|
<IssueGanttSidebar
|
|
{...props}
|
|
quickAddCallback={issueStore.quickAddIssue}
|
|
viewId={viewId}
|
|
enableQuickIssueCreate
|
|
disableIssueCreation={!enableIssueCreation || !isAllowed}
|
|
/>
|
|
)}
|
|
enableBlockLeftResize={isAllowed}
|
|
enableBlockRightResize={isAllowed}
|
|
enableBlockMove={isAllowed}
|
|
enableReorder={appliedDisplayFilters?.order_by === "sort_order" && isAllowed}
|
|
/>
|
|
</div>
|
|
</>
|
|
);
|
|
});
|