import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; import { Skeleton } from "@/components/ui/skeleton"; import { AgentIcon } from "./AgentIconPicker"; import { agentRoleColors, agentRoleColorDefault } from "../lib/agent-role-colors"; import type { Agent, AgentRole } from "@paperclipai/shared"; interface ChatMentionPopoverProps { open: boolean; onOpenChange: (open: boolean) => void; onSelect: (agentName: string) => void; query: string; agents: Agent[]; isLoading?: boolean; children: React.ReactNode; } export function ChatMentionPopover({ open, onOpenChange, onSelect, query, agents, isLoading, children, }: ChatMentionPopoverProps) { const filtered = agents.filter((a) => a.name.toLowerCase().includes(query.toLowerCase()), ); return ( {children} e.preventDefault()} > {isLoading ? (
) : filtered.length === 0 ? (

No agents found

) : (
{filtered.slice(0, 5).map((agent) => { const colorClass = agent.role ? (agentRoleColors[agent.role as AgentRole] ?? agentRoleColorDefault) : agentRoleColorDefault; return ( ); })}
)}
); }