import React, { useState } from 'react'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import { Input } from '@/components/ui/input'; import { Badge } from '@/components/ui/badge'; import { Search } from 'lucide-react'; import Layout from '@/components/Layout'; import GameOfSim from '@/components/GameOfSim'; interface Game { id: string; title: string; description: string; tags: string[]; component: React.ComponentType<{ showSocialShare?: boolean }>; } const games: Game[] = [ { id: 'game-of-sim', title: 'Game of Sim', description: 'A strategic two-player game where you take turns coloring edges between vertices, trying to avoid creating a triangle of your own color.', tags: ['strategy', 'graph-theory', 'two-player', 'logic', 'game-theory'], component: GameOfSim } ]; const GamesGallery = () => { const [searchTerm, setSearchTerm] = useState(''); const [selectedGame, setSelectedGame] = useState(null); const filteredGames = games.filter(game => game.title.toLowerCase().includes(searchTerm.toLowerCase()) || game.description.toLowerCase().includes(searchTerm.toLowerCase()) || game.tags.some(tag => tag.toLowerCase().includes(searchTerm.toLowerCase())) ); if (selectedGame) { const GameComponent = selectedGame.component; return (
); } return (

Educational Games

Learn through play with interactive games that reinforce computer science and mathematical concepts.

{/* Search bar */}
setSearchTerm(e.target.value)} className="pl-10" />
{/* Games Gallery */}
{filteredGames.map(game => ( setSelectedGame(game)} > {game.title} {game.description}
{game.tags.map(tag => ( {tag} ))}
))}
{filteredGames.length === 0 && (

No games found matching your search.

)}
); }; export default GamesGallery;