TTime/frontend/src/main.tsx

38 lines
901 B
TypeScript
Raw Normal View History

import React from "react";
import ReactDOM from "react-dom/client";
import "./index.css";
import { createBrowserRouter, RouterProvider } from "react-router-dom";
2024-03-17 10:33:37 +01:00
import App from "./Pages/App";
import AdminMenuPage from "./Pages/AdminPages/AdminMenuPage";
import YourProjectsPage from "./Pages/YourProjectsPage";
// This is where the routes are mounted
const router = createBrowserRouter([
{
path: "/",
2024-03-17 10:33:37 +01:00
element: <App />,
},
{
2024-03-17 10:33:37 +01:00
path: "/admin",
2024-03-14 14:33:43 +01:00
element: <AdminMenuPage />,
},
2024-03-14 14:59:57 +01:00
{
2024-03-17 10:33:37 +01:00
path: "/pm",
element: <YourProjectsPage />,
2024-03-14 14:59:57 +01:00
},
2024-03-14 14:42:26 +01:00
{
2024-03-17 10:33:37 +01:00
path: "/user",
element: <YourProjectsPage />,
2024-03-14 14:42:26 +01:00
},
]);
// Semi-hacky way to get the root element
const root = document.getElementById("root") ?? document.createElement("div");
// Render the router at the root
ReactDOM.createRoot(root).render(
<React.StrictMode>
<RouterProvider router={router} />
</React.StrictMode>,
);