mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
9ad1e73666
* dev: fetch project gantt issues using mobx * chore: handle group by options in the kanban layout
48 lines
1.5 KiB
TypeScript
48 lines
1.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 { useMobxStore } from "lib/mobx/store-provider";
|
|
// components
|
|
import { CalendarLayout, GanttLayout, KanBanLayout } from "components/issues";
|
|
|
|
export const AllViews: React.FC = observer(() => {
|
|
const router = useRouter();
|
|
const { workspaceSlug, projectId } = router.query as {
|
|
workspaceSlug: string;
|
|
projectId: string;
|
|
cycleId: string;
|
|
moduleId: string;
|
|
};
|
|
|
|
const { issue: issueStore, project: projectStore, issueFilter: issueFilterStore } = useMobxStore();
|
|
|
|
useSWR(workspaceSlug && projectId ? `PROJECT_ISSUES` : null, async () => {
|
|
if (workspaceSlug && projectId) {
|
|
await issueFilterStore.fetchUserProjectFilters(workspaceSlug, projectId);
|
|
|
|
await projectStore.fetchProjectStates(workspaceSlug, projectId);
|
|
await projectStore.fetchProjectLabels(workspaceSlug, projectId);
|
|
await projectStore.fetchProjectMembers(workspaceSlug, projectId);
|
|
|
|
await issueStore.fetchIssues(workspaceSlug, projectId);
|
|
}
|
|
});
|
|
|
|
const activeLayout = issueFilterStore.userDisplayFilters.layout;
|
|
|
|
return (
|
|
<div className="relative w-full h-full overflow-auto">
|
|
{activeLayout === "kanban" ? (
|
|
<KanBanLayout />
|
|
) : activeLayout === "calendar" ? (
|
|
<CalendarLayout />
|
|
) : activeLayout === "gantt_chart" ? (
|
|
<GanttLayout />
|
|
) : null}
|
|
</div>
|
|
);
|
|
});
|