import { Suspense, lazy, useState, useEffect } from "react"; import { BrowserRouter as Router, Routes, Route, useLocation, } from "react-router-dom"; import BackgroundWrapper from "./components/backgrounds/BackgroundWrapper"; import LoadingScreen from "./components/LoadingScreen"; import ScrollToTop from "./components/ScrollToTop"; import CardNav from "./components/CardNav"; import NotFound from "./components/NotFound"; import useRegionScroll from "./hooks/useRegionScroll"; const Home = lazy(() => import("./pages/Home")); const Contact = lazy(() => import("./pages/Contact")); const Projects = lazy(() => import("./pages/Projects")); const Zatyshok = lazy(() => import("./pages/projects/Zatyshok")); const EnsembleScolaireJeanXXIII = lazy( () => import("./pages/projects/EnsembleScolaireJeanXXIII"), ); const NeoTokyoRush = lazy(() => import("./pages/projects/NeoTokyoRush")); const Hinterraum = lazy(() => import("./pages/projects/Hinterraum")); const OverclockUprising = lazy( () => import("./pages/projects/OverclockUprising"), ); const EchoesOfTheLastStop = lazy( () => import("./pages/projects/EchoesOfTheLastStop"), ); const ShadowPurgeRiteOfTheDemon = lazy( () => import("./pages/projects/ShadowPurgeRiteOfTheDemon"), ); const LesVoixDeLExil = lazy(() => import("./pages/projects/LesVoixDeLExil")); const WYGTIWIF = lazy(() => import("./pages/projects/WYG-TIWIF")); function AppContent() { const location = useLocation(); const [isPageLoading, setIsPageLoading] = useState(false); const immersivePages = ["/projects/les-voix-de-l-exil"]; const isImmersive = immersivePages.includes(location.pathname); useEffect(() => { document.documentElement.classList.toggle("no-snap", isImmersive); }, [isImmersive]); useRegionScroll(); useEffect(() => { const handleGlobalClick = (e: MouseEvent) => { const el = e.target as HTMLElement; const target = el.closest("a, button") as HTMLElement | null; if (!target) return; if (target.hasAttribute("download")) return; if (target.tagName === "BUTTON") { // vérifie si c'est le bouton download if (target.textContent?.includes("Download")) return; } const anchor = target.tagName === "A" ? (target as HTMLAnchorElement) : null; if (anchor) { if (!anchor.href) return; if (anchor.href.match(/\.(zip|exe|rar|7z|msi|dmg|apk|pdf)(\?|$)/i)) return; if (anchor.target === "_blank") return; if (anchor.origin !== window.location.origin) return; if (e.ctrlKey || e.metaKey) return; if (anchor.href.startsWith("mailto:") || anchor.href.startsWith("tel:")) return; const currentPath = window.location.pathname; const targetPath = new URL(anchor.href).pathname; if (currentPath !== targetPath) { setIsPageLoading(true); } } }; document.addEventListener("click", handleGlobalClick); return () => document.removeEventListener("click", handleGlobalClick); }, []); useEffect(() => { setIsPageLoading(true); const timer = setTimeout(() => { setIsPageLoading(false); }, 600); return () => clearTimeout(timer); }, [location.pathname]); return ( <> {isPageLoading && } {!isImmersive && }
}> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } />
{!isImmersive && (

© 2026 -{" "} Co Hai Se {" "} | All rights reserved.

)} ); } function App() { return ( ); } export default App;