MCPcopy Create free account
hub / github.com/codeaashu/claude-code / AnnotationBadge

Function AnnotationBadge

web/components/collaboration/AnnotationBadge.tsx:13–50  ·  view source on GitHub ↗
({ messageId }: AnnotationBadgeProps)

Source from the content-addressed store, hash-verified

11}
12
13export function AnnotationBadge({ messageId }: AnnotationBadgeProps) {
14 const ctx = useCollaborationContextOptional();
15 const [open, setOpen] = useState(false);
16
17 if (!ctx) return null;
18
19 const annotations = ctx.annotations[messageId] ?? [];
20 const unresolved = annotations.filter((a) => !a.resolved);
21 if (annotations.length === 0) return null;
22
23 return (
24 <div className="relative inline-block">
25 <button
26 onClick={() => setOpen((v) => !v)}
27 className={cn(
28 "flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[10px] font-medium",
29 "transition-colors border",
30 unresolved.length > 0
31 ? "bg-amber-900/30 border-amber-700/50 text-amber-300 hover:bg-amber-900/50"
32 : "bg-surface-800 border-surface-700 text-surface-400 hover:bg-surface-700"
33 )}
34 title={`${annotations.length} comment${annotations.length !== 1 ? "s" : ""}`}
35 >
36 <MessageSquare className="w-3 h-3" />
37 {unresolved.length > 0 ? unresolved.length : annotations.length}
38 </button>
39
40 {open && (
41 <div
42 className="absolute right-0 top-full mt-1 z-40 w-80"
43 onKeyDown={(e) => e.key === "Escape" && setOpen(false)}
44 >
45 <AnnotationThread messageId={messageId} onClose={() => setOpen(false)} />
46 </div>
47 )}
48 </div>
49 );
50}

Callers

nothing calls this directly

Calls 2

cnFunction · 0.90

Tested by

no test coverage detected