import React from 'react'; import { useNavigate } from 'react-router-dom'; import { CloudServerOutlined, DatabaseOutlined, WarningOutlined, AppstoreOutlined, SettingOutlined, ApartmentOutlined, LinkOutlined, ArrowRightOutlined, AuditOutlined, } from '@ant-design/icons'; import { designTokens } from '../../config/theme'; const NAV_BUTTONS_DATA = [ { key: 'devices', icon: CloudServerOutlined, text: '设备管理', path: '/devices', color: designTokens.colors.primary.main, description: '设备全生命周期管理', }, { key: 'racks', icon: DatabaseOutlined, text: '资源规划', path: '/racks', color: '#722ed1', description: '机柜和机房管理', }, { key: 'tickets', icon: WarningOutlined, text: '故障监控', path: '/tickets', color: designTokens.colors.warning.main, description: '工单和故障处理', }, { key: 'inventory', icon: AuditOutlined, text: '资产盘点', path: '/inventory', color: '#13c2c2', description: '资产库存和盘点管理', }, { key: 'consumables', icon: AppstoreOutlined, text: '耗材管理', path: '/consumables', color: '#fa8c16', description: '耗材库存和领用', }, { key: 'visualization', icon: ApartmentOutlined, text: '3D可视化', path: '/visualization-3d', color: designTokens.colors.success.main, description: '3D机房可视化', }, { key: 'cables', icon: LinkOutlined, text: '线缆管理', path: '/cables', color: '#eb2f96', description: '线缆连接管理', }, { key: 'settings', icon: SettingOutlined, text: '系统配置', path: '/settings', color: '#8c8c8c', description: '系统设置和管理', }, ]; const NavigationGrid = ({ hoveredCard, onHover }) => { const navigate = useNavigate(); const firstRow = NAV_BUTTONS_DATA.slice(0, 4); const secondRow = NAV_BUTTONS_DATA.slice(4, 8); const renderRow = (items) => (
{items.map(({ key, icon: Icon, text, color, description, path }) => { const isHovered = hoveredCard === `nav-${key}`; return (
onHover(`nav-${key}`)} onMouseLeave={() => onHover(null)} onClick={() => navigate(path)} > {/* 装饰性背景元素 */}
{/* 次要装饰元素 */}
{/* 顶部区域:图标和箭头 */}
{/* 图标容器 */}
{/* 箭头指示器 */}
{/* 文本内容区域 */}
{/* 标题 */}
{text}
{/* 描述文本 */}
{description}
); })}
); return (
{/* 区域标题 */}

功能导航

快速访问系统核心功能模块

{/* 导航网格 - 第一排 */} {renderRow(firstRow)} {/* 导航网格 - 第二排 */} {renderRow(secondRow)} {/* 响应式样式 */}
); }; export default React.memo(NavigationGrid);