import { FC, useState } from "react"; import { observer } from "mobx-react"; import useSWR from "swr"; import { InboxIssueActionsHeader, InboxIssueMainContent } from "@/components/inbox"; import { EUserProjectRoles } from "@/constants/project"; import { useProjectInbox, useUser } from "@/hooks/store"; type TInboxContentRoot = { workspaceSlug: string; projectId: string; inboxIssueId: string; }; export const InboxContentRoot: FC = observer((props) => { const { workspaceSlug, projectId, inboxIssueId } = props; // states const [isSubmitting, setIsSubmitting] = useState<"submitting" | "submitted" | "saved">("saved"); // hooks const { fetchInboxIssueById, getIssueInboxByIssueId } = useProjectInbox(); const inboxIssue = getIssueInboxByIssueId(inboxIssueId); const { membership: { currentProjectRole }, } = useUser(); useSWR( workspaceSlug && projectId && inboxIssueId ? `PROJECT_INBOX_ISSUE_DETAIL_${workspaceSlug}_${projectId}_${inboxIssueId}` : null, () => { workspaceSlug && projectId && inboxIssueId && fetchInboxIssueById(workspaceSlug, projectId, inboxIssueId); }, { revalidateOnFocus: false } ); const is_editable = !!currentProjectRole && currentProjectRole >= EUserProjectRoles.MEMBER; if (!inboxIssue) return <>; const isIssueAcceptedOrDeclined = [-1, 1].includes(inboxIssue.status); return ( <>
); });