import React, { useState, useEffect } from 'react'; import { Sun, Moon, Globe, User, Camera, Mic, BookOpen, Video, FileText, HelpCircle, ChevronLeft, ChevronRight, Menu, X, Check, AlertTriangle, Mail, Lock, Eye, EyeOff, ArrowRight, BarChart2, Users, BookOpen as Courses, Settings, LogOut, Home, LogIn, UserPlus, DollarSign, Star, Award, PieChart, TrendingUp, List, Grid, Search, Plus, Edit, Trash2 } from 'lucide-react'; // Main App Component export default function MathELearningPlatform() { const [darkMode, setDarkMode] = useState(false); const [language, setLanguage] = useState('en'); const [currentPage, setCurrentPage] = useState('home'); const [menuOpen, setMenuOpen] = useState(false); const [aiAssistantOpen, setAiAssistantOpen] = useState(false); const [isAuthenticated, setIsAuthenticated] = useState(false); const [isAdmin, setIsAdmin] = useState(false); // Toggle dark mode and store preference const toggleDarkMode = () => { setDarkMode(!darkMode); document.documentElement.classList.toggle('dark'); }; // Change language and handle RTL for Arabic const changeLanguage = (lang) => { setLanguage(lang); document.documentElement.dir = lang === 'ar' ? 'rtl' : 'ltr'; }; // Handle login const handleLogin = (email, password, asAdmin = false) => { // In a real app, this would validate credentials with a backend setIsAuthenticated(true); setIsAdmin(asAdmin); setCurrentPage(asAdmin ? 'adminDashboard' : 'dashboard'); }; // Handle logout const handleLogout = () => { setIsAuthenticated(false); setIsAdmin(false); setCurrentPage('home'); }; // Translations object for multilingual support const translations = { en: { home: "Home", login: "Login", register: "Register", dashboard: "Dashboard", courses: "Courses", exercises: "Exercises", quizzes: "Quizzes", profile: "Profile", settings: "Settings", aiAssistant: "AI Assistant", darkMode: "Dark Mode", lightMode: "Light Mode", language: "Language", popularCourses: "Popular Courses", continueStudying: "Continue Studying", recommendedForYou: "Recommended For You", yourProgress: "Your Progress", downloadPDF: "Download PDF", watchVideo: "Watch Video", startExercise: "Start Exercise", takeQuiz: "Take Quiz", solveWithCamera: "Solve with Camera", askWithVoice: "Ask with Voice", nextStep: "Next Step", showSolution: "Show Solution", checkAnswer: "Check Answer", correct: "Correct!", incorrect: "Try Again", hint: "Hint", email: "Email", password: "Password", forgotPassword: "Forgot Password?", dontHaveAccount: "Don't have an account?", signUp: "Sign Up", rememberMe: "Remember Me", welcomeBack: "Welcome Back", loginToAccount: "Login to your account", getStarted: "Get Started", learnMore: "Learn More", features: "Features", pricing: "Pricing", testimonials: "Testimonials", contactUs: "Contact Us", aboutUs: "About Us", termsOfService: "Terms of Service", privacyPolicy: "Privacy Policy", copyright: "© 2023 MathGenius. All rights reserved.", heroTitle: "Master Mathematics with AI-Powered Learning", heroSubtitle: "Interactive courses, personalized learning paths, and AI assistance in multiple languages", featureTitle1: "Interactive Exercises", featureDesc1: "Practice with step-by-step solutions and instant feedback", featureTitle2: "AI Math Assistant", featureDesc2: "Get help anytime with our intelligent AI tutor", featureTitle3: "Multilingual Support", featureDesc3: "Learn in English, French, or Arabic with full UI translations", pricingBasic: "Basic", pricingPro: "Pro", pricingEnterprise: "Enterprise", pricingBasicPrice: "$9.99/month", pricingProPrice: "$19.99/month", pricingEnterprisePrice: "Contact Us", pricingBasicFeature1: "Access to all basic courses", pricingBasicFeature2: "Interactive exercises", pricingBasicFeature3: "Limited AI assistance", pricingProFeature1: "All Basic features", pricingProFeature2: "Advanced courses & quizzes", pricingProFeature3: "Unlimited AI assistance", pricingEnterpriseFeature1: "All Pro features", pricingEnterpriseFeature2: "Custom course creation", pricingEnterpriseFeature3: "Dedicated support", testimonialTitle: "What Our Students Say", adminDashboard: "Admin Dashboard", overview: "Overview", users: "Users", analytics: "Analytics", totalUsers: "Total Users", activeCourses: "Active Courses", completionRate: "Completion Rate", revenue: "Revenue", recentUsers: "Recent Users", userManagement: "User Management", courseManagement: "Course Management", addNewCourse: "Add New Course", editCourse: "Edit Course", deleteCourse: "Delete Course", searchUsers: "Search users...", searchCourses: "Search courses...", name: "Name", role: "Role", status: "Status", actions: "Actions", active: "Active", inactive: "Inactive", student: "Student", instructor: "Instructor", admin: "Admin", lastActive: "Last Active", viewDetails: "View Details", edit: "Edit", delete: "Delete", confirmDelete: "Are you sure you want to delete this item?", cancel: "Cancel", save: "Save", addNew: "Add New", filterBy: "Filter by", sortBy: "Sort by", ascending: "Ascending", descending: "Descending", showingResults: "Showing {start}-{end} of {total} results", previousPage: "Previous Page", nextPage: "Next Page", itemsPerPage: "Items per page", dashboardOverview: "Dashboard Overview", todayStats: "Today's Stats", monthlyStats: "Monthly Stats", yearlyStats: "Yearly Stats", newUsers: "New Users", courseEnrollments: "Course Enrollments", quizCompletions: "Quiz Completions", averageScore: "Average Score", topPerformingCourses: "Top Performing Courses", recentActivities: "Recent Activities", viewAll: "View All", activity: "Activity", time: "Time", userJoined: "User Joined", courseCreated: "Course Created", quizCompleted: "Quiz Completed", certificateIssued: "Certificate Issued", justNow: "Just now", minutesAgo: "{minutes} minutes ago", hoursAgo: "{hours} hours ago", daysAgo: "{days} days ago", }, fr: { home: "Accueil", login: "Connexion", register: "S'inscrire", dashboard: "Tableau de bord", courses: "Cours", exercises: "Exercices", quizzes: "Quiz", profile: "Profil", settings: "Paramètres", aiAssistant: "Assistant IA", darkMode: "Mode sombre", lightMode: "Mode clair", language: "Langue", popularCourses: "Cours populaires", continueStudying: "Continuer l'étude", recommendedForYou: "Recommandé pour vous", yourProgress: "Votre progression", downloadPDF: "Télécharger PDF", watchVideo: "Regarder la vidéo", startExercise: "Commencer l'exercice", takeQuiz: "Faire le quiz", solveWithCamera: "Résoudre avec la caméra", askWithVoice: "Demander avec la voix", nextStep: "Étape suivante", showSolution: "Afficher la solution", checkAnswer: "Vérifier la réponse", correct: "Correct !", incorrect: "Essayez encore", hint: "Indice", email: "Email", password: "Mot de passe", forgotPassword: "Mot de passe oublié ?", dontHaveAccount: "Vous n'avez pas de compte ?", signUp: "S'inscrire", rememberMe: "Se souvenir de moi", welcomeBack: "Bienvenue", loginToAccount: "Connectez-vous à votre compte", getStarted: "Commencer", learnMore: "En savoir plus", features: "Fonctionnalités", pricing: "Tarifs", testimonials: "Témoignages", contactUs: "Contactez-nous", aboutUs: "À propos", termsOfService: "Conditions d'utilisation", privacyPolicy: "Politique de confidentialité", copyright: "© 2023 MathGenius. Tous droits réservés.", heroTitle: "Maîtrisez les mathématiques avec l'apprentissage assisté par IA", heroSubtitle: "Cours interactifs, parcours d'apprentissage personnalisés et assistance IA en plusieurs langues", featureTitle1: "Exercices interactifs", featureDesc1: "Pratiquez avec des solutions étape par étape et des commentaires instantanés", featureTitle2: "Assistant mathématique IA", featureDesc2: "Obtenez de l'aide à tout moment avec notre tuteur IA intelligent", featureTitle3: "Support multilingue", featureDesc3: "Apprenez en anglais, français ou arabe avec des traductions complètes", pricingBasic: "Basique", pricingPro: "Pro", pricingEnterprise: "Entreprise", pricingBasicPrice: "9,99€/mois", pricingProPrice: "19,99€/mois", pricingEnterprisePrice: "Contactez-nous", pricingBasicFeature1: "Accès à tous les cours de base", pricingBasicFeature2: "Exercices interactifs", pricingBasicFeature3: "Assistance IA limitée", pricingProFeature1: "Toutes les fonctionnalités de base", pricingProFeature2: "Cours et quiz avancés", pricingProFeature3: "Assistance IA illimitée", pricingEnterpriseFeature1: "Toutes les fonctionnalités Pro", pricingEnterpriseFeature2: "Création de cours personnalisés", pricingEnterpriseFeature3: "Support dédié", testimonialTitle: "Ce que disent nos étudiants", adminDashboard: "Tableau de bord administrateur", overview: "Aperçu", users: "Utilisateurs", analytics: "Analytique", totalUsers: "Utilisateurs totaux", activeCourses: "Cours actifs", completionRate: "Taux d'achèvement", revenue: "Revenus", recentUsers: "Utilisateurs récents", userManagement: "Gestion des utilisateurs", courseManagement: "Gestion des cours", addNewCourse: "Ajouter un nouveau cours", editCourse: "Modifier le cours", deleteCourse: "Supprimer le cours", searchUsers: "Rechercher des utilisateurs...", searchCourses: "Rechercher des cours...", name: "Nom", role: "Rôle", status: "Statut", actions: "Actions", active: "Actif", inactive: "Inactif", student: "Étudiant", instructor: "Instructeur", admin: "Administrateur", lastActive: "Dernière activité", viewDetails: "Voir les détails", edit: "Modifier", delete: "Supprimer", confirmDelete: "Êtes-vous sûr de vouloir supprimer cet élément ?", cancel: "Annuler", save: "Enregistrer", addNew: "Ajouter nouveau", filterBy: "Filtrer par", sortBy: "Trier par", ascending: "Ascendant", descending: "Descendant", showingResults: "Affichage de {start}-{end} sur {total} résultats", previousPage: "Page précédente", nextPage: "Page suivante", itemsPerPage: "Éléments par page", dashboardOverview: "Aperçu du tableau de bord", todayStats: "Statistiques du jour", monthlyStats: "Statistiques mensuelles", yearlyStats: "Statistiques annuelles", newUsers: "Nouveaux utilisateurs", courseEnrollments: "Inscriptions aux cours", quizCompletions: "Quiz terminés", averageScore: "Score moyen", topPerformingCourses: "Cours les plus performants", recentActivities: "Activités récentes", viewAll: "Voir tout", activity: "Activité", time: "Heure", userJoined: "Utilisateur inscrit", courseCreated: "Cours créé", quizCompleted: "Quiz terminé", certificateIssued: "Certificat délivré", justNow: "À l'instant", minutesAgo: "Il y a {minutes} minutes", hoursAgo: "Il y a {hours} heures", daysAgo: "Il y a {days} jours", }, ar: { home: "الرئيسية", login: "تسجيل الدخول", register: "التسجيل", dashboard: "لوحة التحكم", courses: "الدورات", exercises: "التمارين", quizzes: "الاختبارات", profile: "الملف الشخصي", settings: "الإعدادات", aiAssistant: "المساعد الذكي", darkMode: "الوضع الداكن", lightMode: "الوضع الفاتح", language: "اللغة", popularCourses: "الدورات الشائعة", continueStudying: "متابعة الدراسة", recommendedForYou: "موصى به لك", yourProgress: "تقدمك", downloadPDF: "تحميل PDF", watchVideo: "مشاهدة الفيديو", startExercise: "بدء التمرين", takeQuiz: "بدء الاختبار", solveWithCamera: "حل باستخدام الكاميرا", askWithVoice: "السؤال بالصوت", nextStep: "الخطوة التالية", showSolution: "عرض الحل", checkAnswer: "تحقق من الإجابة", correct: "صحيح!", incorrect: "حاول مرة أخرى", hint: "تلميح", email: "البريد الإلكتروني", password: "كلمة المرور", forgotPassword: "نسيت كلمة المرور؟", dontHaveAccount: "ليس لديك حساب؟", signUp: "إنشاء حساب", rememberMe: "تذكرني", welcomeBack: "مرحبًا بعودتك", loginToAccount: "تسجيل الدخول إلى حسابك", getStarted: "ابدأ الآن", learnMore: "اعرف المزيد", features: "المميزات", pricing: "الأسعار", testimonials: "آراء الطلاب", contactUs: "اتصل بنا", aboutUs: "من نحن", termsOfService: "شروط الخدمة", privacyPolicy: "سياسة الخصوصية", copyright: "© 2023 ماث جينيوس. جميع الحقوق محفوظة.", heroTitle: "أتقن الرياضيات مع التعلم المدعوم بالذكاء الاصطناعي", heroSubtitle: "دورات تفاعلية، مسارات تعلم مخصصة، ومساعدة الذكاء الاصطناعي بلغات متعددة", featureTitle1: "تمارين تفاعلية", featureDesc1: "تدرب مع حلول خطوة بخطوة وملاحظات فورية", featureTitle2: "مساعد الرياضيات الذكي", featureDesc2: "احصل على المساعدة في أي وقت مع مدرسنا الذكي", featureTitle3: "دعم متعدد اللغات", featureDesc3: "تعلم باللغة الإنجليزية أو الفرنسية أو العربية مع ترجمات كاملة", pricingBasic: "أساسي", pricingPro: "احترافي", pricingEnterprise: "مؤسسات", pricingBasicPrice: "$9.99/شهر", pricingProPrice: "$19.99/شهر", pricingEnterprisePrice: "اتصل بنا", pricingBasicFeature1: "الوصول إلى جميع الدورات الأساسية", pricingBasicFeature2: "تمارين تفاعلية", pricingBasicFeature3: "مساعدة ذكاء اصطناعي محدودة", pricingProFeature1: "جميع ميزات الباقة الأساسية", pricingProFeature2: "دورات واختبارات متقدمة", pricingProFeature3: "مساعدة ذكاء اصطناعي غير محدودة", pricingEnterpriseFeature1: "جميع ميزات الباقة الاحترافية", pricingEnterpriseFeature2: "إنشاء دورات مخصصة", pricingEnterpriseFeature3: "دعم مخصص", testimonialTitle: "ماذا يقول طلابنا", adminDashboard: "لوحة تحكم المسؤول", overview: "نظرة عامة", users: "المستخدمون", analytics: "التحليلات", totalUsers: "إجمالي المستخدمين", activeCourses: "الدورات النشطة", completionRate: "معدل الإكمال", revenue: "الإيرادات", recentUsers: "المستخدمون الجدد", userManagement: "إدارة المستخدمين", courseManagement: "إدارة الدورات", addNewCourse: "إضافة دورة جديدة", editCourse: "تعديل الدورة", deleteCourse: "حذف الدورة", searchUsers: "البحث عن مستخدمين...", searchCourses: "البحث عن دورات...", name: "الاسم", role: "الدور", status: "الحالة", actions: "الإجراءات", active: "نشط", inactive: "غير نشط", student: "طالب", instructor: "مدرس", admin: "مسؤول", lastActive: "آخر نشاط", viewDetails: "عرض التفاصيل", edit: "تعديل", delete: "حذف", confirmDelete: "هل أنت متأكد من رغبتك في حذف هذا العنصر؟", cancel: "إلغاء", save: "حفظ", addNew: "إضافة جديد", filterBy: "تصفية حسب", sortBy: "ترتيب حسب", ascending: "تصاعدي", descending: "تنازلي", showingResults: "عرض {start}-{end} من {total} نتيجة", previousPage: "الصفحة السابقة", nextPage: "الصفحة التالية", itemsPerPage: "العناصر في الصفحة", dashboardOverview: "نظرة عامة على لوحة التحكم", todayStats: "إحصائيات اليوم", monthlyStats: "إحصائيات شهرية", yearlyStats: "إحصائيات سنوية", newUsers: "مستخدمون جدد", courseEnrollments: "التسجيلات في الدورات", quizCompletions: "اختبارات مكتملة", averageScore: "متوسط الدرجات", topPerformingCourses: "أفضل الدورات أداءً", recentActivities: "الأنشطة الأخيرة", viewAll: "عرض الكل", activity: "النشاط", time: "الوقت", userJoined: "انضم مستخدم", courseCreated: "تم إنشاء دورة", quizCompleted: "تم إكمال اختبار", certificateIssued: "تم إصدار شهادة", justNow: "الآن", minutesAgo: "منذ {minutes} دقيقة", hoursAgo: "منذ {hours} ساعة", daysAgo: "منذ {days} يوم", } }; // Get translated text based on current language const t = (key) => translations[language][key] || key; // Render the appropriate page based on currentPage state const renderPage = () => { switch(currentPage) { case 'home': return ; case 'login': return ; case 'dashboard': return ; case 'course': return ; case 'exercise': return ; case 'quiz': return ; case 'adminDashboard': return ; default: return ; } }; return (
{/* Header - Only show on certain pages */} {currentPage !== 'home' && currentPage !== 'login' && (
setCurrentPage(isAdmin ? 'adminDashboard' : 'dashboard')} > MathGenius
{!isAdmin && ( )}
)} {/* Mobile Menu - Only show when authenticated */} {isAuthenticated && (
MathGenius
setMenuOpen(false)} >
)} {/* Main Content */}
{renderPage()}
{/* AI Assistant Sidebar - Only show when authenticated and not admin */} {isAuthenticated && !isAdmin && (
setAiAssistantOpen(false)} />
)} {/* Overlay for AI Assistant */} {aiAssistantOpen && (
setAiAssistantOpen(false)} >
)} {/* Navigation Bar (Desktop) - Only show when authenticated and not admin */} {isAuthenticated && !isAdmin && ( )}
); } // Home Page Component (Landing Page) function HomePage({ t, setCurrentPage, darkMode }) { return (
{/* Navigation */} {/* Hero Section */}

{t('heroTitle')}

{t('heroSubtitle')}

Student learning math
AI
Powered
{/* Features Section */}

{t('features')}

Discover how our platform revolutionizes mathematics education

{t('featureTitle1')}

{t('featureDesc1')}

{t('featureTitle2')}

{t('featureDesc2')}

{t('featureTitle3')}

{t('featureDesc3')}

Interactive Learning Experience

Our platform offers a truly interactive learning experience with:

  • Step-by-step problem solving with visual guidance
  • Instant feedback on exercises and quizzes
  • Adaptive learning paths based on your performance
  • Downloadable resources for offline study

AI-Powered Mathematics Assistant

Get help with any math problem using our advanced AI assistant:

How do I solve this equation: 2x² + 5x - 3 = 0?
To solve this quadratic equation, we can use the quadratic formula:
x = (-b ± √(b² - 4ac)) / 2a

Where a=2, b=5, c=-3

Would you like me to walk through the solution step by step?
{/* Pricing Section */}

{t('pricing')}

Choose the plan that fits your learning needs

{/* Basic Plan */}

{t('pricingBasic')}

{t('pricingBasicPrice')}
  • {t('pricingBasicFeature1')}
  • {t('pricingBasicFeature2')}
  • {t('pricingBasicFeature3')}
{/* Pro Plan */}
Popular

{t('pricingPro')}

{t('pricingProPrice')}
  • {t('pricingProFeature1')}
  • {t('pricingProFeature2')}
  • {t('pricingProFeature3')}
{/* Enterprise Plan */}

{t('pricingEnterprise')}

{t('pricingEnterprisePrice')}
  • {t('pricingEnterpriseFeature1')}
  • {t('pricingEnterpriseFeature2')}
  • {t('pricingEnterpriseFeature3')}
{/* Testimonials Section */}

{t('testimonialTitle')}

Hear from students who have transformed their math skills with our platform

{[...Array(5)].map((_, i) => ( ))}

"MathGenius transformed my approach to calculus. The step-by-step solutions and AI assistant helped me understand concepts I had struggled with for years."

JS
Jamie Smith
University Student
{[...Array(5)].map((_, i) => ( ))}

"As a teacher, I've recommended MathGenius to all my students. The multilingual support makes it accessible to everyone, and the interactive exercises keep students engaged."

ML
Maria Lopez
Math Teacher
{[...Array(5)].map((_, i) => ( ))}

"The camera-based equation solver is a game-changer! I can take a picture of a problem I'm stuck on and get immediate help. My math grades have improved significantly."

AK
Ahmed Khan
High School Student
{/* CTA Section */}

Ready to master mathematics?

Join thousands of students who are transforming their math skills with our AI-powered platform.

{/* Footer */}
); } // Login Page Component function LoginPage({ t, setCurrentPage, handleLogin }) { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [showPassword, setShowPassword] = useState(false); const [rememberMe, setRememberMe] = useState(false); const handleSubmit = (e) => { e.preventDefault(); // Check if admin login if (email === 'admin@example.com' && password === 'admin123') { handleLogin(email, password, true); } else { handleLogin(email, password, false); } }; return (
setCurrentPage('home')} > Math Genius

{t('welcomeBack')}

{t('loginToAccount')}

setEmail(e.target.value)} className="block w-full pl-10 pr-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 dark:focus:ring-teal-500 focus:border-indigo-500 dark:focus:border-teal-500 dark:bg-gray-700" placeholder="you@example.com" />
setPassword(e.target.value)} className="block w-full pl-10 pr-10 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 dark:focus:ring-teal-500 focus:border-indigo-500 dark:focus:border-teal-500 dark:bg-gray-700" placeholder="••••••••" />
setRememberMe(!rememberMe)} className="h-4 w-4 text-indigo-600 dark:text-teal-500 focus:ring-indigo-500 dark:focus:ring-teal-500 border-gray-300 dark:border-gray-600 rounded" />
{t('dontHaveAccount')}
); } // Admin Dashboard Component function AdminDashboard({ t, setCurrentPage }) { const [activeTab, setActiveTab] = useState('overview'); // Mock data for admin dashboard const stats = { totalUsers: 1248, activeCourses: 42, completionRate: 78, revenue: 24680 }; const recentUsers = [ { id: 1, name: "Emma Wilson", email: "emma@example.com", role: "student", status: "active", lastActive: "2 hours ago" }, { id: 2, name: "Michael Brown", email: "michael@example.com", role: "student", status: "active", lastActive: "5 hours ago" }, { id: 3, name: "Sophia Chen", email: "sophia@example.com", role: "instructor", status: "active", lastActive: "1 day ago" }, { id: 4, name: "James Rodriguez", email: "james@example.com", role: "student", status: "inactive", lastActive: "3 days ago" } ]; const courses = [ { id: 1, title: "Calculus I", instructor: "Dr. Sarah Johnson", students: 156, rating: 4.8, status: "active" }, { id: 2, title: "Linear Algebra", instructor: "Prof. David Lee", students: 98, rating: 4.6, status: "active" }, { id: 3, title: "Statistics", instructor: "Dr. Maria Garcia", students: 124, rating: 4.7, status: "active" }, { id: 4, title: "Discrete Mathematics", instructor: "Prof. Robert Chen", students: 87, rating: 4.5, status: "active" } ]; const activities = [ { id: 1, type: "userJoined", user: "Alex Johnson", time: "justNow" }, { id: 2, type: "courseCreated", course: "Advanced Trigonometry", user: "Prof. Lisa Wong", time: "minutesAgo", minutes: 30 }, { id: 3, type: "quizCompleted", user: "Sam Peterson", quiz: "Calculus Fundamentals", score: "92%", time: "hoursAgo", hours: 2 }, { id: 4, type: "certificateIssued", user: "Maria Rodriguez", course: "Linear Algebra", time: "daysAgo", days: 1 } ]; return (
{/* Admin Dashboard Header */}

{t('adminDashboard')}

{/* Admin Tabs */}
{/* Overview Tab Content */} {activeTab === 'overview' && (
{/* Stats Cards */}

{t('totalUsers')}

{stats.totalUsers} +12%

{t('activeCourses')}

{stats.activeCourses} +5%

{t('completionRate')}

{stats.completionRate}% +3%

{t('revenue')}

${stats.revenue} +8%
{/* Recent Users and Activities */}

{t('recentUsers')}

{recentUsers.map(user => ( ))}
{t('name')} {t('role')} {t('status')} {t('lastActive')}
{user.name.charAt(0)}
{user.name}
{user.email}
{t(user.role)} {t(user.status)} {user.lastActive}

{t('recentActivities')}

{activities.map(activity => (
{activity.type === 'userJoined' && } {activity.type === 'courseCreated' && } {activity.type === 'quizCompleted' && } {activity.type === 'certificateIssued' && }

{activity.type === 'userJoined' && `${activity.user} ${t('userJoined')}`} {activity.type === 'courseCreated' && `${activity.user} ${t('courseCreated')}: ${activity.course}`} {activity.type === 'quizCompleted' && `${activity.user} ${t('quizCompleted')}: ${activity.quiz} (${activity.score})`} {activity.type === 'certificateIssued' && `${activity.user} ${t('certificateIssued')}: ${activity.course}`}

{activity.time === 'justNow' && t('justNow')} {activity.time === 'minutesAgo' && t('minutesAgo').replace('{minutes}', activity.minutes)} {activity.time === 'hoursAgo' && t('hoursAgo').replace('{hours}', activity.hours)} {activity.time === 'daysAgo' && t('daysAgo').replace('{days}', activity.days)}
))}
{/* Analytics Charts */}

{t('monthlyStats')}

Analytics charts would be displayed here

)} {/* Users Tab Content */} {activeTab === 'users' && (

{t('userManagement')}

{[...recentUsers, ...recentUsers].map((user, index) => ( ))}
{t('name')} {t('email')} {t('role')} {t('status')} {t('lastActive')} {t('actions')}
{user.name.charAt(0)}
{user.name}
{user.email} {t(user.role)} {t(user.status)} {user.lastActive}
{t('showingResults').replace('{start}', '1').replace('{end}', '8').replace('{total}', '8')}
)} {/* Courses Tab Content */} {activeTab === 'courses' && (

{t('courseManagement')}

{courses.map(course => ( ))}
{t('title')} {t('instructor')} {t('students')} {t('rating')} {t('status')} {t('actions')}
{course.title}
{course.instructor} {course.students}
{course.rating}
{t(course.status)}
{t('showingResults').replace('{start}', '1').replace('{end}', '4').replace('{total}', '4')}
)} {/* Analytics Tab Content */} {activeTab === 'analytics' && (

{t('analytics')}

{t('newUsers')}

128

+12% {t('fromLastMonth')}

{t('courseEnrollments')}

256

+8% {t('fromLastMonth')}

{t('quizCompletions')}

512

+15% {t('fromLastMonth')}

{t('averageScore')}

82%

+3% {t('fromLastMonth')}

{t('userGrowth')}

User growth chart would be displayed here

{t('coursePopularity')}

Course popularity chart would be displayed here

{t('topPerformingCourses')}

{t('course')} {t('students')} {t('completionRate')} {t('averageScore')} {t('revenue')}
Calculus I
156 85% 92% $7,800
Linear Algebra
98 78% 88% $4,900
Statistics
import React, { useState, useEffect } from 'react'; import { Sun, Moon, Globe, User, Camera, Mic, BookOpen, Video, FileText, HelpCircle, ChevronLeft, ChevronRight, Menu, X, Check, AlertTriangle } from 'lucide-react'; // Main App Component export default function MathELearningPlatform() { const [darkMode, setDarkMode] = useState(false); const [language, setLanguage] = useState('en'); const [currentPage, setCurrentPage] = useState('dashboard'); const [menuOpen, setMenuOpen] = useState(false); const [aiAssistantOpen, setAiAssistantOpen] = useState(false); // Toggle dark mode and store preference const toggleDarkMode = () => { setDarkMode(!darkMode); document.documentElement.classList.toggle('dark'); }; // Change language and handle RTL for Arabic const changeLanguage = (lang) => { setLanguage(lang); document.documentElement.dir = lang === 'ar' ? 'rtl' : 'ltr'; }; // Translations object for multilingual support const translations = { en: { dashboard: "Dashboard", courses: "Courses", exercises: "Exercises", quizzes: "Quizzes", profile: "Profile", settings: "Settings", aiAssistant: "AI Assistant", darkMode: "Dark Mode", lightMode: "Light Mode", language: "Language", popularCourses: "Popular Courses", continueStudying: "Continue Studying", recommendedForYou: "Recommended For You", yourProgress: "Your Progress", downloadPDF: "Download PDF", watchVideo: "Watch Video", startExercise: "Start Exercise", takeQuiz: "Take Quiz", solveWithCamera: "Solve with Camera", askWithVoice: "Ask with Voice", nextStep: "Next Step", showSolution: "Show Solution", checkAnswer: "Check Answer", correct: "Correct!", incorrect: "Try Again", hint: "Hint", }, fr: { dashboard: "Tableau de bord", courses: "Cours", exercises: "Exercices", quizzes: "Quiz", profile: "Profil", settings: "Paramètres", aiAssistant: "Assistant IA", darkMode: "Mode sombre", lightMode: "Mode clair", language: "Langue", popularCourses: "Cours populaires", continueStudying: "Continuer l'étude", recommendedForYou: "Recommandé pour vous", yourProgress: "Votre progression", downloadPDF: "Télécharger PDF", watchVideo: "Regarder la vidéo", startExercise: "Commencer l'exercice", takeQuiz: "Faire le quiz", solveWithCamera: "Résoudre avec la caméra", askWithVoice: "Demander avec la voix", nextStep: "Étape suivante", showSolution: "Afficher la solution", checkAnswer: "Vérifier la réponse", correct: "Correct !", incorrect: "Essayez encore", hint: "Indice", }, ar: { dashboard: "لوحة التحكم", courses: "الدورات", exercises: "التمارين", quizzes: "الاختبارات", profile: "الملف الشخصي", settings: "الإعدادات", aiAssistant: "المساعد الذكي", darkMode: "الوضع الداكن", lightMode: "الوضع الفاتح", language: "اللغة", popularCourses: "الدورات الشائعة", continueStudying: "متابعة الدراسة", recommendedForYou: "موصى به لك", yourProgress: "تقدمك", downloadPDF: "تحميل PDF", watchVideo: "مشاهدة الفيديو", startExercise: "بدء التمرين", takeQuiz: "بدء الاختبار", solveWithCamera: "حل باستخدام الكاميرا", askWithVoice: "السؤال بالصوت", nextStep: "الخطوة التالية", showSolution: "عرض الحل", checkAnswer: "تحقق من الإجابة", correct: "صحيح!", incorrect: "حاول مرة أخرى", hint: "تلميح", } }; // Get translated text based on current language const t = (key) => translations[language][key] || key; // Render the appropriate page based on currentPage state const renderPage = () => { switch(currentPage) { case 'dashboard': return ; case 'course': return ; case 'exercise': return ; case 'quiz': return ; default: return ; } }; return (
{/* Header */}
MathGenius
{/* Mobile Menu */}
MathGenius
setMenuOpen(false)} >
{/* Main Content */}
{renderPage()}
{/* AI Assistant Sidebar */}
setAiAssistantOpen(false)} />
{/* Overlay for AI Assistant */} {aiAssistantOpen && (
setAiAssistantOpen(false)} >
)} {/* Navigation Bar (Desktop) */}
); } // Dashboard Component function Dashboard({ t, setCurrentPage }) { // Mock data for dashboard const courses = [ { id: 1, title: "Calculus I", progress: 75, image: "https://images.unsplash.com/photo-1635070041078-e363dbe005cb?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=500&q=80" }, { id: 2, title: "Linear Algebra", progress: 30, image: "https://images.unsplash.com/photo-1509228468518-180dd4864904?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=500&q=80" }, { id: 3, title: "Statistics", progress: 10, image: "https://images.unsplash.com/photo-1551288049-bebda4e38f71?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=500&q=80" }, { id: 4, title: "Discrete Mathematics", progress: 0, image: "https://images.unsplash.com/photo-1580894732444-8ecded7900cd?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=500&q=80" } ]; return (
{/* Welcome Section */}

Welcome back, Alex!

Continue your learning journey in mathematics.

{/* Progress Overview */}

{t('yourProgress')}

{courses.map(course => (
setCurrentPage('course')} >
{course.title}

{course.title}

{course.progress}% {t('completed')}

))}
{/* Recommended Courses */}

{t('recommendedForYou')}

setCurrentPage('course')} >

Differential Equations

Advanced course on solving differential equations

setCurrentPage('course')} >

Number Theory

Explore the fascinating world of numbers

setCurrentPage('course')} >

Geometry

Master geometric principles and proofs

); } // Course Page Component function CoursePage({ t, setCurrentPage }) { const [activeTab, setActiveTab] = useState('content'); return (
{/* Course Header */}

Calculus I

{/* Course Tabs */}
{/* Course Content */} {activeTab === 'content' && (

Module 1: Introduction to Limits

{/* PDF Section */}

Course Notes: Limits and Continuity

PDF Preview

{/* Video Section */}

Video Lecture: Understanding Limits

Subtitles: English
1080p

Module 2: Derivatives

{/* PDF Section */}

Course Notes: Introduction to Derivatives

PDF Preview

)} {/* Exercises Tab */} {activeTab === 'exercises' && (
setCurrentPage('exercise')} >

Exercise 1: Evaluating Limits

Practice calculating limits using algebraic methods

Beginner
setCurrentPage('exercise')} >

Exercise 2: Continuity

Determine where functions are continuous and discontinuous

Intermediate
setCurrentPage('exercise')} >

Exercise 3: Derivative Rules

Apply different rules to find derivatives

Advanced
)} {/* Quizzes Tab */} {activeTab === 'quizzes' && (
setCurrentPage('quiz')} >

Quiz 1: Limits Fundamentals

Test your understanding of basic limit concepts

10 questions 15 min
setCurrentPage('quiz')} >

Quiz 2: Derivatives

Test your knowledge of derivative rules and applications

15 questions 20 min
)}
); } // Exercise Page Component function ExercisePage({ t, setCurrentPage }) { const [currentStep, setCurrentStep] = useState(0); const [showSolution, setShowSolution] = useState(false); const [userAnswer, setUserAnswer] = useState(''); const [feedback, setFeedback] = useState(null); // Mock exercise data const exercise = { title: "Evaluating Limits", steps: [ { question: "Evaluate the limit: \\lim_{x \\to 2} \\frac{x^2 - 4}{x - 2}", solution: "\\begin{align} \\lim_{x \\to 2} \\frac{x^2 - 4}{x - 2} &= \\lim_{x \\to 2} \\frac{(x - 2)(x + 2)}{x - 2} \\\\ &= \\lim_{x \\to 2} (x + 2) \\\\ &= 2 + 2 \\\\ &= 4 \\end{align}", correctAnswer: "4" }, { question: "Evaluate the limit: \\lim_{x \\to 0} \\frac{\\sin x}{x}", solution: "\\begin{align} \\lim_{x \\to 0} \\frac{\\sin x}{x} = 1 \\end{align} This is a fundamental limit in calculus.", correctAnswer: "1" }, { question: "Evaluate the limit: \\lim_{x \\to 1} \\frac{x^3 - 1}{x - 1}", solution: "\\begin{align} \\lim_{x \\to 1} \\frac{x^3 - 1}{x - 1} &= \\lim_{x \\to 1} \\frac{(x - 1)(x^2 + x + 1)}{x - 1} \\\\ &= \\lim_{x \\to 1} (x^2 + x + 1) \\\\ &= 1^2 + 1 + 1 \\\\ &= 3 \\end{align}", correctAnswer: "3" } ] }; const checkAnswer = () => { if (userAnswer === exercise.steps[currentStep].correctAnswer) { setFeedback({ correct: true, message: t('correct') }); } else { setFeedback({ correct: false, message: t('incorrect') }); } }; const nextStep = () => { if (currentStep < exercise.steps.length - 1) { setCurrentStep(currentStep + 1); setShowSolution(false); setUserAnswer(''); setFeedback(null); } }; return (
{/* Exercise Header */}

{exercise.title}

{/* Progress Indicator */}
{currentStep + 1}/{exercise.steps.length}
{/* Exercise Content */}
{/* Question Panel */}

Question {currentStep + 1}

{exercise.steps[currentStep].question}

setUserAnswer(e.target.value)} className="w-full px-3 py-2 border dark:border-gray-700 rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500 dark:focus:ring-teal-500 dark:bg-gray-700" placeholder="Enter your answer here" />
{feedback && (
{feedback.correct ? ( ) : ( )}

{feedback.message}

)}
{/* Solution/Hint Panel */}

{showSolution ? t('solution') : t('hint')}

{showSolution ? (

{t('stepByStepSolution')}:

{exercise.steps[currentStep].solution}

) : (

{t('tryFactoring')}

)} {/* Navigation Buttons */}
); } // Quiz Page Component function QuizPage({ t, setCurrentPage }) { const [currentQuestion, setCurrentQuestion] = useState(0); const [selectedOption, setSelectedOption] = useState(null); const [showExplanation, setShowExplanation] = useState(false); const [quizCompleted, setQuizCompleted] = useState(false); const [score, setScore] = useState(0); // Mock quiz data const quiz = { title: "Limits Fundamentals", questions: [ { question: "What is the value of \\lim_{x \\to 0} \\frac{\\sin x}{x}?", options: ["0", "1", "\\infty", "Does not exist"], correctAnswer: 1, explanation: "This is a fundamental limit in calculus. As x approaches 0, the ratio of sin(x) to x approaches 1." }, { question: "If f(x) is continuous at x = a, then:", options: [ "\\lim_{x \\to a} f(x) = f(a)", "f(x) must be differentiable at x = a", "f(x) must be defined for all x", "f(x) must be a polynomial" ], correctAnswer: 0, explanation: "By definition, a function is continuous at x = a if the limit of f(x) as x approaches a equals f(a)." }, { question: "Which of the following is an indeterminate form?", options: ["\\frac{1}{0}", "\\frac{0}{1}", "\\frac{0}{0}", "\\frac{1}{1}"], correctAnswer: 2, explanation: "The form 0/0 is indeterminate because it doesn't immediately give us information about the limit's value. We need additional techniques like L'Hôpital's rule to evaluate such limits." } ] }; const handleOptionSelect = (index) => { setSelectedOption(index); }; const checkAnswer = () => { if (selectedOption === quiz.questions[currentQuestion].correctAnswer) { setScore(score + 1); } setShowExplanation(true); }; const nextQuestion = () => { if (currentQuestion < quiz.questions.length - 1) { setCurrentQuestion(currentQuestion + 1); setSelectedOption(null); setShowExplanation(false); } else { setQuizCompleted(true); } }; return (
{/* Quiz Header */}

{quiz.title}

{/* Progress Indicator */}
{currentQuestion + 1}/{quiz.questions.length}
{/* Quiz Content */} {!quizCompleted ? (

Question {currentQuestion + 1}

{quiz.questions[currentQuestion].question}

{quiz.questions[currentQuestion].options.map((option, index) => (
!showExplanation && handleOptionSelect(index)} className={`p-3 border rounded-md cursor-pointer transition-colors ${ selectedOption === index ? (showExplanation ? (index === quiz.questions[currentQuestion].correctAnswer ? 'bg-green-100 dark:bg-green-900 border-green-500' : 'bg-red-100 dark:bg-red-900 border-red-500') : 'bg-indigo-100 dark:bg-indigo-900 border-indigo-500') : (showExplanation && index === quiz.questions[currentQuestion].correctAnswer ? 'bg-green-100 dark:bg-green-900 border-green-500' : 'hover:bg-gray-100 dark:hover:bg-gray-700 border-gray-300 dark:border-gray-600') }`} >
{selectedOption === index && (
)} {showExplanation && index === quiz.questions[currentQuestion].correctAnswer && ( )}
{option}
))}
{showExplanation && (

{t('explanation')}:

{quiz.questions[currentQuestion].explanation}

)}
{!showExplanation ? ( ) : ( )}
) : (

{t('quizCompleted')}

{score}/{quiz.questions.length}

{score === quiz.questions.length ? t('perfectScore') : score >= quiz.questions.length / 2 ? t('goodJob') : t('keepPracticing')}

)}
); } // AI Assistant Component function AIAssistant({ t, darkMode, onClose }) { const [messages, setMessages] = useState([ { role: 'assistant', content: t('aiAssistantIntro') } ]); const [input, setInput] = useState(''); const [isProcessing, setIsProcessing] = useState(false); const handleSendMessage = () => { if (input.trim() === '') return; const newMessages = [ ...messages, { role: 'user', content: input } ]; setMessages(newMessages); setInput(''); setIsProcessing(true); // Simulate AI response setTimeout(() => { setMessages([ ...newMessages, { role: 'assistant', content: "I'd be happy to help with your math question! Let me explain the concept step by step..." } ]); setIsProcessing(false); }, 1500); }; return (

{t('aiAssistant')}

{messages.map((message, index) => (
{message.content}
))} {isProcessing && (
)}
setInput(e.target.value)} onKeyPress={(e) => e.key === 'Enter' && handleSendMessage()} className="flex-1 px-3 py-2 border dark:border-gray-700 rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500 dark:focus:ring-teal-500 dark:bg-gray-700" placeholder={t('typeYourQuestion')} />
); }