2023-11-23 09:17:04 +00:00
|
|
|
import React from "react";
|
2023-10-18 07:02:02 +00:00
|
|
|
import { observer } from "mobx-react-lite";
|
|
|
|
// mobx store
|
|
|
|
import { useMobxStore } from "lib/mobx/store-provider";
|
|
|
|
// components
|
2023-11-23 09:17:04 +00:00
|
|
|
import { BaseSpreadsheetRoot } from "../base-spreadsheet-root";
|
2023-11-27 08:45:33 +00:00
|
|
|
import { EIssueActions } from "../../types";
|
|
|
|
import { IIssue } from "types";
|
|
|
|
import { useRouter } from "next/router";
|
|
|
|
import { ProjectIssueQuickActions } from "../../quick-action-dropdowns";
|
2023-10-18 07:02:02 +00:00
|
|
|
|
|
|
|
export const ProjectViewSpreadsheetLayout: React.FC = observer(() => {
|
2023-11-27 08:45:33 +00:00
|
|
|
const router = useRouter();
|
|
|
|
const { workspaceSlug } = router.query as { workspaceSlug: string };
|
|
|
|
|
2023-11-23 09:17:04 +00:00
|
|
|
const { viewIssues: projectViewIssuesStore, viewIssuesFilter: projectViewIssueFiltersStore } = useMobxStore();
|
2023-11-27 08:45:33 +00:00
|
|
|
|
|
|
|
const issueActions = {
|
|
|
|
[EIssueActions.UPDATE]: async (issue: IIssue) => {
|
|
|
|
if (!workspaceSlug) return;
|
|
|
|
|
|
|
|
await projectViewIssuesStore.updateIssue(workspaceSlug, issue.project, issue.id, issue);
|
|
|
|
},
|
|
|
|
[EIssueActions.DELETE]: async (issue: IIssue) => {
|
|
|
|
if (!workspaceSlug) return;
|
|
|
|
|
|
|
|
await projectViewIssuesStore.removeIssue(workspaceSlug, issue.project, issue.id);
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<BaseSpreadsheetRoot
|
|
|
|
issueStore={projectViewIssuesStore}
|
|
|
|
issueFiltersStore={projectViewIssueFiltersStore}
|
|
|
|
issueActions={issueActions}
|
|
|
|
QuickActions={ProjectIssueQuickActions}
|
|
|
|
/>
|
|
|
|
);
|
2023-10-18 07:02:02 +00:00
|
|
|
});
|