import React, { useState } from 'react'; const mockPosts = [ { id: 1, title: 'How to set up AeThex Passport for your game?', author: { name: 'Trevor', avatar: 'T', color: '#ff0000' }, content: 'I want to integrate Passport authentication into my Unity game. What are the steps?', tags: ['question', 'passport', 'unity'], replies: 12, reactions: { '👍': 24, '❤️': 5 }, pinned: true, createdAt: '2 hours ago', lastActivity: '15 minutes ago', }, { id: 2, title: '[Tutorial] Complete Nexus SDK Integration Guide', author: { name: 'Sarah', avatar: 'S', color: '#ffa500' }, content: 'Step-by-step guide for integrating the Nexus SDK into your application...', tags: ['tutorial', 'nexus', 'sdk'], replies: 45, reactions: { '🔥': 89, '👍': 67, '❤️': 23 }, pinned: true, createdAt: '1 day ago', lastActivity: '30 minutes ago', }, { id: 3, title: 'Bug: Voice chat not working on Linux', author: { name: 'DevUser_456', avatar: 'D' }, content: 'Getting an error when trying to join voice channels on Ubuntu 22.04...', tags: ['bug', 'linux', 'voice'], replies: 8, reactions: { '👍': 12 }, pinned: false, createdAt: '5 hours ago', lastActivity: '1 hour ago', }, { id: 4, title: 'Show off your AeThex-powered projects!', author: { name: 'Anderson', avatar: 'A', color: '#5865f2' }, content: 'Share what you\'ve built with AeThex tools and get feedback from the community.', tags: ['showcase', 'community'], replies: 156, reactions: { '🚀': 234, '❤️': 145, '👏': 89 }, pinned: false, createdAt: '3 days ago', lastActivity: '10 minutes ago', }, ]; const tags = [ { id: 'all', label: 'All Posts', color: '#5865f2' }, { id: 'question', label: 'Question', color: '#3ba55d' }, { id: 'tutorial', label: 'Tutorial', color: '#faa61a' }, { id: 'bug', label: 'Bug Report', color: '#ed4245' }, { id: 'showcase', label: 'Showcase', color: '#9b59b6' }, { id: 'discussion', label: 'Discussion', color: '#747f8d' }, ]; export default function ForumChannel({ channel, onClose }) { const [activeTag, setActiveTag] = useState('all'); const [sortBy, setSortBy] = useState('activity'); const [search, setSearch] = useState(''); const [selectedPost, setSelectedPost] = useState(null); const channelData = channel || { name: 'help-forum', description: 'Get help with AeThex products and services', guidelines: 'Be respectful, search before posting, use appropriate tags.', }; const filteredPosts = mockPosts.filter(post => { const matchesTag = activeTag === 'all' || post.tags.includes(activeTag); const matchesSearch = !search || post.title.toLowerCase().includes(search.toLowerCase()) || post.content.toLowerCase().includes(search.toLowerCase()); return matchesTag && matchesSearch; }); const sortedPosts = [...filteredPosts].sort((a, b) => { if (a.pinned && !b.pinned) return -1; if (!a.pinned && b.pinned) return 1; return 0; }); if (selectedPost) { return ( setSelectedPost(null)} /> ); } return (
💬

{channelData.name}

{channelData.description}

🔍 setSearch(e.target.value)} />
{tags.map(tag => ( ))}
{sortedPosts.map(post => (
setSelectedPost(post)} > {post.pinned && 📌 Pinned}
{post.author.avatar}

{post.title}

{post.content}

{post.tags.map(tagId => { const tag = tags.find(t => t.id === tagId); return tag ? ( {tag.label} ) : null; })}
💬 {post.replies} {Object.entries(post.reactions).map(([emoji, count]) => ( {emoji} {count} ))}
{post.author.name} Last activity {post.lastActivity}
))}
{filteredPosts.length === 0 && (
📭

No posts found

)}
); } function ForumPost({ post, onBack }) { const [replyContent, setReplyContent] = useState(''); const replies = [ { id: 1, author: { name: 'Marcus', avatar: 'M' }, content: 'Have you checked the documentation? There\'s a great guide at docs.aethex.com/passport', time: '1 hour ago', reactions: { '👍': 5 } }, { id: 2, author: { name: 'Sarah', avatar: 'S', color: '#ffa500' }, content: 'I wrote a tutorial for this! Check out post #2 in this forum.', time: '45 minutes ago', reactions: { '❤️': 3 } }, ]; return (

{post.title}

{post.author.avatar}
{post.author.name} Posted {post.createdAt}

{post.content}

{Object.entries(post.reactions).map(([emoji, count]) => ( ))}

Replies ({replies.length})

{replies.map(reply => (
{reply.author.avatar}
{reply.author.name} {reply.time}

{reply.content}

{Object.entries(reply.reactions).map(([emoji, count]) => ( ))}
))}