-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroutes.tsx
125 lines (114 loc) · 2.61 KB
/
routes.tsx
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
import AuthGuard from "components/authentication/AuthGuard";
import GuestGuard from "components/authentication/GuestGuard";
import DashboardLayout from "components/Layouts/DashboardLayout";
import LoadingScreen from "components/LoadingScreen";
import { FC, lazy, LazyExoticComponent, Suspense } from "react";
import { Navigate } from "react-router-dom";
const Loadable = (Component: LazyExoticComponent<FC>) => (props: any) =>
(
<Suspense fallback={<LoadingScreen />}>
<Component {...props} />
</Suspense>
);
// authentication pages
const Login = Loadable(lazy(() => import("./pages/authentication/Login")));
const Register = Loadable(
lazy(() => import("./pages/authentication/Register"))
);
const ForgetPassword = Loadable(
lazy(() => import("./pages/authentication/ForgetPassword"))
);
// Dashboard pages
const DashboardSaaS = Loadable(lazy(() => import("./pages/dashboards/SaaS")));
// user profile
const UserProfile = Loadable(lazy(() => import("./pages/UserProfile")));
// user management
const UserList = Loadable(
lazy(() => import("./pages/userManagement/UserList"))
);
const UserGrid = Loadable(
lazy(() => import("./pages/userManagement/UserGrid"))
);
const AddNewUser = Loadable(
lazy(() => import("./pages/userManagement/AddNewUser"))
);
// error
const Error = Loadable(lazy(() => import("./pages/404")));
//quiz
const QuizComp = Loadable(lazy(() => import("./QuizComponent/QuizComp")));
//Theory
const TheoryComp = Loadable(lazy(() => import("./TheoryComponent/TheoryComp")));
// routes
const routes = [
{
path: "/",
element: <Navigate to="dashboard" />,
},
{
path: "login",
element: (
<GuestGuard>
<Login />
</GuestGuard>
),
},
{
path: "register",
element: (
<GuestGuard>
<Register />
</GuestGuard>
),
},
{
path: "forget-password",
element: (
<GuestGuard>
<ForgetPassword />
</GuestGuard>
),
},
{
path: "dashboard",
element: (
<AuthGuard>
<DashboardLayout />
</AuthGuard>
),
children: [
{
path: "",
element: <DashboardSaaS />,
},
{
path: "user-profile",
element: <UserProfile />,
},
{
path: "user-list",
element: <UserList />,
},
{
path: "user-grid",
element: <UserGrid />,
},
{
path: "add-user",
element: <AddNewUser />,
},
],
},
{
path: "*",
element: <Error />,
},
{
path: "quiz",
element: <QuizComp />,
},
{
path: "theory",
element: <TheoryComp />,
},
];
export default routes;