Skip to content

Commit

Permalink
Fix issues for Merge #17 #23 #24 (#28)
Browse files Browse the repository at this point in the history
Co-authored-by: Karnati Kalyan <[email protected]>
  • Loading branch information
kalyan-karnati and Karnati Kalyan authored Jan 24, 2024
1 parent a2effd1 commit c4fca1a
Showing 1 changed file with 10 additions and 20 deletions.
30 changes: 10 additions & 20 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { createBrowserRouter, Navigate, RouterProvider } from "react-router-dom";
import {createBrowserRouter,Navigate,RouterProvider} from "react-router-dom";
import AdministratorLayout from "./layout/Administrator";
import ManageUserTypes, { loader as loadUsers } from "./pages/Administrator/ManageUserTypes";
import Login from "./pages/Authentication/Login";
Expand All @@ -9,13 +9,12 @@ import Institutions, { loadInstitutions } from "./pages/Institutions/Institution
import RoleEditor, { loadAvailableRole } from "./pages/Roles/RoleEditor";
import Roles, { loadRoles } from "./pages/Roles/Roles";
import Assignment from './pages/Assignments/Assignment'
import AssignmentEditor from "pages/Assignments/AssignmentEditor";
import AssignmentEditor from "./pages/Assignments/AssignmentEditor";
import { loadAssignment } from "pages/Assignments/AssignmentUtil";
import ErrorPage from "./router/ErrorPage";
import NotFound from "./router/NotFound";
import ProtectedRoute from "./router/ProtectedRoute";
import { ROLE } from "./utils/interfaces";
import AdministratorLayout from "./layout/Administrator";
import NotFound from "./router/NotFound";
import Participants from "pages/Participants/Participant";
import ParticipantEditor from "pages/Participants/ParticipantEditor";
import { loadParticipantDataRolesAndInstitutions } from "pages/Participants/participantUtil";
Expand All @@ -32,7 +31,6 @@ import TA from "pages/TA/TA";
import TAEditor from "pages/TA/TAEditor";
import { loadTAs } from "pages/TA/TAUtil";


function App() {
const router = createBrowserRouter([
{
Expand All @@ -43,10 +41,10 @@ function App() {
{ index: true, element: <ProtectedRoute element={<Home />} /> },
{ path: "login", element: <Login /> },
{ path: "logout", element: <ProtectedRoute element={<Logout />} /> },
{path: "edit-questionnaire", element: <ProtectedRoute element={<Questionnaire />} /> },
{ path: "edit-questionnaire", element: <ProtectedRoute element={<Questionnaire />} /> },
{
path: "assignments",
element: <ProtectedRoute element={<Assignment />} leastPrivilegeRole={ROLE.TA} />, // Adjust as needed
element: <ProtectedRoute element={<Assignment />} leastPrivilegeRole={ROLE.TA} />,
children: [
{
path: "new",
Expand Down Expand Up @@ -78,7 +76,6 @@ function App() {
},
{
path: "student_tasks/participants",
// TODO: The id here should be dynamic and should be received from the parent component
element: <Participants type="student_tasks" id={1} />,
children: [
{
Expand All @@ -95,7 +92,6 @@ function App() {
},
{
path: "courses/participants",
// TODO: The id here should be dynamic and should be received from the parent component
element: <Participants type="courses" id={1} />,
children: [
{
Expand All @@ -108,41 +104,35 @@ function App() {
element: <ParticipantEditor mode="update" type="courses" />,
loader: loadParticipantDataRolesAndInstitutions,
},
// Routing for courses, so the URL will be https://<domain>.com/courses
// This route is protected and only TAs can view it.
],
},
// Fixed the missing comma and added an opening curly brace
{
path: "courses",
element: <ProtectedRoute element={<Courses />} leastPrivilegeRole={ROLE.TA} />,
children: [
// Child route for courses https://<domain>.com/courses/new
// The loader runs the function it has been provided with when the component is loaded on the DOM
{
path: "new",
element: <CourseEditor mode="create" />,
loader: loadCourseInstructorDataAndInstitutions,
},
// Child route for courses https://<domain>.com/courses/edit/:id
{
path: "edit/:id",
element: <CourseEditor mode="update" />,
loader: loadCourseInstructorDataAndInstitutions,
},
// Child route for courses https://<domain>.com/courses/:courseId/tas
{
path: ":courseId/tas",
element: <ProtectedRoute element={<TA />} leastPrivilegeRole={ROLE.TA} />,
children: [
// Child route for TA component https://<domain>.com/courses/:courseId/tas/new
{
path: "new",
element: <TAEditor mode="create" />,
loader: loadTAs,
},
]
},
// ToDo: Integrate Course Participants here. More information for it can be found: https://github.com/expertiza/reimplementation-front-end/pull/17
// This can be done in the same way as how it is done for TAs
// Where we reroute the user to appropriate page by selecting a specific course id and then display all the participants.
],
], // Added the missing closing curly brace
},
{
path: "administrator",
Expand Down

0 comments on commit c4fca1a

Please sign in to comment.