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 (
{/* Header */}

话题列表 {topics.length > 0 && ( ({topics.length}) )}

{/* Session 标题 */} {sessionTitle && (

所属会话

{sessionTitle}

)} {/* Topics 列表 */}
{!sessionId ? (

等待连接...

) : topics.length === 0 ? (

暂无话题

点击上方"新建"创建话题

) : (
{topics.map((topic, index) => ( ))}
)}
) }