forked from github/plane
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>
52 lines
1.8 KiB
TypeScript
52 lines
1.8 KiB
TypeScript
import React from "react";
|
|
import { useRouter } from "next/router";
|
|
import { observer } from "mobx-react-lite";
|
|
import useSWR from "swr";
|
|
// mobx store
|
|
import { useMobxStore } from "lib/mobx/store-provider";
|
|
import { DraftIssueAppliedFiltersRoot } from "../filters/applied-filters/roots/draft-issue";
|
|
import { DraftIssueListLayout } from "../list/roots/draft-issue-root";
|
|
import { Spinner } from "@plane/ui";
|
|
import { DraftKanBanLayout } from "../kanban/roots/draft-issue-root";
|
|
|
|
export const DraftIssueLayoutRoot: React.FC = observer(() => {
|
|
const router = useRouter();
|
|
const { workspaceSlug, projectId } = router.query as { workspaceSlug: string; projectId: string };
|
|
|
|
const {
|
|
projectDraftIssuesFilter: { issueFilters, fetchFilters },
|
|
projectDraftIssues: { loader, getIssues, fetchIssues },
|
|
} = useMobxStore();
|
|
|
|
useSWR(workspaceSlug && projectId ? `DRAFT_FILTERS_AND_ISSUES_${projectId.toString()}` : null, async () => {
|
|
if (workspaceSlug && projectId) {
|
|
await fetchFilters(workspaceSlug, projectId);
|
|
await fetchIssues(workspaceSlug, projectId, getIssues ? "mutation" : "init-loader");
|
|
}
|
|
});
|
|
|
|
const activeLayout = issueFilters?.displayFilters?.layout || undefined;
|
|
|
|
return (
|
|
<div className="relative w-full h-full flex flex-col overflow-hidden">
|
|
<DraftIssueAppliedFiltersRoot />
|
|
|
|
{loader === "init-loader" ? (
|
|
<div className="w-full h-full flex justify-center items-center">
|
|
<Spinner />
|
|
</div>
|
|
) : (
|
|
<>
|
|
<div className="w-full h-full relative overflow-auto">
|
|
{activeLayout === "list" ? (
|
|
<DraftIssueListLayout />
|
|
) : activeLayout === "kanban" ? (
|
|
<DraftKanBanLayout />
|
|
) : null}
|
|
</div>
|
|
</>
|
|
)}
|
|
</div>
|
|
);
|
|
});
|