import React from "react"; import { observer } from "mobx-react"; // hooks import { useInboxIssues } from "hooks/store"; // constants import { INBOX_STATUS } from "constants/inbox"; type Props = { workspaceSlug: string; projectId: string; inboxId: string; issueId: string; iconSize?: number; showDescription?: boolean; }; export const InboxIssueStatus: React.FC = observer((props) => { const { workspaceSlug, projectId, inboxId, issueId, iconSize = 18, showDescription = false } = props; // hooks const { issues: { getInboxIssueByIssueId }, } = useInboxIssues(); const inboxIssueDetail = getInboxIssueByIssueId(inboxId, issueId); if (!inboxIssueDetail) return <>; const inboxIssueStatusDetail = INBOX_STATUS.find((s) => s.status === inboxIssueDetail.status); if (!inboxIssueStatusDetail) return <>; const isSnoozedDatePassed = inboxIssueDetail.status === 0 && !!inboxIssueDetail.snoozed_till && inboxIssueDetail.snoozed_till < new Date(); return (
{showDescription ? ( inboxIssueStatusDetail.description( workspaceSlug, projectId, inboxIssueDetail.duplicate_to ?? "", inboxIssueDetail.snoozed_till ) ) : ( {inboxIssueStatusDetail.title} )}
); });