diff --git a/src/components/Nav.tsx b/src/components/Nav.tsx index 130ec88..e178917 100644 --- a/src/components/Nav.tsx +++ b/src/components/Nav.tsx @@ -18,7 +18,7 @@ function Nav({ currentPage }: NavProps) {
{t('nav.home')} - {t('nav.servers')} + {t('nav.servers')} {t('nav.blog')} {t('nav.git')} {t('nav.forum')} diff --git a/src/locales/en.json b/src/locales/en.json index eea5b2b..bcc4045 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -73,6 +73,20 @@ "english": "English", "chinese": "中文" }, + "servers": { + "title": "Game Servers", + "subtitle": "Join active Counter-Strike servers and compete with players worldwide", + "players": "Players", + "ping": "Ping", + "joinServer": "Join Server", + "maintenance": "Maintenance", + "offline": "Offline", + "serverStats": "Server Statistics", + "onlineServers": "Online Servers", + "totalPlayers": "Total Players", + "regions": "Regions", + "uptime": "Uptime" + }, "blog": { "title": "Community Blog", "subtitle": "Stay updated with the latest news, tutorials, and insights from the Counter-Strike community", diff --git a/src/locales/zh.json b/src/locales/zh.json index 24e7894..cb560b2 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -73,6 +73,20 @@ "english": "English", "chinese": "中文" }, + "servers": { + "title": "游戏服务器", + "subtitle": "加入活跃的反恐精英服务器,与全球玩家竞技", + "players": "玩家", + "ping": "延迟", + "joinServer": "加入服务器", + "maintenance": "维护中", + "offline": "离线", + "serverStats": "服务器统计", + "onlineServers": "在线服务器", + "totalPlayers": "总玩家数", + "regions": "地区", + "uptime": "正常运行时间" + }, "blog": { "title": "社区博客", "subtitle": "及时了解反恐精英社区的最新新闻、教程和见解", diff --git a/src/main.tsx b/src/main.tsx index d263d06..db09fab 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -7,6 +7,7 @@ import { ThemeProvider } from './contexts/ThemeContext' import App from './App.tsx' import Friends from './pages/Friends.tsx' import Blog from './pages/Blog.tsx' +import Servers from './pages/Servers.tsx' createRoot(document.getElementById('root')!).render( @@ -16,6 +17,7 @@ createRoot(document.getElementById('root')!).render( } /> } /> } /> + } /> diff --git a/src/pages/Servers.tsx b/src/pages/Servers.tsx new file mode 100644 index 0000000..8b2e224 --- /dev/null +++ b/src/pages/Servers.tsx @@ -0,0 +1,497 @@ +import { useTranslation } from 'react-i18next' +import Layout from '../components/Layout' +import '../App.css' + +interface Server { + id: number + name: string + map: string + gameMode: string + players: number + maxPlayers: number + ping: number + region: string + difficulty: 'Easy' | 'Normal' | 'Hard' | 'Expert' + status: 'online' | 'offline' | 'maintenance' + description: string + tags: string[] +} + +function Servers() { + const { t } = useTranslation() + + // Mock server data + const servers: Server[] = [ + { + id: 1, + name: "Dust2 Classic - Competitive", + map: "de_dust2", + gameMode: "Competitive", + players: 8, + maxPlayers: 10, + ping: 23, + region: "Asia-Pacific", + difficulty: "Normal", + status: "online", + description: "Classic Dust2 competitive matches with skilled players", + tags: ["Competitive", "Ranked", "Dust2"] + }, + { + id: 2, + name: "Mirage Pro League", + map: "de_mirage", + gameMode: "Premier", + players: 10, + maxPlayers: 10, + ping: 45, + region: "Europe", + difficulty: "Hard", + status: "online", + description: "Professional Mirage matches for experienced players", + tags: ["Premier", "Mirage", "Pro"] + }, + { + id: 3, + name: "Inferno Casual", + map: "de_inferno", + gameMode: "Casual", + players: 6, + maxPlayers: 12, + ping: 67, + region: "North America", + difficulty: "Easy", + status: "online", + description: "Relaxed Inferno matches for all skill levels", + tags: ["Casual", "Inferno", "Beginner"] + }, + { + id: 4, + name: "Nuke Tactical", + map: "de_nuke", + gameMode: "Tactical", + players: 9, + maxPlayers: 10, + ping: 34, + region: "Asia-Pacific", + difficulty: "Expert", + status: "online", + description: "Tactical Nuke gameplay with strategic objectives", + tags: ["Tactical", "Nuke", "Strategy"] + }, + { + id: 5, + name: "Vertigo Deathmatch", + map: "de_vertigo", + gameMode: "Deathmatch", + players: 12, + maxPlayers: 16, + ping: 28, + region: "Europe", + difficulty: "Normal", + status: "online", + description: "Fast-paced Vertigo deathmatch action", + tags: ["Deathmatch", "Vertigo", "FFA"] + }, + { + id: 6, + name: "Ancient Wingman", + map: "de_ancient", + gameMode: "Wingman", + players: 2, + maxPlayers: 4, + ping: 52, + region: "North America", + difficulty: "Normal", + status: "online", + description: "2v2 Wingman matches on Ancient", + tags: ["Wingman", "Ancient", "2v2"] + }, + { + id: 7, + name: "Overpass Scrim", + map: "de_overpass", + gameMode: "Scrimmage", + players: 8, + maxPlayers: 10, + ping: 41, + region: "South America", + difficulty: "Hard", + status: "online", + description: "Team scrimmage matches for practice", + tags: ["Scrimmage", "Overpass", "Practice"] + }, + { + id: 8, + name: "Cache Community", + map: "de_cache", + gameMode: "Community", + players: 0, + maxPlayers: 10, + ping: 89, + region: "Europe", + difficulty: "Easy", + status: "maintenance", + description: "Community server - currently under maintenance", + tags: ["Community", "Cache", "Social"] + }, + { + id: 9, + name: "Train Pro League", + map: "de_train", + gameMode: "Premier", + players: 10, + maxPlayers: 10, + ping: 31, + region: "Asia-Pacific", + difficulty: "Expert", + status: "online", + description: "Elite Train matches for top players", + tags: ["Premier", "Train", "Elite"] + }, + { + id: 10, + name: "Cobblestone Casual", + map: "de_cbble", + gameMode: "Casual", + players: 4, + maxPlayers: 12, + ping: 76, + region: "North America", + difficulty: "Easy", + status: "online", + description: "Casual gameplay on the classic Cobblestone", + tags: ["Casual", "Cobblestone", "Classic"] + } + ] + + const getStatusColor = (status: string) => { + switch (status) { + case 'online': return '#10b981' + case 'offline': return '#ef4444' + case 'maintenance': return '#f59e0b' + default: return '#6b7280' + } + } + + const getDifficultyColor = (difficulty: string) => { + switch (difficulty) { + case 'Easy': return '#10b981' + case 'Normal': return '#3b82f6' + case 'Hard': return '#f59e0b' + case 'Expert': return '#ef4444' + default: return '#6b7280' + } + } + + return ( + + {/* Servers Page Header */} +
+
+

+ {t('servers.title')} +

+

+ {t('servers.subtitle')} +

+
+
+ + {/* Servers Grid */} +
+
+ {servers.map((server) => ( +
{ + e.currentTarget.style.transform = 'translateY(-5px)' + e.currentTarget.style.boxShadow = '0 10px 25px rgba(0,0,0,0.2)' + }} + onMouseLeave={(e) => { + e.currentTarget.style.transform = 'translateY(0)' + e.currentTarget.style.boxShadow = 'none' + }} + > + {/* Status Indicator */} +
+ + {/* Server Header */} +
+

+ {server.name} +

+
+ 🗺️ {server.map} + + {server.gameMode} +
+
+ + {/* Server Stats */} +
+
+
+ {t('servers.players')} +
+
+ {server.players}/{server.maxPlayers} +
+
+
+
+ {t('servers.ping')} +
+
+ {server.ping}ms +
+
+
+ + {/* Server Details */} +
+
+ 🌍 {server.region} + + {server.difficulty} + +
+

+ {server.description} +

+
+ + {/* Tags */} +
+ {server.tags.map((tag, index) => ( + + {tag} + + ))} +
+ + {/* Join Button */} + +
+ ))} +
+
+ + {/* Server Stats Summary */} +
+
+

+ {t('servers.serverStats')} +

+
+
+
+ {servers.filter(s => s.status === 'online').length} +
+
+ {t('servers.onlineServers')} +
+
+
+
+ {servers.reduce((sum, s) => sum + s.players, 0)} +
+
+ {t('servers.totalPlayers')} +
+
+
+
+ 4 +
+
+ {t('servers.regions')} +
+
+
+
+ 95% +
+
+ {t('servers.uptime')} +
+
+
+
+
+
+ ) +} + +export default Servers \ No newline at end of file