import { useEffect, useState } from "react"; import { observer } from "mobx-react-lite"; // hooks import { useIssueDetail, useProjectState, useUser } from "hooks/store"; import useReloadConfirmations from "hooks/use-reload-confirmation"; // components import { IssueUpdateStatus, TIssueOperations } from "components/issues"; import { IssueTitleInput } from "../../title-input"; import { IssueDescriptionInput } from "../../description-input"; import { IssueReaction } from "../reactions"; import { IssueActivity } from "../issue-activity"; import { InboxIssueStatus } from "../../../inbox/inbox-issue-status"; // ui import { StateGroupIcon } from "@plane/ui"; type Props = { workspaceSlug: string; projectId: string; inboxId: string; issueId: string; issueOperations: TIssueOperations; is_editable: boolean; }; export const InboxIssueMainContent: React.FC = observer((props) => { const { workspaceSlug, projectId, inboxId, issueId, issueOperations, is_editable } = props; // states const [isSubmitting, setIsSubmitting] = useState<"submitting" | "submitted" | "saved">("saved"); // hooks const { currentUser } = useUser(); const { projectStates } = useProjectState(); const { issue: { getIssueById }, } = useIssueDetail(); const { setShowAlert } = useReloadConfirmations(isSubmitting === "submitting"); useEffect(() => { if (isSubmitting === "submitted") { setShowAlert(false); setTimeout(async () => { setIsSubmitting("saved"); }, 3000); } else if (isSubmitting === "submitting") { setShowAlert(true); } }, [isSubmitting, setShowAlert, setIsSubmitting]); const issue = issueId ? getIssueById(issueId) : undefined; if (!issue) return <>; const currentIssueState = projectStates?.find((s) => s.id === issue.state_id); const issueDescription = issue.description_html !== undefined || issue.description_html !== null ? issue.description_html != "" ? issue.description_html : "

" : undefined; return ( <>
{currentIssueState && ( )}
setIsSubmitting(value)} issueOperations={issueOperations} disabled={!is_editable} value={issue.name} /> setIsSubmitting(value)} /> {currentUser && ( )}
); });