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 { ModuleAppliedFiltersRoot, ModuleCalendarLayout, ModuleEmptyState, ModuleGanttLayout, ModuleKanBanLayout, ModuleListLayout, ModuleSpreadsheetLayout, } from "components/issues"; // ui import { Spinner } from "@plane/ui"; export const ModuleLayoutRoot: React.FC = observer(() => { const router = useRouter(); const { workspaceSlug, projectId, moduleId } = router.query as { workspaceSlug: string; projectId: string; moduleId: string; }; const { moduleIssues: { loader, getIssues, fetchIssues }, moduleIssuesFilter: { issueFilters, fetchFilters }, } = useMobxStore(); useSWR( workspaceSlug && projectId && moduleId ? `MODULE_ISSUES_V3_${workspaceSlug}_${projectId}_${moduleId}` : null, async () => { if (workspaceSlug && projectId && moduleId) { await fetchFilters(workspaceSlug, projectId, moduleId); await fetchIssues(workspaceSlug, projectId, getIssues ? "mutation" : "init-loader", moduleId); } } ); const activeLayout = issueFilters?.displayFilters?.layout || undefined; return (
{loader === "init-loader" ? (
) : ( <> {/* */}
{activeLayout === "list" ? ( ) : activeLayout === "kanban" ? ( ) : activeLayout === "calendar" ? ( ) : activeLayout === "gantt_chart" ? ( ) : activeLayout === "spreadsheet" ? ( ) : null}
)}
); });