import React, { FC, MutableRefObject, useState } from "react"; import { observer } from "mobx-react"; import { IIssueDisplayProperties, TIssue, TIssueMap } from "@plane/types"; // components import RenderIfVisible from "@/components/core/render-if-visible-HOC"; import { IssueBlock } from "@/components/issues/issue-layouts/list"; // hooks import { useIssueDetail } from "@/hooks/store"; // types import { TRenderQuickActions } from "./list-view-types"; type Props = { issueIds: string[]; issueId: string; issuesMap: TIssueMap; updateIssue: ((projectId: string, issueId: string, data: Partial) => Promise) | undefined; quickActions: TRenderQuickActions; canEditProperties: (projectId: string | undefined) => boolean; displayProperties: IIssueDisplayProperties | undefined; nestingLevel: number; spacingLeft?: number; containerRef: MutableRefObject; }; export const IssueBlockRoot: FC = observer((props) => { const { issueIds, issueId, issuesMap, updateIssue, quickActions, canEditProperties, displayProperties, nestingLevel, spacingLeft = 14, containerRef, } = props; // states const [isExpanded, setExpanded] = useState(false); // store hooks const { subIssues: subIssuesStore } = useIssueDetail(); if (!issueId) return null; const subIssues = subIssuesStore.subIssuesByIssueId(issueId); return ( <> {isExpanded && subIssues && subIssues.length > 0 && subIssues.map((subIssueId: string) => ( ))} ); });