All files / src/app/student-page StudentPageRoutes.jsx

52.17% Statements 12/23
100% Branches 0/0
0% Functions 0/11
75% Lines 12/16

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96                    1x   1x 1x 1x   1x     1x     1x     1x     1x 1x 1x   1x                                                                                                                              
import { lazy } from "react";
import ProtectedRoute from "@/router/ProtectedRoute.jsx";
import StudentMainPage from "@/app/student-page/StudentMainPage.jsx";
// error page (tiny, keep eager — used as the catch-all fallback)
import PageError from "@/utils/components/page-error/PageError";
 
// All feature pages below are lazy-loaded (code-split per route) so that
// visiting one student page doesn't pull in every other student feature.
// StudentMainPage wraps <Outlet /> in a <Suspense> boundary, so these can
// suspend without any extra wiring here.
const StudentDashboardPage = lazy(() => import("@/app/student-page/page/dashboard/Dashboard.jsx"));
// student classes
const StudentClassesMainPage = lazy(() => import("@/app/student-page/page/classes/ClassesLayout.jsx"));
const StudentClassesPage = lazy(() => import("@/app/student-page/page/class-list/ClassListPage.jsx"));
const StudentViewClassMainPage = lazy(() => import("@/app/student-page/page/view-class/ViewClassPage.jsx"));
// student assignments
const StudentViewAssignmentMainPage = lazy(
    () => import("@/app/student-page/page/assignments/ViewAssignmentLayout.jsx")
);
const StudentViewAssignment = lazy(
    () => import("@/app/student-page/page/assignments/view-assignment/ViewAssignment.jsx")
);
const StudentViewAssignmentSubmission = lazy(
    () => import("@/app/student-page/page/assignments/submission-details/SubmissionDetails")
);
const StudentAnswerAssignment = lazy(
    () => import("@/app/student-page/page/assignments/take-assignment/TakeAssignmentPage")
);
const StudentResourcesPage = lazy(() => import("@/app/student-page/page/resources/Resources.jsx"));
const StudentSettingsPage = lazy(() => import("@/app/student-page/page/settings/Settings.jsx"));
const StudentSearchClassPage = lazy(() => import("@/app/student-page/page/class-list/SearchClassPage.jsx"));
 
export const StudentPageRoutes = {
    path: "student",
    element: <ProtectedRoute allowedRole="student" />,
    children: [
        {
            element: <StudentMainPage />,
            children: [
                {
                    path: "",
                    element: <StudentDashboardPage />,
                },
                {
                    path: "classes",
                    element: <StudentClassesMainPage />,
                    children: [
                        {
                            path: "",
                            element: <StudentClassesPage />,
                        },
                        {
                            path: "search/:classCode",
                            element: <StudentSearchClassPage />,
                        },
                        {
                            path: ":classCode",
                            element: <StudentViewClassMainPage />,
                        },
                        {
                            path: ":classCode/assignment/:assignmentTitle",
                            element: <StudentViewAssignmentMainPage />,
                            children: [
                                {
                                    path: "",
                                    element: <StudentViewAssignment />,
                                },
                                {
                                    path: "submission",
                                    element: <StudentViewAssignmentSubmission />,
                                },
                                {
                                    path: "answer",
                                    element: <StudentAnswerAssignment />,
                                },
                            ],
                        },
                    ],
                },
                {
                    path: "resources",
                    element: <StudentResourcesPage />,
                },
                {
                    path: "settings",
                    element: <StudentSettingsPage />,
                },
                {
                    path: "*",
                    element: <PageError />,
                },
            ],
        },
    ],
};