import React, { useCallback } from 'react'; import { cn } from '../../lib/utils'; import Typography from '../ui/Typography'; import { Badge } from '../ui/badge'; import { FiCode, FiUsers } from 'react-icons/fi'; interface Agent { id: string; accountId: string; name: string; profile?: { display_name?: string; isAI?: boolean; isRegistryBroker?: boolean; }; timestamp?: Date | number; lastMessage?: string; unreadCount?: number; network?: string; } interface AgentItemProps { agent: Agent; isSelected: boolean; onSelect: (agent: Agent) => void; formatTimestamp: (timestamp: Date | number | undefined) => string; } /** * Displays an individual agent in the sidebar conversation list */ const AgentItem = React.memo( ({ agent, isSelected, onSelect, formatTimestamp }) => { const handleClick = useCallback(() => { onSelect(agent); }, [agent, onSelect]); return (
{agent.profile?.isAI ? ( ) : ( )}
{agent.profile?.display_name || agent.name} {agent.timestamp && ( {formatTimestamp(agent.timestamp)} )}
{agent.lastMessage && ( {agent.lastMessage} )}
{agent.unreadCount && agent.unreadCount > 0 && ( {agent.unreadCount} )} {agent.profile?.isRegistryBroker && (
)} {agent.network && (
)}
); } ); AgentItem.displayName = 'AgentItem'; export default AgentItem;