import { useState } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import { Users, Bot, Zap, Layers, Package, Search, Sparkles, ChevronRight, X } from 'lucide-react'; import { CloneManager } from './CloneManager'; import { TeamList } from './TeamList'; import { useConfigStore } from '../store/configStore'; import { containerVariants, defaultTransition } from '../lib/animations'; export type MainViewType = 'chat' | 'automation' | 'team' | 'swarm' | 'skills'; interface SidebarProps { onOpenSettings?: () => void; onMainViewChange?: (view: MainViewType) => void; selectedTeamId?: string; onSelectTeam?: (teamId: string) => void; onNewChat?: () => void; } type Tab = 'chat' | 'clones' | 'automation' | 'team' | 'swarm' | 'skills'; // 导航项配置 - WorkBuddy 风格 const NAV_ITEMS: { key: Tab; label: string; icon: React.ComponentType<{ className?: string }>; mainView?: MainViewType; }[] = [ { key: 'clones', label: '分身', icon: Bot }, { key: 'automation', label: '自动化', icon: Zap, mainView: 'automation' }, { key: 'skills', label: '技能', icon: Package, mainView: 'skills' }, { key: 'team', label: '团队', icon: Users, mainView: 'team' }, { key: 'swarm', label: '协作', icon: Layers, mainView: 'swarm' }, ]; export function Sidebar({ onOpenSettings, onMainViewChange, selectedTeamId, onSelectTeam, onNewChat }: SidebarProps) { const [activeTab, setActiveTab] = useState('clones'); const [searchQuery, setSearchQuery] = useState(''); const userName = useConfigStore((state) => state.quickConfig?.userName) || '用户7141'; const handleNavClick = (key: Tab, mainView?: MainViewType) => { setActiveTab(key); if (mainView && onMainViewChange) { onMainViewChange(mainView); } else if (onMainViewChange) { onMainViewChange('chat'); } }; const handleSelectTeam = (teamId: string) => { onSelectTeam?.(teamId); setActiveTab('team'); onMainViewChange?.('team'); }; return ( ); }