import { observer } from "mobx-react"; // hooks // ui import { Tooltip, StateGroupIcon, ControlLink } from "@plane/ui"; // helpers import { renderFormattedDate } from "@/helpers/date-time.helper"; import { useApplication, useIssueDetail, useProject, useProjectState } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; 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 }); const { isMobile } = usePlatformOS(); 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 { getProjectIdentifierById } = useProject(); const { router: { workspaceSlug }, } = useApplication(); const { issue: { getIssueById }, setPeekIssue, } = useIssueDetail(); // derived values const issueDetails = getIssueById(issueId); const projectIdentifier = issueDetails && getProjectIdentifierById(issueDetails?.project_id); const stateDetails = issueDetails && getStateById(issueDetails?.state_id); const handleIssuePeekOverview = () => workspaceSlug && issueDetails && setPeekIssue({ workspaceSlug, projectId: issueDetails.project_id, issueId: issueDetails.id }); const { isMobile } = usePlatformOS(); return (
{stateDetails && }
{projectIdentifier} {issueDetails?.sequence_id}
{issueDetails?.name}
); });