import type { ActivityEvent } from "@paperclipai/shared"; import { Plus, Minus } from "lucide-react"; import { IssueReferencePill } from "./IssueReferencePill"; type ActivityIssueReference = { id: string; identifier?: string | null; title?: string | null; }; function readIssueReferences(details: Record | null | undefined, key: string): ActivityIssueReference[] { const value = details?.[key]; if (!Array.isArray(value)) return []; return value.filter((item): item is ActivityIssueReference => !!item && typeof item === "object"); } function Section({ label, icon, items, strikethrough, }: { label: string; icon: React.ReactNode; items: ActivityIssueReference[]; strikethrough?: boolean; }) { if (items.length === 0) return null; return (
{icon} {label} {items.map((issue) => ( ))}
); } export function IssueReferenceActivitySummary({ event }: { event: Pick }) { const added = readIssueReferences(event.details, "addedReferencedIssues"); const removed = readIssueReferences(event.details, "removedReferencedIssues"); if (added.length === 0 && removed.length === 0) return null; return (
); }