-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
101 lines (92 loc) · 4.11 KB
/
App.js
File metadata and controls
101 lines (92 loc) · 4.11 KB
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
import "./App.css";
import {Route,Routes} from "react-router-dom";
import Home from "../src/pages/Home"
import Navbar from "./components/common/Navbar";
import Login from "../src/pages/Login";
import Signup from "../src/pages/Signup";
import ForgotPassword from "./pages/ForgotPassword";
import UpdatePassword from "./pages/UpdatePassword";
import VerifyEmail from "./pages/VerifyEmail"
import About from "./pages/About";
import ContactUs from "./pages/Contact";
import MyProfile from "./components/core/Dashboard/MyProfile";
import PrivateRoute from "./components/core/Auth/PrivateRoute";
import Dashboard from "./pages/Dashboard";
import Error from "./pages/Error"
import OpenRoute from "./components/core/Auth/OpenRoute";
import Settings from "./components/core/Dashboard/Settings/index";
import EnrolledCourses from "./components/core/Dashboard/EnrolledCourses";
import Cart from "./components/core/Dashboard/Cart/index";
import {ACCOUNT_TYPE} from "./utils/constants";
import { useSelector } from "react-redux";
import MyCourses from "./components/core/Dashboard/MyCourses";
import AddCourse from "./components/core/Dashboard/AddCourse";
import EditCourse from "./components/core/Dashboard/EditCourse/index";
import Catalog from "./pages/Catalog"
import CourseDetails from "./pages/CourseDetails";
import VideoDetails from "./components/core/ViewCourse/VideoDetails";
import ViewCourse from "./pages/ViewCourse";
import Instructor from "./components/core/Dashboard/InstructorDashboard/Instructor";
function App() {
const {user}=useSelector((state)=>state.profile);
return (
<div className="w-screen min-h-screen bg-richblack-900 flex flex-col font-inter">
<Navbar/>
<Routes>
<Route path="/" element={<OpenRoute><Home/></OpenRoute>}/>
<Route path="/catalog/:catalogName" element={<Catalog/>}/>
<Route path="/courses/:courseId" element={<CourseDetails/>}/>
<Route path="/login" element={<OpenRoute><Login/></OpenRoute>}/>
<Route path="/signup" element={<OpenRoute><Signup/></OpenRoute>}/>
<Route path="/verify-email" element={<OpenRoute><VerifyEmail/></OpenRoute>}/>
<Route path="/forgot-password" element={<OpenRoute><ForgotPassword/></OpenRoute>}/>
<Route path="/update-password/:id" element={<OpenRoute><UpdatePassword/></OpenRoute>}/>
<Route path="/about" element={<OpenRoute><About/></OpenRoute>}/>
<Route path="/contact" element={<OpenRoute><ContactUs/></OpenRoute>}/>
<Route element={
<PrivateRoute>
<Dashboard/>
</PrivateRoute>
}>
<Route path="/dashboard/my-profile" element={<MyProfile/>}/>
<Route path="/dashboard/settings" element={<Settings/>}/>
{
user?.accountType===ACCOUNT_TYPE.STUDENT && (
<>
<Route path="/dashboard/enrolled-courses" element={<EnrolledCourses/>}/>
<Route path="/dashboard/cart" element={<Cart/>}/>
</>
)
}
{
user?.accountType===ACCOUNT_TYPE.INSTRUCTOR && (
<>
<Route path="/dashboard/my-courses" element={<MyCourses/>}/>
<Route path="/dashboard/add-course" element={<AddCourse/>}/>
<Route path="/dashboard/edit-course/:courseId" element={<EditCourse/>}/>
<Route path="/dashboard/instructor" element={<Instructor/>}/>
</>
)
}
</Route>
<Route element={
<PrivateRoute>
<ViewCourse/>
</PrivateRoute>
}>
{
user?.accountType===ACCOUNT_TYPE.STUDENT && (
<>
<Route path="view-course/:courseId/section/:sectionId/sub-section/:subSectionId"
element={<VideoDetails/>}
/>
</>
)
}
</Route>
<Route path="*" element={<Error/>}/>
</Routes>
</div>
);
}
export default App;