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 Register from "./Components/Register.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-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([
|
|
|
|
{
|
|
|
|
path: "/",
|
2024-03-17 10:33:37 +01:00
|
|
|
element: <App />,
|
2024-03-06 11:14:08 +01:00
|
|
|
},
|
2024-03-18 15:39:29 +01:00
|
|
|
{
|
|
|
|
path: "/",
|
|
|
|
element: <App />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/admin",
|
|
|
|
element: <AdminMenuPage />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/pm",
|
|
|
|
element: <YourProjectsPage />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/user",
|
|
|
|
element: <YourProjectsPage />,
|
|
|
|
},
|
2024-03-06 11:14:08 +01:00
|
|
|
{
|
2024-03-18 15:33:19 +01:00
|
|
|
path: "/your-projects",
|
|
|
|
element: <YourProjectsPage />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/edit-time-report",
|
|
|
|
element: <UserEditTimeReportPage />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/new-time-report",
|
|
|
|
element: <UserNewTimeReportPage />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/project",
|
|
|
|
element: <UserProjectPage />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/register",
|
|
|
|
element: <Register />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/admin-menu",
|
2024-03-14 14:33:43 +01:00
|
|
|
element: <AdminMenuPage />,
|
|
|
|
},
|
2024-03-14 14:59:57 +01:00
|
|
|
{
|
2024-03-18 15:33:19 +01:00
|
|
|
path: "/project-page",
|
|
|
|
element: <UserViewTimeReportsPage />,
|
2024-03-14 14:59:57 +01:00
|
|
|
},
|
2024-03-18 00:40:42 +01:00
|
|
|
{
|
2024-03-18 15:33:19 +01:00
|
|
|
path: "/change-role",
|
|
|
|
element: <PMChangeRole />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/other-users-time-reports",
|
|
|
|
element: <PMOtherUsersTR />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/project-members",
|
|
|
|
element: <PMProjectMembers />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/PM-project-page",
|
|
|
|
element: <PMProjectPage />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/PM-time-activity",
|
|
|
|
element: <PMTotalTimeActivity />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/PM-time-role",
|
|
|
|
element: <PMTotalTimeRole />,
|
2024-03-18 00:40:42 +01:00
|
|
|
},
|
|
|
|
{
|
2024-03-18 15:33:19 +01:00
|
|
|
path: "/PM-unsigned-reports",
|
|
|
|
element: <PMUnsignedReports />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/PM-view-unsigned-report",
|
|
|
|
element: <PMViewUnsignedReport />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/admin-add-project",
|
2024-03-18 00:40:42 +01:00
|
|
|
element: <AdminAddProject />,
|
|
|
|
},
|
|
|
|
{
|
2024-03-18 15:33:19 +01:00
|
|
|
path: "/admin-add-user",
|
2024-03-18 00:40:42 +01:00
|
|
|
element: <AdminAddUser />,
|
|
|
|
},
|
2024-03-18 01:56:04 +01:00
|
|
|
{
|
2024-03-18 15:33:19 +01:00
|
|
|
path: "/admin-change-username",
|
|
|
|
element: <AdminChangeUsername />,
|
2024-03-18 01:56:04 +01:00
|
|
|
},
|
2024-03-18 00:40:42 +01:00
|
|
|
{
|
2024-03-18 15:33:19 +01:00
|
|
|
path: "/admin-manage-projects",
|
2024-03-18 00:40:42 +01:00
|
|
|
element: <AdminManageProjects />,
|
|
|
|
},
|
|
|
|
{
|
2024-03-18 15:33:19 +01:00
|
|
|
path: "/admin-manage-users",
|
2024-03-18 00:40:42 +01:00
|
|
|
element: <AdminManageUsers />,
|
|
|
|
},
|
2024-03-18 15:33:19 +01:00
|
|
|
{
|
|
|
|
path: "/admin-menu",
|
|
|
|
element: <AdminMenuPage />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/admin-project-add-member",
|
|
|
|
element: <AdminProjectAddMember />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/admin-project-change-user-role",
|
|
|
|
element: <AdminProjectChangeUserRole />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/admin-project-manage-members",
|
|
|
|
element: <AdminProjectManageMembers />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/admin-project-page",
|
|
|
|
element: <AdminProjectPage />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/admin-project-statistics",
|
|
|
|
element: <AdminProjectStatistics />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/admin-project-view-members",
|
|
|
|
element: <AdminProjectViewMemberInfo />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/admin-view-user",
|
|
|
|
element: <AdminViewUserInfo />,
|
|
|
|
},
|
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
|
|
|
);
|