135 lines
4.1 KiB
TypeScript
135 lines
4.1 KiB
TypeScript
import React from "react";
|
|
import ReactDOM from "react-dom/client";
|
|
import "./index.css";
|
|
import { createBrowserRouter, RouterProvider } from "react-router-dom";
|
|
import App from "./Pages/App";
|
|
import YourProjectsPage from "./Pages/YourProjectsPage.tsx";
|
|
import UserProjectPage from "./Pages/UserPages/UserProjectPage.tsx";
|
|
import AdminMenuPage from "./Pages/AdminPages/AdminMenuPage.tsx";
|
|
import UserEditTimeReportPage from "./Pages/UserPages/UserEditTimeReportPage.tsx";
|
|
import UserNewTimeReportPage from "./Pages/UserPages/UserNewTimeReportPage.tsx";
|
|
import UserViewTimeReportsPage from "./Pages/UserPages/UserViewTimeReportsPage.tsx";
|
|
import PMChangeRole from "./Pages/ProjectManagerPages/PMChangeRole.tsx";
|
|
import PMOtherUsersTR from "./Pages/ProjectManagerPages/PMOtherUsersTR.tsx";
|
|
import PMProjectMembers from "./Pages/ProjectManagerPages/PMProjectMembers.tsx";
|
|
import PMProjectPage from "./Pages/ProjectManagerPages/PMProjectPage.tsx";
|
|
import PMTotalTimeActivity from "./Pages/ProjectManagerPages/PMTotalTimeActivity.tsx";
|
|
import PMTotalTimeRole from "./Pages/ProjectManagerPages/PMTotalTimeRole.tsx";
|
|
import PMUnsignedReports from "./Pages/ProjectManagerPages/PMUnsignedReports.tsx";
|
|
import PMViewUnsignedReport from "./Pages/ProjectManagerPages/PMViewUnsignedReport.tsx";
|
|
import AdminManageUsers from "./Pages/AdminPages/AdminManageUsers.tsx";
|
|
import AdminManageProjects from "./Pages/AdminPages/AdminManageProjects.tsx";
|
|
import AdminAddProject from "./Pages/AdminPages/AdminAddProject.tsx";
|
|
import AdminAddUser from "./Pages/AdminPages/AdminAddUser.tsx";
|
|
import AdminProjectAddMember from "./Pages/AdminPages/AdminProjectAddMember.tsx";
|
|
import AdminProjectStatistics from "./Pages/AdminPages/AdminProjectStatistics.tsx";
|
|
import NotFoundPage from "./Pages/NotFoundPage.tsx";
|
|
import UnauthorizedPage from "./Pages/UnauthorizedPage.tsx";
|
|
import PMViewOtherUsersTR from "./Pages/ProjectManagerPages/PMViewOtherUsersTR.tsx";
|
|
|
|
// This is where the routes are mounted
|
|
const router = createBrowserRouter([
|
|
{
|
|
path: "/",
|
|
element: <App />,
|
|
errorElement: <NotFoundPage />,
|
|
},
|
|
{
|
|
path: "/admin",
|
|
element: <AdminMenuPage />,
|
|
},
|
|
{
|
|
path: "/yourProjects",
|
|
element: <YourProjectsPage />,
|
|
},
|
|
{
|
|
path: "/project/:projectName",
|
|
element: <UserProjectPage />,
|
|
},
|
|
{
|
|
path: "/newTimeReport/:projectName",
|
|
element: <UserNewTimeReportPage />,
|
|
},
|
|
{
|
|
path: "/timeReports/:projectName",
|
|
element: <UserViewTimeReportsPage />,
|
|
},
|
|
{
|
|
path: "/editTimeReport/:projectName/:fetchedWeek",
|
|
element: <UserEditTimeReportPage />,
|
|
},
|
|
{
|
|
path: "/changeRole/:projectName/:username",
|
|
element: <PMChangeRole />,
|
|
},
|
|
{
|
|
path: "/otherUsersTimeReports/:projectName/:username",
|
|
element: <PMOtherUsersTR />,
|
|
},
|
|
{
|
|
path: "/editOthersTR/:projectName/:username/:fetchedWeek",
|
|
element: <PMViewOtherUsersTR />,
|
|
},
|
|
{
|
|
path: "/projectMembers/:projectName",
|
|
element: <PMProjectMembers />,
|
|
},
|
|
{
|
|
path: "/PMProjectPage/:projectName",
|
|
element: <PMProjectPage />,
|
|
},
|
|
{
|
|
path: "/PMTimeActivity/:projectName",
|
|
element: <PMTotalTimeActivity />,
|
|
},
|
|
{
|
|
path: "/PMTimeRole/:projectName",
|
|
element: <PMTotalTimeRole />,
|
|
},
|
|
{
|
|
path: "/unsignedReports/:projectName",
|
|
element: <PMUnsignedReports />,
|
|
},
|
|
{
|
|
path: "/PMViewUnsignedReport/:projectName/:username/:fetchedWeek",
|
|
element: <PMViewUnsignedReport />,
|
|
},
|
|
{
|
|
path: "/adminProjectAddMember",
|
|
element: <AdminProjectAddMember />,
|
|
},
|
|
{
|
|
path: "/adminProjectStatistics",
|
|
element: <AdminProjectStatistics />,
|
|
},
|
|
{
|
|
path: "/addProject",
|
|
element: <AdminAddProject />,
|
|
},
|
|
{
|
|
path: "/adminAddUser",
|
|
element: <AdminAddUser />,
|
|
},
|
|
{
|
|
path: "/adminManageProject",
|
|
element: <AdminManageProjects />,
|
|
},
|
|
{
|
|
path: "/adminManageUser",
|
|
element: <AdminManageUsers />,
|
|
},
|
|
{
|
|
path: "/unauthorized",
|
|
element: <UnauthorizedPage />,
|
|
},
|
|
]);
|
|
|
|
// 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>,
|
|
);
|