import { useState } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import { Settings, Users, Bot, GitBranch, MessageSquare, Layers } from 'lucide-react'; import { CloneManager } from './CloneManager'; import { HandList } from './HandList'; import { TaskList } from './TaskList'; import { TeamList } from './TeamList'; import { SwarmDashboard } from './SwarmDashboard'; import { useGatewayStore } from '../store/gatewayStore'; import { Button } from './ui'; import { containerVariants, defaultTransition } from '../lib/animations'; export type MainViewType = 'chat' | 'hands' | 'workflow' | 'team' | 'swarm'; interface SidebarProps { onOpenSettings?: () => void; onMainViewChange?: (view: MainViewType) => void; selectedHandId?: string; onSelectHand?: (handId: string) => void; selectedTeamId?: string; onSelectTeam?: (teamId: string) => void; } type Tab = 'clones' | 'hands' | 'workflow' | 'team' | 'swarm'; const TABS: { key: Tab; label: string; icon: React.ComponentType<{ className?: string }>; mainView?: MainViewType }[] = [ { key: 'clones', label: '分身', icon: Bot }, { key: 'hands', label: 'Hands', icon: MessageSquare, mainView: 'hands' }, { key: 'workflow', label: '工作流', icon: GitBranch, mainView: 'workflow' }, { key: 'team', label: '团队', icon: Users, mainView: 'team' }, { key: 'swarm', label: '协作', icon: Layers, mainView: 'swarm' }, ]; export function Sidebar({ onOpenSettings, onMainViewChange, selectedHandId, onSelectHand, selectedTeamId, onSelectTeam }: SidebarProps) { const [activeTab, setActiveTab] = useState('clones'); const userName = useGatewayStore((state) => state.quickConfig.userName) || '用户7141'; const handleTabClick = (key: Tab, mainView?: MainViewType) => { setActiveTab(key); if (mainView && onMainViewChange) { onMainViewChange(mainView); } else if (onMainViewChange) { onMainViewChange('chat'); } }; const handleSelectHand = (handId: string) => { onSelectHand?.(handId); setActiveTab('hands'); onMainViewChange?.('hands'); }; const handleSelectTeam = (teamId: string) => { onSelectTeam?.(teamId); setActiveTab('team'); onMainViewChange?.('team'); }; return ( ); }