import { cn } from '@/lib/utils' import { MessageSquare, Plus, UserCircle2, X } from 'lucide-react' import type { ChatTab } from './types' interface ChatTabBarProps { tabs: ChatTab[] activeTabId: string onSwitch: (tabId: string) => void onClose: (tabId: string, e?: React.MouseEvent | React.KeyboardEvent) => void onAddVirtual: () => void } export function ChatTabBar({ tabs, activeTabId, onSwitch, onClose, onAddVirtual, }: ChatTabBarProps) { return (
{tabs.map((tab) => (
onSwitch(tab.id)} > {tab.type === 'webui' ? ( ) : ( )} {tab.label} {/* 连接状态指示器 */} {/* 关闭按钮(非默认标签页) */} {tab.id !== 'webui-default' && ( onClose(tab.id, e)} className="ml-0.5 p-0.5 rounded hover:bg-muted-foreground/20 cursor-pointer" role="button" tabIndex={0} onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault() onClose(tab.id, e) } }} > )}
))} {/* 新建虚拟身份标签页按钮 */}
) }