import React from 'react'; import { useNavigate } from 'react-router'; import { Users, Bell, Eye, TrendingUp, TrendingDown, Activity } from 'lucide-react'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/client/components/ui/card'; import { Badge } from '@/client/components/ui/badge'; import { Progress } from '@/client/components/ui/progress'; // 仪表盘页面 export const DashboardPage = () => { const navigate = useNavigate(); const stats = [ { title: '活跃用户', value: '112,893', icon: Users, color: 'text-blue-500', bgColor: 'bg-blue-50', trend: 12.5, trendDirection: 'up', description: '较昨日增长 12.5%', }, { title: '系统消息', value: '93', icon: Bell, color: 'text-yellow-500', bgColor: 'bg-yellow-50', trend: 0, trendDirection: 'neutral', description: '其中 5 条未读', }, { title: '在线用户', value: '1,128', icon: Eye, color: 'text-purple-500', bgColor: 'bg-purple-50', trend: 32.1, trendDirection: 'up', description: '当前在线率 32.1%', }, ]; const recentActivities = [ { id: 1, user: '张三', action: '登录系统', time: '2分钟前', status: 'success', }, { id: 2, user: '李四', action: '创建了新用户', time: '5分钟前', status: 'info', }, { id: 3, user: '王五', action: '删除了用户', time: '10分钟前', status: 'warning', }, { id: 4, user: '赵六', action: '修改了配置', time: '15分钟前', status: 'info', }, ]; const systemMetrics = [ { name: 'CPU使用率', value: 65, color: 'bg-green-500', }, { name: '内存使用率', value: 78, color: 'bg-blue-500', }, { name: '磁盘使用率', value: 45, color: 'bg-purple-500', }, { name: '网络使用率', value: 32, color: 'bg-orange-500', }, ]; const handleQuickActionClick = (action: string) => { switch (action) { case 'users': navigate('/admin/users'); break; case 'settings': navigate('/admin/settings'); break; case 'backup': navigate('/admin/backup'); break; case 'logs': navigate('/admin/logs'); break; default: break; } }; return (

仪表盘

欢迎回来!这里是系统概览和关键指标。

{/* 统计卡片 */}
{stats.map((stat, index) => { const Icon = stat.icon; return ( {stat.title}
{stat.value}
{stat.trendDirection === 'up' && ( )} {stat.trendDirection === 'down' && ( )}

{stat.description}

); })}
{/* 系统性能 */} 系统性能 当前系统各项资源的使用情况
{systemMetrics.map((metric, index) => (
{metric.name} {metric.value}%
))}
{/* 最近活动 */} 最近活动 系统最新操作记录
{recentActivities.map((activity) => (

{activity.user} {activity.action}

{activity.time}

))}
{/* 快捷操作 */} 快捷操作 常用的管理功能
handleQuickActionClick('users')} > 用户管理 查看和管理所有用户 handleQuickActionClick('settings')} > 系统设置 配置系统参数 handleQuickActionClick('backup')} > 数据备份 执行数据备份操作 handleQuickActionClick('logs')} > 日志查看 查看系统日志
); };