Spaces:
Running
Running
File size: 767 Bytes
1dff54f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
import React from "react";
import { Routes, Route, Navigate, useLocation } from "react-router-dom";
import Layout from "./Layout";
import Dashboard from "./pages/Dashboard";
import History from "./pages/History";
function RoutedApp() {
const location = useLocation();
const path = location.pathname;
let currentPageName = "Dashboard";
if (path.startsWith("/history")) currentPageName = "History";
return (
<Layout currentPageName={currentPageName}>
<Routes>
<Route path="/" element={<Navigate to="/dashboard" replace />} />
<Route path="/dashboard" element={<Dashboard />} />
<Route path="/history" element={<History />} />
</Routes>
</Layout>
);
}
export default function App() {
return <RoutedApp />;
}
|