From ff056c4c47ffc12d78c9a39ccc02a136ee5b3661 Mon Sep 17 00:00:00 2001 From: cialloo Date: Sat, 4 Oct 2025 09:26:13 +0800 Subject: [PATCH] Refactor Friends component to implement category filtering and update friend links data --- src/pages/Friends.tsx | 113 ++++++++++++++++++------------------------ 1 file changed, 47 insertions(+), 66 deletions(-) diff --git a/src/pages/Friends.tsx b/src/pages/Friends.tsx index 1029bcd..f6f0c81 100644 --- a/src/pages/Friends.tsx +++ b/src/pages/Friends.tsx @@ -1,4 +1,5 @@ import { useTranslation } from 'react-i18next' +import { useState } from 'react' import Layout from '../components/Layout' import '../App.css' @@ -13,68 +14,39 @@ interface FriendLink { function Friends() { const { t } = useTranslation() + const [selectedCategory, setSelectedCategory] = useState('All') // Mock friend links data const friendLinks: FriendLink[] = [ { id: 1, - name: "GameDev Hub", - description: "A community for game developers sharing tutorials and resources", - url: "https://gamedevhub.example.com", - category: "Development" + name: "Steam Profile", + description: "Follow my gaming journey, see what I'm playing, and connect with me on Steam", + url: "https://steamcommunity.com/profiles/76561198281616762", + category: "Admin" }, { id: 2, - name: "Counter-Strike Pro", - description: "Professional Counter-Strike training and analysis platform", - url: "https://cspro.example.com", - category: "Gaming" + name: "VRChat", + description: "Join me in virtual reality! Explore worlds, hang out, and experience VR together", + url: "https://vrchat.com/home/user/usr_621802be-d8eb-4e82-bea0-97463c0d1a57", + category: "Admin" }, { id: 3, - name: "Tech Blog Central", - description: "Latest technology news and programming tutorials", - url: "https://techblog.example.com", - category: "Technology" - }, - { - id: 4, - name: "Esports Arena", - description: "Comprehensive esports coverage and tournament information", - url: "https://esportsarena.example.com", - category: "Esports" - }, - { - id: 5, - name: "Open Source Gaming", - description: "Open source gaming projects and community contributions", - url: "https://opensourcegaming.example.com", - category: "Open Source" - }, - { - id: 6, - name: "Gaming News Daily", - description: "Daily gaming news, reviews, and industry updates", - url: "https://gamingnews.example.com", - category: "News" - }, - { - id: 7, - name: "React Game Dev", - description: "Building games with React and modern web technologies", - url: "https://reactgamedev.example.com", - category: "Development" - }, - { - id: 8, - name: "Competitive Gaming", - description: "Tips, strategies, and guides for competitive gaming", - url: "https://competitivegaming.example.com", - category: "Gaming" + name: "GitHub", + description: "Check out my code repositories, open source projects, and development work", + url: "https://github.com/moemoequte", + category: "Admin" } ] const categories = [...new Set(friendLinks.map(link => link.category))] + + // Filter friends based on selected category + const filteredFriends = selectedCategory === 'All' + ? friendLinks + : friendLinks.filter(link => link.category === selectedCategory) return ( @@ -91,27 +63,36 @@ function Friends() { {/* Category Filter */}
- - {categories.map(category => ( - + {categories.map(category => ( + ))} @@ -123,7 +104,7 @@ function Friends() { gridTemplateColumns: 'repeat(auto-fit, minmax(300px, 1fr))', gap: '2rem' }}> - {friendLinks.map(friend => ( + {filteredFriends.map(friend => (