import { FC, MouseEvent, useEffect } from "react"; import { observer } from "mobx-react"; import Link from "next/link"; import { useRouter } from "next/router"; import { Tooltip, PriorityIcon } from "@plane/ui"; // components import { InboxIssueStatus } from "@/components/inbox"; // helpers import { cn } from "@/helpers/common.helper"; import { renderFormattedDate } from "@/helpers/date-time.helper"; // hooks import { useLabel } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; // store import { IInboxIssueStore } from "@/store/inbox/inbox-issue.store"; type InboxIssueListItemProps = { workspaceSlug: string; projectId: string; projectIdentifier?: string; inboxIssue: IInboxIssueStore; }; export const InboxIssueListItem: FC = observer((props) => { const { workspaceSlug, projectId, inboxIssue, projectIdentifier } = props; // router const router = useRouter(); const { inboxIssueId } = router.query; // store const { projectLabels } = useLabel(); const { isMobile } = usePlatformOS(); const issue = inboxIssue.issue; useEffect(() => { if (issue.id === inboxIssueId) { setTimeout(() => { const issueItemCard = document.getElementById(`inbox-issue-list-item-${issue.id}`); if (issueItemCard) issueItemCard.scrollIntoView({ behavior: "smooth", block: "center", }); }, 200); } }, [inboxIssueId, issue.id]); const handleIssueRedirection = (event: MouseEvent, currentIssueId: string | undefined) => { if (inboxIssueId === currentIssueId) event.preventDefault(); }; if (!issue) return <>; return ( <> handleIssueRedirection(e, issue.id)} >
{projectIdentifier}-{issue.sequence_id}
{inboxIssue.status !== -2 && }

{issue.name}

{renderFormattedDate(issue.created_at ?? "")}
{issue.priority && ( )} {issue.label_ids && issue.label_ids.length > 3 ? (
{`${issue.label_ids.length} labels`}
) : ( <> {(issue.label_ids ?? []).map((labelId) => { const labelDetails = projectLabels?.find((l) => l.id === labelId); if (!labelDetails) return null; return (
{labelDetails.name}
); })} )}
); });