diff --git a/src/components/Nav.tsx b/src/components/Nav.tsx index e178917..af7d7bc 100644 --- a/src/components/Nav.tsx +++ b/src/components/Nav.tsx @@ -21,7 +21,7 @@ function Nav({ currentPage }: NavProps) { {t('nav.servers')} {t('nav.blog')} {t('nav.git')} - {t('nav.forum')} + {t('nav.forum')} {t('nav.friends')} diff --git a/src/locales/en.json b/src/locales/en.json index bcc4045..dcd5bbd 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -87,6 +87,25 @@ "regions": "Regions", "uptime": "Uptime" }, + "forum": { + "title": "Community Forum", + "subtitle": "Connect with fellow Counter-Strike players, share strategies, and discuss the latest updates", + "createThread": "Create New Thread", + "categories": "Forum Categories", + "threads": "threads", + "posts": "posts", + "lastPost": "Last Post", + "by": "by", + "recentThreads": "Recent Threads", + "thread": "Thread", + "replies": "Replies", + "views": "Views", + "forumStats": "Forum Statistics", + "totalThreads": "Total Threads", + "totalPosts": "Total Posts", + "onlineUsers": "Online Users", + "newMembers": "New Members" + }, "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 cb560b2..b74217d 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -87,6 +87,25 @@ "regions": "地区", "uptime": "正常运行时间" }, + "forum": { + "title": "社区论坛", + "subtitle": "与其他反恐精英玩家交流,分享策略,讨论最新更新", + "createThread": "创建新主题", + "categories": "论坛分类", + "threads": "主题", + "posts": "帖子", + "lastPost": "最后回复", + "by": "由", + "recentThreads": "最新主题", + "thread": "主题", + "replies": "回复", + "views": "查看", + "forumStats": "论坛统计", + "totalThreads": "总主题数", + "totalPosts": "总帖子数", + "onlineUsers": "在线用户", + "newMembers": "新成员" + }, "blog": { "title": "社区博客", "subtitle": "及时了解反恐精英社区的最新新闻、教程和见解", diff --git a/src/main.tsx b/src/main.tsx index 2c1984a..c600038 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -9,6 +9,7 @@ import App from './App.tsx' import Friends from './pages/Friends.tsx' import Blog from './pages/Blog.tsx' import Servers from './pages/Servers.tsx' +import Forum from './pages/Forum.tsx' createRoot(document.getElementById('root')!).render( @@ -20,6 +21,7 @@ createRoot(document.getElementById('root')!).render( } /> } /> } /> + } /> diff --git a/src/pages/Forum.tsx b/src/pages/Forum.tsx new file mode 100644 index 0000000..743b33e --- /dev/null +++ b/src/pages/Forum.tsx @@ -0,0 +1,579 @@ +import { useTranslation } from 'react-i18next' +import Layout from '../components/Layout' +import '../App.css' + +interface ForumThread { + id: number + title: string + author: string + replies: number + views: number + lastPost: { + author: string + time: string + } + isSticky?: boolean + isLocked?: boolean + category: string +} + +interface ForumCategory { + id: string + name: string + description: string + threads: number + posts: number + lastPost?: { + thread: string + author: string + time: string + } + icon: string +} + +function Forum() { + const { t } = useTranslation() + + // Mock forum categories + const categories: ForumCategory[] = [ + { + id: 'general', + name: 'General Discussion', + description: 'General topics about Counter-Strike and gaming', + threads: 1247, + posts: 8923, + lastPost: { + thread: 'New update discussion', + author: 'ProGamer99', + time: '2 hours ago' + }, + icon: '💬' + }, + { + id: 'strategy', + name: 'Strategy & Tactics', + description: 'Discuss strategies, tactics, and gameplay tips', + threads: 856, + posts: 5432, + lastPost: { + thread: 'Dust2 A site defense', + author: 'TacticalNuke', + time: '1 hour ago' + }, + icon: '🎯' + }, + { + id: 'esports', + name: 'Esports & Tournaments', + description: 'Professional gaming, tournaments, and competitive play', + threads: 623, + posts: 4121, + lastPost: { + thread: 'Major championship predictions', + author: 'EsportsFan', + time: '30 minutes ago' + }, + icon: '🏆' + }, + { + id: 'technical', + name: 'Technical Support', + description: 'Help with game issues, bugs, and technical problems', + threads: 445, + posts: 2897, + lastPost: { + thread: 'Game crashing on startup', + author: 'TechSupport', + time: '15 minutes ago' + }, + icon: '🔧' + }, + { + id: 'offtopic', + name: 'Off-Topic', + description: 'Non-gaming discussions and casual chat', + threads: 334, + posts: 2156, + lastPost: { + thread: 'Favorite gaming snacks', + author: 'FoodieGamer', + time: '45 minutes ago' + }, + icon: '🎮' + } + ] + + // Mock recent threads + const recentThreads: ForumThread[] = [ + { + id: 1, + title: 'New CS2 update - Weapon balance changes', + author: 'GameMaster', + replies: 23, + views: 1247, + lastPost: { + author: 'ProPlayer', + time: '5 minutes ago' + }, + category: 'general' + }, + { + id: 2, + title: 'How to improve your aim in 30 days', + author: 'AimTrainer', + replies: 45, + views: 2156, + lastPost: { + author: 'NewbieGamer', + time: '12 minutes ago' + }, + category: 'strategy' + }, + { + id: 3, + title: 'Major tournament bracket predictions', + author: 'EsportsAnalyst', + replies: 67, + views: 3421, + lastPost: { + author: 'TournamentFan', + time: '18 minutes ago' + }, + category: 'esports' + }, + { + id: 4, + title: 'Game freezing after latest patch', + author: 'FrustratedPlayer', + replies: 12, + views: 567, + lastPost: { + author: 'TechHelper', + time: '25 minutes ago' + }, + category: 'technical' + }, + { + id: 5, + title: 'Best gaming setup under $1000', + author: 'PCMaster', + replies: 89, + views: 4321, + lastPost: { + author: 'BudgetBuilder', + time: '32 minutes ago' + }, + category: 'offtopic' + }, + { + id: 6, + title: 'Team communication strategies', + author: 'TeamLeader', + replies: 34, + views: 1876, + lastPost: { + author: 'VoiceChatPro', + time: '41 minutes ago' + }, + category: 'strategy', + isSticky: true + }, + { + id: 7, + title: 'Server rules and guidelines', + author: 'Admin', + replies: 8, + views: 2156, + lastPost: { + author: 'Moderator', + time: '1 hour ago' + }, + category: 'general', + isSticky: true, + isLocked: true + } + ] + + const getCategoryIcon = (categoryId: string) => { + const category = categories.find(cat => cat.id === categoryId) + return category?.icon || '💬' + } + + return ( + + {/* Forum Page Header */} + + + + {t('forum.title')} + + + {t('forum.subtitle')} + + + {t('forum.createThread')} + + + + + {/* Forum Categories */} + + + {t('forum.categories')} + + + + {categories.map((category) => ( + { + 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' + }} + > + {/* Category Header */} + + + {category.icon} + + + + {category.name} + + + {category.description} + + + + + {/* Category Stats */} + + + {category.threads} {t('forum.threads')} + {category.posts} {t('forum.posts')} + + + + {/* Last Post */} + {category.lastPost && ( + + + {t('forum.lastPost')}: + + + {category.lastPost.thread} + + + {t('forum.by')} {category.lastPost.author} • {category.lastPost.time} + + + )} + + ))} + + + + {/* Recent Threads */} + + + {t('forum.recentThreads')} + + + + {/* Table Header */} + + {t('forum.thread')} + {t('forum.replies')} + {t('forum.views')} + {t('forum.lastPost')} + + + {/* Thread Rows */} + {recentThreads.map((thread) => ( + { + e.currentTarget.style.backgroundColor = 'var(--bg-primary)' + }} + onMouseLeave={(e) => { + e.currentTarget.style.backgroundColor = 'transparent' + }} + > + {/* Thread Info */} + + + + {getCategoryIcon(thread.category)} + + + {thread.isSticky && '📌 '} + {thread.isLocked && '🔒 '} + {thread.title} + + + + {t('forum.by')} {thread.author} + + + + {/* Replies */} + + {thread.replies} + + + {/* Views */} + + {thread.views} + + + {/* Last Post */} + + {thread.lastPost.author} + {thread.lastPost.time} + + + ))} + + + + {/* Forum Stats */} + + + + {t('forum.forumStats')} + + + + + {categories.reduce((sum, cat) => sum + cat.threads, 0)} + + + {t('forum.totalThreads')} + + + + + {categories.reduce((sum, cat) => sum + cat.posts, 0)} + + + {t('forum.totalPosts')} + + + + + 1,247 + + + {t('forum.onlineUsers')} + + + + + 892 + + + {t('forum.newMembers')} + + + + + + + ) +} + +export default Forum \ No newline at end of file
+ {t('forum.subtitle')} +
+ {category.description} +