"use client"; import { observer } from "mobx-react"; import { useParams, useRouter } from "next/navigation"; import useSWR from "swr"; // components import { EmptyState } from "@/components/common"; import { PageHead } from "@/components/core"; import { ProjectViewLayoutRoot } from "@/components/issues"; // hooks import { useProject, useProjectView } from "@/hooks/store"; // assets import emptyView from "public/empty-state/view.svg"; const ProjectViewIssuesPage = observer(() => { // router const router = useRouter(); const { workspaceSlug, projectId, viewId } = useParams(); // store hooks const { fetchViewDetails, getViewById } = useProjectView(); const { getProjectById } = useProject(); // derived values const projectView = viewId ? getViewById(viewId.toString()) : undefined; const project = projectId ? getProjectById(projectId.toString()) : undefined; const pageTitle = project?.name && projectView?.name ? `${project?.name} - ${projectView?.name}` : undefined; const { error } = useSWR( workspaceSlug && projectId && viewId ? `VIEW_DETAILS_${viewId.toString()}` : null, workspaceSlug && projectId && viewId ? () => fetchViewDetails(workspaceSlug.toString(), projectId.toString(), viewId.toString()) : null ); return ( <> {error ? ( router.push(`/${workspaceSlug}/projects/${projectId}/views`), }} /> ) : ( <> )} ); }); export default ProjectViewIssuesPage;