import React, { useState, useMemo } from 'react'; import { BookOpen, Download, Search, Star, Clock, Filter, Home, Book, FileText, Users, GraduationCap, ChevronRight, Moon, Sun, Menu, X } from 'lucide-react'; const EduPlatform = () => { const [currentPage, setCurrentPage] = useState('home'); const [selectedGrade, setSelectedGrade] = useState(null); const [selectedCategory, setSelectedCategory] = useState(null); const [searchQuery, setSearchQuery] = useState(''); const [filterSubject, setFilterSubject] = useState('all'); const [filterYear, setFilterYear] = useState('all'); const [darkMode, setDarkMode] = useState(false); const [bookmarks, setBookmarks] = useState([]); const [showFilters, setShowFilters] = useState(false); const [mobileMenuOpen, setMobileMenuOpen] = useState(false); // Sample data structure const subjects = { primary: ['Mathematics', 'Science', 'English', 'Sinhala', 'Tamil', 'History', 'Geography', 'Health Science'], secondary: ['Mathematics', 'Science', 'English', 'Sinhala', 'Tamil', 'History', 'Geography', 'ICT', 'Commerce', 'Art', 'Music'], advanced: ['Combined Mathematics', 'Physics', 'Chemistry', 'Biology', 'ICT', 'Economics', 'Business Studies', 'Accounting', 'English', 'Sinhala', 'Tamil'] }; const categories = [ { id: 'past-papers', name: 'Past Exam Papers', icon: FileText, color: 'bg-blue-500' }, { id: 'model-papers', name: 'Model Question Papers', icon: Book, color: 'bg-green-500' }, { id: 'teacher-guides', name: 'Teacher Guides', icon: Users, color: 'bg-purple-500' }, { id: 'revision-notes', name: 'Revision Notes', icon: BookOpen, color: 'bg-orange-500' }, { id: 'other-materials', name: 'Other Learning Materials', icon: GraduationCap, color: 'bg-pink-500' } ]; // Sample materials data const sampleMaterials = [ { id: 1, title: 'Mathematics - First Term Exam 2024', subject: 'Mathematics', year: '2024', type: 'past-papers', grade: 5, downloads: 234 }, { id: 2, title: 'Science Model Paper - Second Term', subject: 'Science', year: '2024', type: 'model-papers', grade: 5, downloads: 189 }, { id: 3, title: 'English Grammar Guide', subject: 'English', year: '2024', type: 'teacher-guides', grade: 5, downloads: 156 }, { id: 4, title: 'History Revision Notes - Ancient Civilizations', subject: 'History', year: '2024', type: 'revision-notes', grade: 5, downloads: 98 }, { id: 5, title: 'Mathematics Practice Worksheets', subject: 'Mathematics', year: '2024', type: 'other-materials', grade: 5, downloads: 267 }, ]; const getSubjectsForGrade = (grade) => { if (grade <= 5) return subjects.primary; if (grade <= 11) return subjects.secondary; return subjects.advanced; }; const filteredMaterials = useMemo(() => { return sampleMaterials.filter(material => { const matchesGrade = !selectedGrade || material.grade === selectedGrade; const matchesCategory = !selectedCategory || material.type === selectedCategory; const matchesSearch = !searchQuery || material.title.toLowerCase().includes(searchQuery.toLowerCase()) || material.subject.toLowerCase().includes(searchQuery.toLowerCase()); const matchesSubject = filterSubject === 'all' || material.subject === filterSubject; const matchesYear = filterYear === 'all' || material.year === filterYear; return matchesGrade && matchesCategory && matchesSearch && matchesSubject && matchesYear; }); }, [selectedGrade, selectedCategory, searchQuery, filterSubject, filterYear]); const toggleBookmark = (id) => { setBookmarks(prev => prev.includes(id) ? prev.filter(b => b !== id) : [...prev, id] ); }; const HomePage = () => (
Your friendly place to find exam papers, notes, and learning materials
Choose a category to explore learning materials
Grade {selectedGrade}
No materials found. Try adjusting your filters!