import { useEffect } from "react"; import Image from "next/image"; import { useRouter } from "next/router"; import { observer } from "mobx-react-lite"; // components import { IssueListView } from "components/issues/board-views/list"; import { IssueKanbanView } from "components/issues/board-views/kanban"; import { IssueCalendarView } from "components/issues/board-views/calendar"; import { IssueSpreadsheetView } from "components/issues/board-views/spreadsheet"; import { IssueGanttView } from "components/issues/board-views/gantt"; import { IssuePeekOverview } from "components/issues/peek-overview"; // mobx store import { RootStore } from "store/root"; import { useMobxStore } from "lib/mobx/store-provider"; // assets import SomethingWentWrongImage from "public/something-went-wrong.svg"; export const ProjectDetailsView = observer(() => { const router = useRouter(); const { workspace_slug, project_slug, states, labels, priorities, peekId } = router.query; const { issue: issueStore, project: projectStore, issueDetails: issueDetailStore, user: userStore, }: RootStore = useMobxStore(); useEffect(() => { if (!userStore.currentUser) { userStore.fetchCurrentUser(); } }, [userStore]); useEffect(() => { if (workspace_slug && project_slug) { const params = { state: states || null, labels: labels || null, priority: priorities || null, }; issueStore.fetchPublicIssues(workspace_slug?.toString(), project_slug.toString(), params); } }, [workspace_slug, project_slug, issueStore, states, labels, priorities]); useEffect(() => { if (peekId && workspace_slug && project_slug) { issueDetailStore.setPeekId(peekId.toString()); } }, [peekId, issueDetailStore, project_slug, workspace_slug]); return (
{workspace_slug && } {issueStore?.loader && !issueStore.issues ? (
Loading...
) : ( <> {issueStore?.error ? (
Oops! Something went wrong

Oops! Something went wrong.

The public board does not exist. Please check the URL.

) : ( projectStore?.activeBoard && ( <> {projectStore?.activeBoard === "list" && (
)} {projectStore?.activeBoard === "kanban" && (
)} {projectStore?.activeBoard === "calendar" && } {projectStore?.activeBoard === "spreadsheet" && } {projectStore?.activeBoard === "gantt" && } ) )} )}
); });