mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
f79bd9df60
* dev: draft and archived issue store * connect draft and archived issues * kanban for draft issues * fix filter store for calendar and kanban * dev: profile issues store and draft issues filters in header * disble issue creation for draft issues * dev: profile issues store filters * disable kanban properties in draft issues * dev: profile issues store filters * dev: seperated adding issues to the cycle and module as seperate methds in cycle and module store * dev: workspace profile issues store * dev: sub group issues in the swimlanes * profile issues and create issue connection * fix profile issues * fix spreadsheet issues * fix dissapearing project from create issue modal * page level modifications * fix additional bugs * dev: issues profile and global iisues and filters update * fix issue related bugs * fix project views for list and kanban * fix build errors --------- Co-authored-by: rahulramesha <rahulramesham@gmail.com>
113 lines
3.7 KiB
TypeScript
113 lines
3.7 KiB
TypeScript
import { IIssueUnGroupedStructure } from "store/issue";
|
|
import { SpreadsheetView } from "./spreadsheet-view";
|
|
import { FC, useCallback } from "react";
|
|
import { IIssue, IIssueDisplayFilterOptions } from "types";
|
|
import { useRouter } from "next/router";
|
|
import { useMobxStore } from "lib/mobx/store-provider";
|
|
import {
|
|
ICycleIssuesFilterStore,
|
|
ICycleIssuesStore,
|
|
IModuleIssuesFilterStore,
|
|
IModuleIssuesStore,
|
|
IProjectIssuesFilterStore,
|
|
IProjectIssuesStore,
|
|
IViewIssuesFilterStore,
|
|
IViewIssuesStore,
|
|
} from "store/issues";
|
|
import { observer } from "mobx-react-lite";
|
|
import { EFilterType, TUnGroupedIssues } from "store/issues/types";
|
|
import { EIssueActions } from "../types";
|
|
import { IQuickActionProps } from "../list/list-view-types";
|
|
|
|
interface IBaseSpreadsheetRoot {
|
|
issueFiltersStore:
|
|
| IViewIssuesFilterStore
|
|
| ICycleIssuesFilterStore
|
|
| IModuleIssuesFilterStore
|
|
| IProjectIssuesFilterStore;
|
|
issueStore: IProjectIssuesStore | IModuleIssuesStore | ICycleIssuesStore | IViewIssuesStore;
|
|
viewId?: string;
|
|
QuickActions: FC<IQuickActionProps>;
|
|
issueActions: {
|
|
[EIssueActions.DELETE]: (issue: IIssue) => void;
|
|
[EIssueActions.UPDATE]?: (issue: IIssue) => void;
|
|
[EIssueActions.REMOVE]?: (issue: IIssue) => void;
|
|
};
|
|
}
|
|
|
|
export const BaseSpreadsheetRoot = observer((props: IBaseSpreadsheetRoot) => {
|
|
const { issueFiltersStore, issueStore, viewId, QuickActions, issueActions } = props;
|
|
|
|
const router = useRouter();
|
|
const { workspaceSlug, projectId } = router.query as { workspaceSlug: string; projectId: string };
|
|
|
|
const {
|
|
projectMember: { projectMembers },
|
|
projectState: projectStateStore,
|
|
projectLabel: { projectLabels },
|
|
user: userStore,
|
|
} = useMobxStore();
|
|
|
|
const user = userStore.currentUser;
|
|
|
|
const issuesResponse = issueStore.getIssues;
|
|
const issueIds = (issueStore.getIssuesIds ?? []) as TUnGroupedIssues;
|
|
|
|
const issues = issueIds?.filter((id) => id && issuesResponse?.[id]).map((id) => issuesResponse?.[id]);
|
|
|
|
const handleIssues = useCallback(
|
|
async (issue: IIssue, action: EIssueActions) => {
|
|
if (issueActions[action]) {
|
|
issueActions[action]!(issue);
|
|
}
|
|
},
|
|
[issueStore]
|
|
);
|
|
|
|
const handleDisplayFiltersUpdate = useCallback(
|
|
(updatedDisplayFilter: Partial<IIssueDisplayFilterOptions>) => {
|
|
if (!workspaceSlug || !projectId) return;
|
|
|
|
issueFiltersStore.updateFilters(
|
|
workspaceSlug,
|
|
projectId,
|
|
EFilterType.DISPLAY_FILTERS,
|
|
{
|
|
...updatedDisplayFilter,
|
|
},
|
|
viewId
|
|
);
|
|
},
|
|
[issueFiltersStore, projectId, workspaceSlug]
|
|
);
|
|
|
|
return (
|
|
<SpreadsheetView
|
|
displayProperties={issueFiltersStore.issueFilters?.displayProperties ?? {}}
|
|
displayFilters={issueFiltersStore.issueFilters?.displayFilters ?? {}}
|
|
handleDisplayFilterUpdate={handleDisplayFiltersUpdate}
|
|
issues={issues as IIssueUnGroupedStructure}
|
|
quickActions={(issue) => (
|
|
<QuickActions
|
|
issue={issue}
|
|
handleDelete={async () => handleIssues(issue, EIssueActions.DELETE)}
|
|
handleUpdate={
|
|
issueActions[EIssueActions.UPDATE] ? async (data) => handleIssues(data, EIssueActions.UPDATE) : undefined
|
|
}
|
|
handleRemoveFromView={
|
|
issueActions[EIssueActions.REMOVE] ? async () => handleIssues(issue, EIssueActions.REMOVE) : undefined
|
|
}
|
|
/>
|
|
)}
|
|
members={projectMembers?.map((m) => m.member)}
|
|
labels={projectLabels || undefined}
|
|
states={projectId ? projectStateStore.states?.[projectId.toString()] : undefined}
|
|
handleIssues={handleIssues}
|
|
disableUserActions={false}
|
|
quickAddCallback={issueStore.quickAddIssue}
|
|
viewId={viewId}
|
|
enableQuickCreateIssue
|
|
/>
|
|
);
|
|
});
|