"use client"; import { NodeViewWrapper } from "@tiptap/react"; import type { NodeViewProps } from "@tiptap/react"; import { useIssueStore } from "@/features/issues/store"; import { StatusIcon } from "@/features/issues/components/status-icon"; /** * MentionView — shared NodeView for mention nodes (both editing and readonly). * * Rendering and behavior are identical in both modes. * Issue mentions are always clickable (open in new tab). */ export function MentionView({ node }: NodeViewProps) { const { type, id, label } = node.attrs; if (type === "issue") { return ( ); } return ( @{label ?? id} ); } // --------------------------------------------------------------------------- // IssueMention — inline card, always opens in new tab // --------------------------------------------------------------------------- function IssueMention({ issueId, fallbackLabel, }: { issueId: string; fallbackLabel?: string; }) { const issue = useIssueStore((s) => s.issues.find((i) => i.id === issueId)); const handleClick = (e: React.MouseEvent) => { e.preventDefault(); e.stopPropagation(); window.open(`/issues/${issueId}`, "_blank", "noopener,noreferrer"); }; if (!issue) { return ( {fallbackLabel ?? issueId.slice(0, 8)} ); } return ( {issue.identifier} {issue.title} ); }