/** * TabItem — local shell shows zsh/bash badge like professional terminal UIs */ import { X, Terminal, FolderSync, Cable, Crown, TerminalSquare } from 'lucide-react' import type { Tab } from '../../../stores/tabStore' interface TabItemProps { tab: Tab index: number isActive: boolean isDragging: boolean dragOverIndex: number | null onActivate: () => void onClose: (e: React.MouseEvent) => void onContextMenu: (e: React.MouseEvent) => void onDragStart: (e: React.DragEvent, index: number) => void onDragOver: (e: React.DragEvent, index: number) => void onDrop: (e: React.DragEvent, index: number) => void onDragEnd: () => void } function LocalShellBadge({ kind }: { kind?: string }) { const k = (kind || 'unknown').toLowerCase() if (k === 'zsh') { return ( zsh ) } if (k === 'bash') { return ( $_ ) } if (k === 'fish') { return ( fi ) } return ( sh ) } export function TabItem({ tab, index, isActive, isDragging, dragOverIndex, onActivate, onClose, onContextMenu, onDragStart, onDragOver, onDrop, onDragEnd, }: TabItemProps) { const isLocalTerm = tab.type === 'terminal' && tab.isLocal const getIcon = () => { if (isLocalTerm) { return } switch (tab.type) { case 'terminal': return case 'sftp': return case 'serial': return case 'upgrade': return case 'batch': return default: return null } } const showLeftIndicator = dragOverIndex === index && !isDragging const showRightIndicator = dragOverIndex === index + 1 && !isDragging return (
onDragStart(e, index)} onDragOver={(e) => onDragOver(e, index)} onDrop={(e) => onDrop(e, index)} onDragEnd={onDragEnd} className={` group flex items-center gap-2 px-3 py-2 min-w-[120px] max-w-[220px] border-r border-dark-700/20 cursor-pointer select-none transition-all duration-150 relative titlebar-no-drag ${isActive ? 'bg-dark-900 text-content-primary' : 'bg-dark-800 text-txt-muted hover:bg-dark-700 hover:text-txt-muted' } ${isDragging ? 'opacity-50' : 'opacity-100'} `} > {showLeftIndicator && (
)} {showRightIndicator && (
)} {isLocalTerm ? ( <> {getIcon()} {tab.connectionStatus === 'connected' && ( )} {tab.connectionStatus === 'connecting' && ( )} {tab.connectionStatus === 'error' && ( )} ) : ( <> {tab.connectionStatus === 'connecting' && ( )} {tab.connectionStatus === 'connected' && ( )} {tab.connectionStatus === 'error' && ( )} {getIcon()} )} {tab.title}
) }