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 { ListLayout, CalendarLayout, GanttLayout, KanBanLayout, ProjectAppliedFiltersRoot, ProjectSpreadsheetLayout, ProjectEmptyState, } from "components/issues"; import { Spinner } from "@plane/ui"; export const ProjectLayoutRoot: React.FC = observer(() => { const router = useRouter(); const { workspaceSlug, projectId } = router.query; const { issue: issueStore, issueFilter: issueFilterStore } = useMobxStore(); const { isLoading } = useSWR( workspaceSlug && projectId ? `PROJECT_FILTERS_AND_ISSUES_${projectId.toString()}` : null, async () => { if (workspaceSlug && projectId) { await issueFilterStore.fetchUserProjectFilters(workspaceSlug.toString(), projectId.toString()); await issueStore.fetchIssues(workspaceSlug.toString(), projectId.toString()); } } ); const activeLayout = issueFilterStore.userDisplayFilters.layout; const issueCount = issueStore.getIssuesCount; if (!issueStore.getIssues) return (
); return (
{(activeLayout === "list" || activeLayout === "spreadsheet") && issueCount === 0 ? ( ) : (
{activeLayout === "list" ? ( ) : activeLayout === "kanban" ? ( ) : activeLayout === "calendar" ? ( ) : activeLayout === "gantt_chart" ? ( ) : activeLayout === "spreadsheet" ? ( ) : null}
)}
); });