'use client';
import { useState, useEffect } from 'react';
import { getTranslations, type Language } from '@/lib/languages';
export default function ConsolePage({ params }: { params: { lang: string } }) {
const [isLoaded, setIsLoaded] = useState(false);
const [activeSection, setActiveSection] = useState('overview');
const lang = params.lang as Language;
const t = getTranslations(lang);
useEffect(() => {
setIsLoaded(true);
}, []);
const menuItems = [
{ key: 'overview', label: '概览', icon: '📊' },
{ key: 'servers', label: '云服务器', icon: '💻' },
{ key: 'storage', label: '存储', icon: '💾' },
{ key: 'network', label: '网络', icon: '🌐' },
{ key: 'security', label: '安全', icon: '🛡️' },
{ key: 'monitoring', label: '监控', icon: '📈' },
{ key: 'billing', label: '账单', icon: '💳' },
];
return (
{/* Header */}
控制台
云资源管理中心
统一管理您的云服务器、存储、网络等资源
{/* Console Layout */}
{/* Sidebar */}
导航菜单
{/* Main Content */}
{activeSection === 'overview' && (
资源概览
{/* Quick Stats */}
{[
{
label: '云服务器',
value: '12',
icon: '💻',
color: 'text-blue-400',
},
{
label: '存储空间',
value: '2.5TB',
icon: '💾',
color: 'text-green-400',
},
{
label: '网络流量',
value: '156GB',
icon: '🌐',
color: 'text-cyan-400',
},
{
label: '本月费用',
value: '¥1,234',
icon: '💳',
color: 'text-yellow-400',
},
].map((stat, index) => (
{stat.icon}
{stat.value}
{stat.label}
))}
{/* Recent Activities */}
最近活动
{[
{
action: '创建云服务器',
time: '2分钟前',
status: 'success',
},
{
action: '备份数据',
time: '1小时前',
status: 'success',
},
{
action: '升级配置',
time: '3小时前',
status: 'warning',
},
{
action: '重启服务器',
time: '1天前',
status: 'info',
},
].map((activity, index) => (
{activity.action}
{activity.time}
))}
系统状态
{[
{
service: '云服务器',
status: '正常',
uptime: '99.9%',
},
{
service: '云存储',
status: '正常',
uptime: '99.8%',
},
{
service: '网络服务',
status: '正常',
uptime: '99.9%',
},
{
service: '安全防护',
status: '正常',
uptime: '100%',
},
].map((service, index) => (
{service.service}
可用性: {service.uptime}
{service.status}
))}
)}
{activeSection === 'servers' && (
云服务器管理
{[
{
name: 'web-server-01',
status: '运行中',
cpu: '2核',
memory: '4GB',
ip: '192.168.1.10',
},
{
name: 'db-server-01',
status: '运行中',
cpu: '4核',
memory: '8GB',
ip: '192.168.1.11',
},
{
name: 'app-server-01',
status: '已停止',
cpu: '2核',
memory: '4GB',
ip: '192.168.1.12',
},
].map((server, index) => (
{server.name}
{server.cpu}
{server.memory}
{server.ip}
{server.status}
))}
)}
{activeSection === 'monitoring' && (
监控中心
CPU 使用率
{[
{ server: 'web-server-01', usage: 45 },
{ server: 'db-server-01', usage: 78 },
{ server: 'app-server-01', usage: 23 },
].map((item, index) => (
{item.server}
{item.usage}%
))}
内存使用率
{[
{ server: 'web-server-01', usage: 62 },
{ server: 'db-server-01', usage: 89 },
{ server: 'app-server-01', usage: 34 },
].map((item, index) => (
{item.server}
{item.usage}%
))}
)}
{/* Other sections can be added similarly */}
{activeSection !== 'overview' &&
activeSection !== 'servers' &&
activeSection !== 'monitoring' && (
)}
);
}