/** * @fileoverview React component for App.jsx * * @module App */ import { lazy, Suspense, useEffect } from "react"; import { HashRouter as Router, Routes, Route, useLocation } from "react-router-dom"; import "./App.css"; import HomePage from "./pages/HomePage/HomePage"; import LabPython from "./pages/LabPython/LabPython"; import ScrollToTop from "./components/ScrollToTop"; import { trackPageView } from "./services/plausible"; const Playground = lazy(() => import("./pages/Playground/Playground")); const About = lazy(() => import("./pages/About/About")); const Faq = lazy(() => import("./pages/Faq/Faq")); const Atividades = lazy(() => import("./pages/Atividades/Atividades")); const Educadores = lazy(() => import("./pages/Educadores/Educadores")); const Iniciativas = lazy(() => import("./pages/Iniciativas/Iniciativas")); const IniciativaDetalhe = lazy(() => import("./pages/Iniciativas/IniciativaDetalhe")); const PrimeirosPassos = lazy(() => import("./pages/PrimeirosPassos/PrimeirosPassos")); const CategoriaLetramentoView = lazy(() => import("./pages/PrimeirosPassos/CategoriaLetramentoView")); //Atividades const AspiradorGame = lazy(() => import("./atividades/programacao/aspirador/AspiradorGame")); const AutomatoGame = lazy(() => import("./atividades/programacao/automato/AutomatoGame")); const SemaforoGame = lazy(() => import("./atividades/programacao/semaforo/SemaforoGame")); const MoleMashGame = lazy(() => import("./atividades/programacao/mole-mash/MoleMash")); const OrdenacaoGame = lazy(() => import("./atividades/programacao/ordenacao/OrdenacaoGame")); const PuzzleGame = lazy(() => import("./atividades/programacao/puzzle/PuzzleGame")); const TurtleGame = lazy(() => import("./atividades/programacao/turtle/TurtleGame")); const CriptoGame = lazy(() => import("./atividades/programacao/cripto/CriptoGame")); const LoadingFallback = () => (
Carregando...
); // Separated so we can call useLocation (requires being inside Router) function AppRoutes() { const location = useLocation(); // When navigating to a letramento category, the caller passes // { state: { backgroundLocation: location } } so the previous page // keeps rendering behind the modal overlay. const backgroundLocation = location.state?.backgroundLocation; useEffect(() => { trackPageView(location.pathname); }, [location.pathname]); return ( <> {/* Main routes — rendered at the background location when a modal is open */} } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> {/* Fallback: direct URL access without backgroundLocation */} } /> } /> } /> } /> } /> } /> } /> } /> } /> {/* Modal overlay routes — rendered on top of the background page */} {backgroundLocation && ( } /> )} ); } export default function App() { return ( }> ); } // Note: many imports are used only via lazy() or in route elements. // If ESLint still reports unused vars here, we prefer keeping changes minimal // and addressing remaining warnings in targeted files.