mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
8d15b9e7de
* chore: format all files in the project * fix: removing @types/react from dependencies * fix: adding prettier and eslint config * chore: format files * fix: upgrading turbo version * chore: ignoring warnings and adding todos * fix: updated the type of bubble menu item in the document editor * chore: format files --------- Co-authored-by: Aaryan Khandelwal <aaryankhandu123@gmail.com>
69 lines
2.1 KiB
TypeScript
69 lines
2.1 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";
|
|
// components
|
|
import {
|
|
ProjectViewAppliedFiltersRoot,
|
|
ProjectViewCalendarLayout,
|
|
ProjectViewGanttLayout,
|
|
ProjectViewKanBanLayout,
|
|
ProjectViewListLayout,
|
|
ProjectViewSpreadsheetLayout,
|
|
} from "components/issues";
|
|
import { Spinner } from "@plane/ui";
|
|
|
|
export const ProjectViewLayoutRoot: React.FC = observer(() => {
|
|
const router = useRouter();
|
|
const { workspaceSlug, projectId, viewId } = router.query as {
|
|
workspaceSlug: string;
|
|
projectId: string;
|
|
viewId?: string;
|
|
};
|
|
|
|
const {
|
|
viewIssues: { loader, getIssues, fetchIssues },
|
|
viewIssuesFilter: { issueFilters, fetchFilters },
|
|
} = useMobxStore();
|
|
|
|
useSWR(workspaceSlug && projectId && viewId ? `PROJECT_ISSUES_V3_${workspaceSlug}_${projectId}` : null, async () => {
|
|
if (workspaceSlug && projectId && viewId) {
|
|
await fetchFilters(workspaceSlug, projectId, viewId);
|
|
await fetchIssues(workspaceSlug, projectId, getIssues ? "mutation" : "init-loader");
|
|
}
|
|
});
|
|
|
|
const activeLayout = issueFilters?.displayFilters?.layout;
|
|
|
|
return (
|
|
<div className="relative flex h-full w-full flex-col overflow-hidden">
|
|
<ProjectViewAppliedFiltersRoot />
|
|
|
|
{loader === "init-loader" ? (
|
|
<div className="flex h-full w-full items-center justify-center">
|
|
<Spinner />
|
|
</div>
|
|
) : (
|
|
<>
|
|
<div className="relative h-full w-full overflow-auto">
|
|
{activeLayout === "list" ? (
|
|
<ProjectViewListLayout />
|
|
) : activeLayout === "kanban" ? (
|
|
<ProjectViewKanBanLayout />
|
|
) : activeLayout === "calendar" ? (
|
|
<ProjectViewCalendarLayout />
|
|
) : activeLayout === "gantt_chart" ? (
|
|
<ProjectViewGanttLayout />
|
|
) : activeLayout === "spreadsheet" ? (
|
|
<ProjectViewSpreadsheetLayout />
|
|
) : null}
|
|
</div>
|
|
</>
|
|
)}
|
|
</div>
|
|
);
|
|
});
|