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 BinarySearchTrick from '@/components/BinarySearchTrick'; import TernarySearchTrick from '@/components/TernarySearchTrick'; import GuessingGame from '@/components/GuessingGame'; interface Interactive { id: string; title: string; description: string; tags: string[]; component: React.ComponentType<{ showSocialShare?: boolean }>; } const interactives: Interactive[] = [ { id: 'guessing-game', title: 'Number Guessing Game', description: 'Experience different search algorithms through interactive gameplay. Compare random, linear, and binary search strategies!', tags: ['algorithms', 'search', 'educational', 'interactive', 'binary-search', 'computer-science'], component: GuessingGame }, { id: 'binary-search-trick', title: 'Binary Search Magic Trick', description: 'Perform an amazing magic trick that reveals how binary numbers work. Think of a number and watch the magic happen!', tags: ['binary', 'magic', 'numbers', 'trick', 'data-structures'], component: BinarySearchTrick }, { id: 'ternary-search-trick', title: 'Ternary Search Magic Trick', description: 'Experience the magic of ternary search! Think of a number and watch as the cards reveal it through mathematical calculations.', tags: ['ternary', 'magic', 'numbers', 'trick', 'data-structures', 'search'], component: TernarySearchTrick }, ]; const InteractiveGallery = () => { const [searchTerm, setSearchTerm] = useState(''); const [selectedInteractive, setSelectedInteractive] = useState(null); const filteredInteractives = interactives.filter(interactive => interactive.title.toLowerCase().includes(searchTerm.toLowerCase()) || interactive.description.toLowerCase().includes(searchTerm.toLowerCase()) || interactive.tags.some(tag => tag.toLowerCase().includes(searchTerm.toLowerCase()))); if (selectedInteractive) { const InteractiveComponent = selectedInteractive.component; return (
); } return (

Data Structures and Algorithms

Interactive explorations of elementary data structures and algorithms.

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

No interactives found matching your search.

}
); }; export default InteractiveGallery;