import { useEffect } from "react"; import { observer } from "mobx-react"; import { useParams } from "next/navigation"; // store hooks // icons import { TagIcon, CopyPlus, Calendar, Link2Icon, Users2Icon, ArchiveIcon, PaperclipIcon, ContrastIcon, TriangleIcon, LayoutGridIcon, SignalMediumIcon, MessageSquareIcon, UsersIcon, Inbox, } from "lucide-react"; import { IIssueActivity } from "@plane/types"; import { Tooltip, BlockedIcon, BlockerIcon, RelatedIcon, LayersIcon, DiceIcon } from "@plane/ui"; // helpers import { renderFormattedDate } from "@/helpers/date-time.helper"; import { capitalizeFirstLetter } from "@/helpers/string.helper"; import { useLabel } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; // types export const IssueLink = ({ activity }: { activity: IIssueActivity }) => { // router params const { workspaceSlug } = useParams(); const { isMobile } = usePlatformOS(); return ( {activity?.issue_detail ? ( {`${activity.project_detail.identifier}-${activity.issue_detail.sequence_id}`}{" "} {activity.issue_detail?.name} ) : ( {" an Issue"}{" "} )} ); }; const UserLink = ({ activity }: { activity: IIssueActivity }) => { // router params const { workspaceSlug } = useParams(); return ( {activity.new_value && activity.new_value !== "" ? activity.new_value : activity.old_value} ); }; const LabelPill = observer(({ labelId, workspaceSlug }: { labelId: string; workspaceSlug: string }) => { // store hooks const { workspaceLabels, fetchWorkspaceLabels } = useLabel(); useEffect(() => { if (!workspaceLabels) fetchWorkspaceLabels(workspaceSlug); }, [fetchWorkspaceLabels, workspaceLabels, workspaceSlug]); return ( l.id === labelId)?.color ?? "#000000", }} aria-hidden="true" /> ); }); const inboxActivityMessage = { declined: { showIssue: "declined issue", noIssue: "declined this issue from inbox.", }, snoozed: { showIssue: "snoozed issue", noIssue: "snoozed this issue.", }, accepted: { showIssue: "accepted issue", noIssue: "accepted this issue from inbox.", }, markedDuplicate: { showIssue: "declined issue", noIssue: "declined this issue from inbox by marking a duplicate issue.", }, }; const getInboxUserActivityMessage = (activity: IIssueActivity, showIssue: boolean) => { switch (activity.verb) { case "-1": return showIssue ? inboxActivityMessage.declined.showIssue : inboxActivityMessage.declined.noIssue; case "0": return showIssue ? inboxActivityMessage.snoozed.showIssue : inboxActivityMessage.snoozed.noIssue; case "1": return showIssue ? inboxActivityMessage.accepted.showIssue : inboxActivityMessage.accepted.noIssue; case "2": return showIssue ? inboxActivityMessage.markedDuplicate.showIssue : inboxActivityMessage.markedDuplicate.noIssue; default: return "updated inbox issue status."; } }; const activityDetails: { [key: string]: { message: (activity: IIssueActivity, showIssue: boolean, workspaceSlug: string) => React.ReactNode; icon: React.ReactNode; }; } = { assignees: { message: (activity, showIssue) => { if (activity.old_value === "") return ( <> added a new assignee {showIssue && ( <> {" "} to )} ); else return ( <> removed the assignee {showIssue && ( <> {" "} from )} ); }, icon: