mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
4611ec0b83
* fix: handled undefined issue_id in list layout * dev: issue detail store and optimization * dev: issue filter and list operations * fix: typo on labels update * dev: Handled all issues in the list layout in project issues * dev: handled kanban and auick add issue in swimlanes * chore: fixed peekoverview in kanban * chore: fixed peekoverview in calendar * chore: fixed peekoverview in gantt * chore: updated quick add in the gantt chart * chore: handled issue detail properties and resolved build issues --------- Co-authored-by: pablohashescobar <nikhilschacko@gmail.com>
78 lines
2.5 KiB
TypeScript
78 lines
2.5 KiB
TypeScript
import React from "react";
|
|
import { useRouter } from "next/router";
|
|
import { observer } from "mobx-react-lite";
|
|
import useSWR from "swr";
|
|
// mobx store
|
|
import { useIssues } from "hooks/store";
|
|
// components
|
|
import {
|
|
ProjectEmptyState,
|
|
ProjectViewAppliedFiltersRoot,
|
|
ProjectViewCalendarLayout,
|
|
ProjectViewGanttLayout,
|
|
ProjectViewKanBanLayout,
|
|
ProjectViewListLayout,
|
|
ProjectViewSpreadsheetLayout,
|
|
} from "components/issues";
|
|
import { Spinner } from "@plane/ui";
|
|
import { EIssuesStoreType } from "constants/issue";
|
|
|
|
export const ProjectViewLayoutRoot: React.FC = observer(() => {
|
|
// router
|
|
const router = useRouter();
|
|
const { workspaceSlug, projectId, viewId } = router.query;
|
|
// hooks
|
|
const { issues, issuesFilter } = useIssues(EIssuesStoreType.PROJECT_VIEW);
|
|
|
|
useSWR(
|
|
workspaceSlug && projectId && viewId ? `PROJECT_VIEW_ISSUES_${workspaceSlug}_${projectId}` : null,
|
|
async () => {
|
|
if (workspaceSlug && projectId && viewId) {
|
|
await issuesFilter?.fetchFilters(workspaceSlug.toString(), projectId.toString(), viewId.toString());
|
|
await issues?.fetchIssues(
|
|
workspaceSlug.toString(),
|
|
projectId.toString(),
|
|
issues?.groupedIssueIds ? "mutation" : "init-loader",
|
|
viewId.toString()
|
|
);
|
|
}
|
|
}
|
|
);
|
|
|
|
const activeLayout = issuesFilter?.issueFilters?.displayFilters?.layout;
|
|
|
|
if (!workspaceSlug || !projectId || !viewId) return <></>;
|
|
return (
|
|
<div className="relative flex h-full w-full flex-col overflow-hidden">
|
|
<ProjectViewAppliedFiltersRoot />
|
|
|
|
{issues?.loader === "init-loader" ? (
|
|
<div className="flex h-full w-full items-center justify-center">
|
|
<Spinner />
|
|
</div>
|
|
) : (
|
|
<>
|
|
{!issues?.groupedIssueIds ? (
|
|
// TODO: Replace this with project view empty state
|
|
<ProjectEmptyState />
|
|
) : (
|
|
<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>
|
|
);
|
|
});
|