import React, { useState, useEffect } from "react"; import { Link, useLocation } from "react-router-dom"; import { createPageUrl } from "@/utils"; import { BookOpen, Brain, Target, BarChart3, Atom, User, Menu, X, Sparkles, Trophy } from "lucide-react"; import { User as UserEntity } from "@/entities/User"; import { Sidebar, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarHeader, SidebarFooter, SidebarProvider, SidebarTrigger, } from "@/components/ui/sidebar"; const navigationItems = [ { title: "Dashboard", url: createPageUrl("Dashboard"), icon: BarChart3, description: "Overview & Progress" }, { title: "Practice", url: createPageUrl("Practice"), icon: Brain, description: "AI-Generated Problems" }, { title: "Molecular Viewer", url: createPageUrl("MolecularViewer"), icon: Atom, description: "3D Visualizations" }, { title: "Study Materials", url: createPageUrl("StudyMaterials"), icon: BookOpen, description: "Custom Learning Resources" } ]; export default function Layout({ children, currentPageName }) { const location = useLocation(); const [user, setUser] = useState(null); const [loading, setLoading] = useState(true); useEffect(() => { loadUser(); }, []); const loadUser = async () => { try { const userData = await UserEntity.me(); setUser(userData); } catch (error) { console.log("User not logged in"); } setLoading(false); }; if (loading) { return (
Intelligent Chemistry Learning
{item.description}
Learning Level
{user.learning_level || 'Beginner'}
{user.full_name || 'Student'}
{user.email}