"use client"; import { ConversationSummary } from "@/features/agent/types"; import { buildMessagePreview, formatConversationTime, isVisitorOnline, } from "@/utils/format"; interface ConversationListItemProps { conversation: ConversationSummary; selected: boolean; onSelect: (id: number) => void; } export function ConversationListItem({ conversation, selected, onSelect, }: ConversationListItemProps) { const avatarColor = `hsl(${(conversation.id * 137.5) % 360}, 70%, 50%)`; const unreadCount = conversation.unread_count ?? 0; const lastMessage = conversation.last_message; const lastMessagePreview = lastMessage ? buildMessagePreview(lastMessage.content) : "暂无消息"; // 根据 last_seen_at 判断是否在线(最近 10 秒内认为在线) const isOnline = isVisitorOnline(conversation.last_seen_at); return (