import { X } from "lucide-react"; import type { ReactNode } from "react"; import type { IssueRelationIssueSummary } from "@paperclipai/shared"; import { Link } from "@/lib/router"; import { cn } from "../lib/utils"; import { badgeVariants } from "./ui/badge"; import { StatusIcon } from "./StatusIcon"; export function IssueReferencePill({ issue, strikethrough, className, children, onRemove, variant = "mention", }: { issue: Pick & { status?: string }; strikethrough?: boolean; variant?: "mention" | "property"; className?: string; children?: ReactNode; /** Reserves space for a separate hover/focus action without moving the task link. */ onRemove?: (issueId: string) => void; }) { const issueLabel = issue.identifier ?? issue.title; const classNames = cn( variant === "property" || onRemove ? cn(badgeVariants({ variant: "outline" }), "min-w-0 max-w-full shrink font-normal no-underline") : "paperclip-mention-chip paperclip-mention-chip--issue inline-flex items-center gap-1 rounded-full border border-border px-2 py-0.5 text-xs no-underline", issue.identifier && "hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-(length:--rad-3) focus-visible:ring-ring", onRemove && "pr-6", strikethrough && "opacity-60 line-through decoration-muted-foreground", className, ); const content = ( <> {issue.status ? : null} {children !== undefined ? children : {issue.identifier ?? issue.title}} ); if (onRemove) { return ( {content} ); } if (!issue.identifier && variant === "mention") { return ( {content} ); } return ( {content} ); }