2024-01-24 15:03:54 +00:00
|
|
|
import { ReactElement } from "react";
|
2024-03-06 13:09:14 +00:00
|
|
|
import { observer } from "mobx-react";
|
2024-01-24 15:03:54 +00:00
|
|
|
import { useRouter } from "next/router";
|
2024-04-08 13:41:47 +00:00
|
|
|
// components
|
|
|
|
import { PageHead } from "@/components/core";
|
|
|
|
import { EmptyState } from "@/components/empty-state";
|
2024-03-19 14:38:35 +00:00
|
|
|
import { ProjectInboxHeader } from "@/components/headers";
|
2024-04-08 13:41:47 +00:00
|
|
|
import { InboxIssueRoot } from "@/components/inbox";
|
|
|
|
// constants
|
|
|
|
import { EmptyStateType } from "@/constants/empty-state";
|
|
|
|
// hooks
|
|
|
|
import { useProject } from "@/hooks/store";
|
2024-01-24 15:03:54 +00:00
|
|
|
// layouts
|
2024-03-19 14:38:35 +00:00
|
|
|
import { AppLayout } from "@/layouts/app-layout";
|
2024-01-24 15:03:54 +00:00
|
|
|
// types
|
2024-03-19 14:38:35 +00:00
|
|
|
import { NextPageWithLayout } from "@/lib/types";
|
2024-01-24 15:03:54 +00:00
|
|
|
|
|
|
|
const ProjectInboxPage: NextPageWithLayout = observer(() => {
|
2024-04-08 13:41:47 +00:00
|
|
|
/// router
|
2024-01-24 15:03:54 +00:00
|
|
|
const router = useRouter();
|
2024-04-08 13:41:47 +00:00
|
|
|
const { workspaceSlug, projectId, inboxIssueId } = router.query;
|
|
|
|
// hooks
|
2024-01-24 15:03:54 +00:00
|
|
|
const { currentProjectDetails } = useProject();
|
|
|
|
|
2024-04-08 13:41:47 +00:00
|
|
|
if (!workspaceSlug || !projectId) return <></>;
|
|
|
|
|
|
|
|
// No access to inbox
|
|
|
|
if (currentProjectDetails?.inbox_view === false)
|
|
|
|
return (
|
|
|
|
<div className="flex items-center justify-center h-full w-full">
|
|
|
|
<EmptyState
|
|
|
|
type={EmptyStateType.DISABLED_PROJECT_INBOX}
|
|
|
|
primaryButtonLink={`/${workspaceSlug}/projects/${projectId}/settings/features`}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
|
|
|
|
// derived values
|
|
|
|
const pageTitle = currentProjectDetails?.name ? `${currentProjectDetails?.name} - Inbox` : "Plane - Inbox";
|
2024-01-24 15:03:54 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="flex h-full flex-col">
|
2024-04-08 13:41:47 +00:00
|
|
|
<PageHead title={pageTitle} />
|
|
|
|
<div className="w-full h-full overflow-hidden">
|
|
|
|
<InboxIssueRoot
|
|
|
|
workspaceSlug={workspaceSlug.toString()}
|
|
|
|
projectId={projectId.toString()}
|
|
|
|
inboxIssueId={inboxIssueId?.toString() || undefined}
|
|
|
|
inboxAccessible={currentProjectDetails?.inbox_view || false}
|
|
|
|
/>
|
|
|
|
</div>
|
2024-01-24 15:03:54 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
ProjectInboxPage.getLayout = function getLayout(page: ReactElement) {
|
|
|
|
return (
|
|
|
|
<AppLayout header={<ProjectInboxHeader />} withProjectWrapper>
|
|
|
|
{page}
|
|
|
|
</AppLayout>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default ProjectInboxPage;
|