Download novelforge-sentinel-pro-react/src/components/Layout/Sidebar.tsx from luom2645/agent-workspace: direct link, hf CLI and curl.
- Browser
- Download file 4.33 kB
-
https://huggingface.co/luom2645/agent-workspace/resolve/main/novelforge-sentinel-pro-react/src/components/Layout/Sidebar.tsx
- Command line
-
hf download hf://luom2645/agent-workspace/novelforge-sentinel-pro-react/src/components/Layout/Sidebar.tsx
-
curl -L -o Sidebar.tsx https://huggingface.co/luom2645/agent-workspace/resolve/main/novelforge-sentinel-pro-react/src/components/Layout/Sidebar.tsx
4.33 kB
| import React from 'react'; | |
| import { useAuth } from '../../hooks/useAuth'; | |
| import { | |
| PencilSquareIcon, | |
| FolderOpenIcon, | |
| CpuChipIcon, | |
| CogIcon, | |
| UserCircleIcon, | |
| ShieldCheckIcon | |
| } from '@heroicons/react/24/outline'; | |
| interface SidebarProps { | |
| activeSection: string; | |
| onSectionChange: (section: string) => void; | |
| } | |
| const Sidebar: React.FC<SidebarProps> = ({ activeSection, onSectionChange }) => { | |
| const { user, signOut } = useAuth(); | |
| const menuItems = [ | |
| { | |
| id: 'creation', | |
| label: '创作中心', | |
| icon: PencilSquareIcon, | |
| description: 'AI驱动的小说创作' | |
| }, | |
| { | |
| id: 'projects', | |
| label: '作品管理', | |
| icon: FolderOpenIcon, | |
| description: '管理您的小说项目' | |
| }, | |
| { | |
| id: 'ai-models', | |
| label: 'AI模型', | |
| icon: CpuChipIcon, | |
| description: '配置和管理AI模型' | |
| }, | |
| { | |
| id: 'settings', | |
| label: '系统设置', | |
| icon: CogIcon, | |
| description: '个人设置和系统配置' | |
| } | |
| ]; | |
| // 管理员菜单项 | |
| if (user?.role === 'admin') { | |
| menuItems.push({ | |
| id: 'admin', | |
| label: '管理控制台', | |
| icon: ShieldCheckIcon, | |
| description: '系统管理和监控' | |
| }); | |
| } | |
| return ( | |
| <div className="w-80 bg-secondary-bg backdrop-blur-lg border-r border-border-color h-screen fixed z-10 overflow-y-auto"> | |
| {/* 头部 Logo */} | |
| <div className="p-6 border-b border-border-color"> | |
| <div className="text-center"> | |
| <div className="text-4xl mb-3 logo-glow"> | |
| 📚 | |
| </div> | |
| <h1 className="text-2xl font-logo font-bold text-text-highlight"> | |
| NovelForge | |
| </h1> | |
| <p className="text-accent-cyan text-sm font-logo"> | |
| Sentinel Pro | |
| </p> | |
| </div> | |
| </div> | |
| {/* 导航菜单 */} | |
| <div className="py-4"> | |
| {menuItems.map((item) => { | |
| const Icon = item.icon; | |
| return ( | |
| <button | |
| key={item.id} | |
| onClick={() => onSectionChange(item.id)} | |
| className={` | |
| nav-item w-full text-left group | |
| ${activeSection === item.id ? 'active' : ''} | |
| `} | |
| > | |
| <Icon className="w-6 h-6 text-accent-cyan mr-4 flex-shrink-0" /> | |
| <div className="flex-1"> | |
| <div className="font-medium text-text-primary group-hover:text-text-highlight transition-colors"> | |
| {item.label} | |
| </div> | |
| <div className="text-xs text-text-secondary group-hover:text-text-primary/70 transition-colors"> | |
| {item.description} | |
| </div> | |
| </div> | |
| </button> | |
| ); | |
| })} | |
| </div> | |
| {/* 底部用户信息 */} | |
| <div className="absolute bottom-0 w-full border-t border-border-color bg-panel-bg"> | |
| <div className="p-4"> | |
| {/* 用户信息 */} | |
| <div className="flex items-center mb-4"> | |
| <div className="w-10 h-10 bg-gradient-to-r from-accent-cyan to-accent-blue rounded-full flex items-center justify-center mr-3 shadow-glow-sm"> | |
| <UserCircleIcon className="w-6 h-6 text-primary-bg" /> | |
| </div> | |
| <div className="flex-1"> | |
| <div className="font-medium text-text-highlight"> | |
| {user?.full_name || user?.username || '用户'} | |
| </div> | |
| <div className="text-sm text-success-green"> | |
| {user?.role === 'admin' ? '管理员' : '已认证'} | |
| </div> | |
| </div> | |
| </div> | |
| {/* 安全状态 */} | |
| <div className="flex items-center justify-between mb-4"> | |
| <div className="flex items-center"> | |
| <div className="status-indicator active mr-2"></div> | |
| <span className="text-sm text-text-secondary">设备已绑定</span> | |
| </div> | |
| <div className="text-xs text-success-green"> | |
| 安全 | |
| </div> | |
| </div> | |
| {/* 退出按钮 */} | |
| <button | |
| onClick={signOut} | |
| className="w-full cyber-btn cyber-btn-secondary py-2 text-sm" | |
| > | |
| 退出登录 | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| ); | |
| }; | |
| export default Sidebar; |