2024-02-13 14:47:36 +01:00
|
|
|
import React from "react";
|
|
|
|
import ReactDOM from "react-dom/client";
|
|
|
|
import "./index.css";
|
2024-03-06 10:09:59 +01:00
|
|
|
import { createBrowserRouter, RouterProvider } from "react-router-dom";
|
2024-03-17 10:33:37 +01:00
|
|
|
import App from "./Pages/App";
|
2024-03-18 15:33:19 +01:00
|
|
|
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 AdminViewUserInfo from "./Pages/AdminPages/AdminViewUserInfo.tsx";
|
|
|
|
import AdminManageProjects from "./Pages/AdminPages/AdminManageProjects.tsx";
|
|
|
|
import AdminAddProject from "./Pages/AdminPages/AdminAddProject.tsx";
|
|
|
|
import AdminAddUser from "./Pages/AdminPages/AdminAddUser.tsx";
|
|
|
|
import AdminChangeUsername from "./Pages/AdminPages/AdminChangeUsername.tsx";
|
|
|
|
import AdminProjectAddMember from "./Pages/AdminPages/AdminProjectAddMember.tsx";
|
|
|
|
import AdminProjectChangeUserRole from "./Pages/AdminPages/AdminProjectChangeUserRole.tsx";
|
|
|
|
import AdminProjectManageMembers from "./Pages/AdminPages/AdminProjectManageMembers.tsx";
|
|
|
|
import AdminProjectStatistics from "./Pages/AdminPages/AdminProjectStatistics.tsx";
|
|
|
|
import AdminProjectViewMemberInfo from "./Pages/AdminPages/AdminProjectViewMemberInfo.tsx";
|
|
|
|
import AdminProjectPage from "./Pages/AdminPages/AdminProjectPage.tsx";
|
2024-03-18 19:36:28 +01:00
|
|
|
import NotFoundPage from "./Pages/NotFoundPage.tsx";
|
2024-03-06 10:09:59 +01:00
|
|
|
|
2024-03-06 11:14:08 +01:00
|
|
|
// This is where the routes are mounted
|
2024-03-06 10:09:59 +01:00
|
|
|
const router = createBrowserRouter([
|
2024-03-18 15:39:29 +01:00
|
|
|
{
|
|
|
|
path: "/",
|
|
|
|
element: <App />,
|
2024-03-18 19:36:28 +01:00
|
|
|
errorElement: <NotFoundPage />,
|
2024-03-18 15:39:29 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/admin",
|
|
|
|
element: <AdminMenuPage />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/pm",
|
|
|
|
element: <YourProjectsPage />,
|
|
|
|
},
|
2024-03-06 11:14:08 +01:00
|
|
|
{
|
2024-03-18 15:46:23 +01:00
|
|
|
path: "/yourProjects",
|
2024-03-18 15:33:19 +01:00
|
|
|
element: <YourProjectsPage />,
|
|
|
|
},
|
|
|
|
{
|
2024-03-18 21:52:34 +01:00
|
|
|
path: "/project/:projectName",
|
|
|
|
element: <UserProjectPage />,
|
2024-03-18 15:33:19 +01:00
|
|
|
},
|
|
|
|
{
|
2024-03-18 21:52:34 +01:00
|
|
|
path: "/newTimeReport/:projectName",
|
2024-03-18 15:33:19 +01:00
|
|
|
element: <UserNewTimeReportPage />,
|
|
|
|
},
|
|
|
|
{
|
2024-03-18 21:52:34 +01:00
|
|
|
path: "/projectPage/:projectName",
|
|
|
|
element: <UserViewTimeReportsPage />,
|
2024-03-18 15:33:19 +01:00
|
|
|
},
|
|
|
|
{
|
2024-03-18 21:52:34 +01:00
|
|
|
path: "/editTimeReport",
|
|
|
|
element: <UserEditTimeReportPage />,
|
2024-03-14 14:59:57 +01:00
|
|
|
},
|
2024-03-18 00:40:42 +01:00
|
|
|
{
|
2024-03-18 15:46:23 +01:00
|
|
|
path: "/changeRole",
|
2024-03-18 15:33:19 +01:00
|
|
|
element: <PMChangeRole />,
|
|
|
|
},
|
|
|
|
{
|
2024-03-18 15:46:23 +01:00
|
|
|
path: "/otherUsersTimeReports",
|
2024-03-18 15:33:19 +01:00
|
|
|
element: <PMOtherUsersTR />,
|
|
|
|
},
|
|
|
|
{
|
2024-03-18 15:46:23 +01:00
|
|
|
path: "/projectMembers",
|
2024-03-18 15:33:19 +01:00
|
|
|
element: <PMProjectMembers />,
|
|
|
|
},
|
|
|
|
{
|
2024-03-18 15:46:23 +01:00
|
|
|
path: "/PMProjectPage",
|
2024-03-18 15:33:19 +01:00
|
|
|
element: <PMProjectPage />,
|
|
|
|
},
|
|
|
|
{
|
2024-03-18 15:46:23 +01:00
|
|
|
path: "/PMTimeActivity",
|
2024-03-18 15:33:19 +01:00
|
|
|
element: <PMTotalTimeActivity />,
|
|
|
|
},
|
|
|
|
{
|
2024-03-18 15:46:23 +01:00
|
|
|
path: "/PMTimeRole",
|
2024-03-18 15:33:19 +01:00
|
|
|
element: <PMTotalTimeRole />,
|
2024-03-18 00:40:42 +01:00
|
|
|
},
|
|
|
|
{
|
2024-03-18 15:46:23 +01:00
|
|
|
path: "/PMUnsignedReports",
|
2024-03-18 15:33:19 +01:00
|
|
|
element: <PMUnsignedReports />,
|
|
|
|
},
|
|
|
|
{
|
2024-03-18 15:46:23 +01:00
|
|
|
path: "/PMViewUnsignedReport",
|
2024-03-18 15:33:19 +01:00
|
|
|
element: <PMViewUnsignedReport />,
|
|
|
|
},
|
|
|
|
{
|
2024-03-18 15:46:23 +01:00
|
|
|
path: "/adminChangeUsername",
|
2024-03-18 15:33:19 +01:00
|
|
|
element: <AdminChangeUsername />,
|
2024-03-18 01:56:04 +01:00
|
|
|
},
|
2024-03-18 00:40:42 +01:00
|
|
|
{
|
2024-03-18 15:46:23 +01:00
|
|
|
path: "/adminProjectAddMember",
|
2024-03-18 15:33:19 +01:00
|
|
|
element: <AdminProjectAddMember />,
|
|
|
|
},
|
|
|
|
{
|
2024-03-18 15:46:23 +01:00
|
|
|
path: "/adminProjectChangeUserRole",
|
2024-03-18 15:33:19 +01:00
|
|
|
element: <AdminProjectChangeUserRole />,
|
|
|
|
},
|
|
|
|
{
|
2024-03-18 15:46:23 +01:00
|
|
|
path: "/adminProjectManageMembers",
|
2024-03-18 15:33:19 +01:00
|
|
|
element: <AdminProjectManageMembers />,
|
|
|
|
},
|
|
|
|
{
|
2024-03-18 15:46:23 +01:00
|
|
|
path: "/adminProjectPage",
|
2024-03-18 15:33:19 +01:00
|
|
|
element: <AdminProjectPage />,
|
|
|
|
},
|
|
|
|
{
|
2024-03-18 15:46:23 +01:00
|
|
|
path: "/adminProjectStatistics",
|
2024-03-18 15:33:19 +01:00
|
|
|
element: <AdminProjectStatistics />,
|
|
|
|
},
|
|
|
|
{
|
2024-03-18 15:46:23 +01:00
|
|
|
path: "/adminProjectViewMembers",
|
2024-03-18 15:33:19 +01:00
|
|
|
element: <AdminProjectViewMemberInfo />,
|
|
|
|
},
|
|
|
|
{
|
2024-03-18 15:46:23 +01:00
|
|
|
path: "/addProject",
|
|
|
|
element: <AdminAddProject />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/adminAddUser",
|
|
|
|
element: <AdminAddUser />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/adminUserInfo",
|
2024-03-18 15:33:19 +01:00
|
|
|
element: <AdminViewUserInfo />,
|
|
|
|
},
|
2024-03-18 15:46:23 +01:00
|
|
|
{
|
|
|
|
path: "/adminManageProject",
|
|
|
|
element: <AdminManageProjects />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/adminManageUser",
|
|
|
|
element: <AdminManageUsers />,
|
|
|
|
},
|
2024-03-06 10:09:59 +01:00
|
|
|
]);
|
2024-02-12 12:47:46 +01:00
|
|
|
|
2024-03-06 11:14:08 +01:00
|
|
|
// Semi-hacky way to get the root element
|
2024-02-13 14:47:36 +01:00
|
|
|
const root = document.getElementById("root") ?? document.createElement("div");
|
|
|
|
|
2024-03-06 11:14:08 +01:00
|
|
|
// Render the router at the root
|
2024-02-13 14:47:36 +01:00
|
|
|
ReactDOM.createRoot(root).render(
|
2024-02-12 12:47:46 +01:00
|
|
|
<React.StrictMode>
|
2024-03-06 10:09:59 +01:00
|
|
|
<RouterProvider router={router} />
|
2024-02-12 12:47:46 +01:00
|
|
|
</React.StrictMode>,
|
2024-02-13 14:47:36 +01:00
|
|
|
);
|