import React, { useState, useEffect } from "react"; import { BrowserRouter, Routes, Route, useLocation } from "react-router-dom"; import { AnimatePresence, LayoutGroup } from "framer-motion"; import "./i18n"; import "./App.css"; import Navbar from "./Components/Nav/Navbar"; import Home from "./Components/Sections/Home/Home"; import Services from "./Components/Sections/Services/Services"; import About from "./Components/Sections/About/About"; import Departments from "./Components/Sections/Departments/Departments"; import DepartmentDetail from "./Components/Sections/DepartmentDetail/DepartmentDetail"; import Contact from "./Components/Sections/Contact/Contact"; import Footer from "./Components/Nav/Footer"; import DepartmentDetail2 from "./Components/Sections/DepartmentDetail2/DepartmentDetail2"; import ImagePreloader from "./Components/ImagePreloader"; import BackgroundCanvas from "./Components/BackgroundCanvas/BackgroundCanvas"; import DepartmentDetail3 from "./Components/Sections/DepartmentDetail3/DepartmentDetail3"; import DepartmentDetail4 from "./Components/Sections/DepartmentDetail4/DepartmentDetail4"; import DepartmentDetail5 from "./Components/Sections/DepartmentDetail5/DepartmentDetail5"; import DepartmentDetail6 from "./Components/Sections/DepartmentDetail6/DepartmentDetail6"; import DepartmentDetail7 from "./Components/Sections/DepartmentDetail7/DepartmentDetail7"; import DepartmentDetail8 from "./Components/Sections/DepartmentDetail8/DepartmentDetail8"; import DepartmentDetail9 from "./Components/Sections/DepartmentDetail9/DepartmentDetail9"; const MainPage = ({ theme }) => { return (
); }; function RouterView({ theme, toggleTheme }) { const location = useLocation(); return (
} /> } /> } /> } /> } /> } /> } /> } /> } /> } />
); } function Layout({ theme, toggleTheme }) { const location = useLocation(); const excludedExactPaths = [ "/department-detail2", "/department-detail3" , "/department-detail4" , "/department-detail5" , "/department-detail6" , "/department-detail7", "/department-detail8", "/department-detail9" ]; const excludedPrefixes = ["/departments/"]; const isExcludedExact = excludedExactPaths.includes(location.pathname); const isExcludedPrefix = excludedPrefixes.some((p) => location.pathname.startsWith(p)); const hideNavbar = isExcludedExact || isExcludedPrefix; const navbarHeight = hideNavbar ? 0 : 56; return ( <> {!hideNavbar && }
{location.pathname === "/" &&
}
); } const App = () => { const [theme, setTheme] = useState("light"); useEffect(() => { console.log("Current theme:", theme); console.log("HTML has dark class:", document.documentElement.classList.contains('dark')); const canvas = document.querySelector('.background-canvas'); if (canvas) { console.log("Canvas found:", canvas); console.log("Canvas dimensions:", canvas.width, "x", canvas.height); } else { console.log("Canvas NOT found!"); } }, [theme]); useEffect(() => { const savedTheme = localStorage.getItem("theme"); const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches; if (savedTheme === "dark" || (!savedTheme && prefersDark)) { setTheme("dark"); document.documentElement.classList.add("dark"); } else { document.documentElement.classList.remove("dark"); setTheme("light"); } }, []); const toggleTheme = () => { const newTheme = theme === "light" ? "dark" : "light"; setTheme(newTheme); if (newTheme === "dark") { document.documentElement.classList.add("dark"); } else { document.documentElement.classList.remove("dark"); } localStorage.setItem("theme", newTheme); }; return ( ); }; export default App;