Skip to content
Snippets Groups Projects
Commit 97452270 authored by Liliana Sanfilippo's avatar Liliana Sanfilippo
Browse files

deleted RouteManager

parent 3214070c
No related branches found
No related tags found
No related merge requests found
Pipeline #403576 passed
import React, { useState, useEffect } from "react";
import { Routes, Route, useLocation } from "react-router-dom";
import LoadingScreen from "../components/LoadingScreen";
import { getPathMapping } from "../utils/getPathMapping";
import { stringToSlug } from "../utils/stringToSlug";
import { NotFound } from "../components/NotFound";
import { Villbuttonrow } from "../components/Buttons";
const RouteManager = () => {
const location = useLocation();
const [isLoading, setIsLoading] = useState(true); // Start with true to show the loading screen initially
const pathMapping = getPathMapping();
useEffect(() => {
// Start loading when the route changes
setIsLoading(true);
const timer = setTimeout(() => {
// Simulate content loading delay or wait for content to load here
setIsLoading(false);
}, 3000); // Adjust or replace with actual content loading logic
return () => clearTimeout(timer);
}, [location.pathname]);
return (
<>
{isLoading && <LoadingScreen />}
<Routes>
{Object.entries(pathMapping).map(([path, { header: Header, component: Component, navlist: Sidebar }]) => (
<Route
key={path}
path={path}
element={
<>
<Header />
<div className="container-fluid" onLoad={() => setIsLoading(false)}>
<div className="row">
<Sidebar />
<div className="col">
<Component />
<Villbuttonrow />
</div>
</div>
</div>
</>
}
/>
))}
<Route path="*" element={<NotFound />} />
</Routes>
</>
);
};
export default RouteManager;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment