Newer
Older
import "./App.css";
import "bootstrap/dist/css/bootstrap.min.css";
import 'bootstrap/dist/js/bootstrap.bundle.min.js'; // 引入 Bootstrap JavaScript
import { Route, Routes } from "react-router-dom";
import { Footer, Header, Navbar, NotFound } from "../../components";
import { getPathMapping, stringToSlug } from "../../utils";
const App = () => {
const pathMapping = getPathMapping();
const currentPath =
location.pathname
.split(`${stringToSlug(import.meta.env.VITE_TEAM_NAME)}`)
.pop() || "/";
// Set Page Title
const title =
currentPath in pathMapping ? pathMapping[currentPath].title : "Not Found";
useEffect(() => {
document.title = `${title || ""} | ${import.meta.env.VITE_TEAM_NAME} - iGEM ${import.meta.env.VITE_TEAM_YEAR}`;
}, [title]);
{/* Header and PageContent */}
<Routes>
{Object.entries(pathMapping).map(
{/* <Header title={title || ""} lead={lead || ""} /> */}
<div className="container-fluid">
<Component />
</div>
</>
}
/>
),
)}
<Route
path="*"
element={
<>
<Header
title="Not Found"
lead="The requested URL was not found on this server."
{/* Footer */}
{/* MUST mention license AND have a link to team wiki's repository on gitlab.igem.org */}
<Footer />
</>