import { Plus, MessageSquare, Layers, Hash, Clock } from 'lucide-react' import type { Topic } from '../../types/protocol' interface TopicListProps { sessionId: string | null sessionTitle: string topics: Topic[] currentTopicId: string | null isReadOnly: boolean onCreateTopic: () => void onSwitchTopic: (topicId: string) => void } function formatTime(timestamp: number): string { const date = new Date(timestamp) const now = new Date() const diffDays = Math.floor((now.getTime() - date.getTime()) / (1000 * 60 * 60 * 24)) if (diffDays === 0) { return date.toLocaleTimeString('zh-CN', { hour: '2-digit', minute: '2-digit' }) } else if (diffDays === 1) { return '昨天' } else if (diffDays < 7) { return `${diffDays}天前` } else { return date.toLocaleDateString('zh-CN', { month: 'short', day: 'numeric' }) } } export function TopicList({ sessionId, sessionTitle, topics, currentTopicId, isReadOnly, onCreateTopic, onSwitchTopic, }: TopicListProps) { return (
所属会话
{sessionTitle}
等待连接...
暂无话题
点击上方"新建"创建话题