import { observer } from "mobx-react"; // hooks import { useApplication, useIssueDetail, useProject, useProjectState } from "hooks/store"; // ui import { Tooltip, StateGroupIcon, ControlLink } from "@plane/ui"; // helpers import { renderFormattedDate } from "helpers/date-time.helper"; type Props = { issueId: string; }; export const IssueGanttBlock: React.FC = observer((props) => { const { issueId } = props; // store hooks const { router: { workspaceSlug }, } = useApplication(); const { getProjectStates } = useProjectState(); const { issue: { getIssueById }, setPeekIssue, } = useIssueDetail(); // derived values const issueDetails = getIssueById(issueId); const stateDetails = issueDetails && getProjectStates(issueDetails?.project_id)?.find((state) => state?.id == issueDetails?.state_id); const handleIssuePeekOverview = () => workspaceSlug && issueDetails && !issueDetails.tempId && setPeekIssue({ workspaceSlug, projectId: issueDetails.project_id, issueId: issueDetails.id }); return (
{issueDetails?.name}
{renderFormattedDate(issueDetails?.start_date ?? "")} to{" "} {renderFormattedDate(issueDetails?.target_date ?? "")}
} position="top-left" >
{issueDetails?.name}
); }); // rendering issues on gantt sidebar export const IssueGanttSidebarBlock: React.FC = observer((props) => { const { issueId } = props; // store hooks const { getStateById } = useProjectState(); const { getProjectById } = useProject(); const { router: { workspaceSlug }, } = useApplication(); const { issue: { getIssueById }, setPeekIssue, } = useIssueDetail(); // derived values const issueDetails = getIssueById(issueId); const projectDetails = issueDetails && getProjectById(issueDetails?.project_id); const stateDetails = issueDetails && getStateById(issueDetails?.state_id); const handleIssuePeekOverview = () => workspaceSlug && issueDetails && setPeekIssue({ workspaceSlug, projectId: issueDetails.project_id, issueId: issueDetails.id }); return (
{stateDetails && }
{projectDetails?.identifier} {issueDetails?.sequence_id}
{issueDetails?.name}
); });