import { useState } from "react"; import { observer } from "mobx-react-lite"; // hooks import { useIssueDetail, useProject, useProjectState, useUser } from "hooks/store"; // components import { IssueDescriptionForm, IssueAttachmentRoot, IssueUpdateStatus } from "components/issues"; import { IssueParentDetail } from "./parent"; import { IssueReaction } from "./reactions"; import { SubIssuesRoot } from "../sub-issues"; // ui import { StateGroupIcon } from "@plane/ui"; // types import { TIssueOperations } from "./root"; // constants import { EUserProjectRoles } from "constants/project"; type Props = { workspaceSlug: string; projectId: string; issueId: string; issueOperations: TIssueOperations; is_archived: boolean; is_editable: boolean; }; export const IssueMainContent: React.FC = observer((props) => { const { workspaceSlug, projectId, issueId, issueOperations, is_archived, is_editable } = props; // states const [isSubmitting, setIsSubmitting] = useState<"submitting" | "submitted" | "saved">("saved"); // hooks const { currentUser, membership: { currentProjectRole }, } = useUser(); const { getProjectById } = useProject(); const { projectStates } = useProjectState(); const { issue: { getIssueById }, } = useIssueDetail(); const issue = getIssueById(issueId); if (!issue) return <>; const projectDetails = projectId ? getProjectById(projectId) : null; const currentIssueState = projectStates?.find((s) => s.id === issue.state_id); const isAllowed = !!currentProjectRole && currentProjectRole >= EUserProjectRoles.MEMBER; return ( <>
{issue.parent_id && ( )}
{currentIssueState && ( )}
setIsSubmitting(value)} isSubmitting={isSubmitting} issue={issue} issueOperations={issueOperations} isAllowed={isAllowed || !is_editable} /> {currentUser && ( )} {currentUser && ( )}
{/* issue attachments */} {/*

Comments/Activity

*/} ); });