Overview
This tutorial guides you through building a full-stack Learning Management System (LMS) using MongoDB, Express, React, and Node.js (MERN stack). The platform enables educators to upload course content and students to browse, purchase, and watch courses online.
Key Features
- User Authentication: Implemented using Clerk, providing seamless sign-in, sign-up, and user profile management with ready-to-use React UI components.
- Course Management: Educators can create courses, add chapters and lectures with video URLs, and set pricing and discounts.
- Course Browsing & Search: Students can view course lists, filtering by keywords with a responsive search interface.
- Course Enrollment & Payment: Integration with Stripe for secure online payments, including a test mode for easy development.
- Course Player: Students watch course videos with features like free previews, marking lectures as complete, and progress tracking.
- Dashboard: Separate dashboards for educators (course stats, earnings, student enrollments) and students (enrolled courses, progress).
- Rating System: Users rate courses with interactive star ratings that update dynamically.
Technical Highlights
Frontend
- Uses React with routing handled by React Router.
- Styling with Tailwind CSS and Google Fonts for a modern UI.
- Rich text editor for course descriptions implemented with Quill.js.
- State management and context API maintain app-wide state and helper functions.
- Authentication state and user data are synced with Clerk.
Backend
- Express server with RESTful API endpoints for courses, users, enrollments, and educator functions.
- MongoDB schemas/models for users, courses (including nested chapters and lectures), purchases, and progress.
- File uploads (course thumbnails) handled with multer, stored on Cloudinary.
- User role management enables users to become educators with specific API routes protected by middleware.
- Stripe payment integration creates checkout sessions; webhooks validate payment success and update purchase status.
Deployment
- Backend and frontend deployed separately on Vercel with environment variables securely managed.
- GitHub used for version control and continuous deployment integration.
Getting Started
- Initialize Frontend: Create React app, install dependencies (React Router, Quill, Star Rating, Tailwind, Axios, React Toastify). See Maîtrisez React : JSX, ReactDOM et création de composants for foundational React concepts.
- Setup Backend: Create Express app with necessary packages (Mongoose, Cloudinary, Stripe, Clerk middleware).
- Implement Authentication: Integrate Clerk for user signin/signout and restrict routes.
- Create Models: Define MongoDB schemas for users, courses, lectures, purchases, and progress.
- Build APIs: Develop controller functions and routes for course management, user data, enrollment, progress, and payments.
- Handle Payments: Configure Stripe API keys, implement checkout sessions, and webhook handlers. For deeper insights, refer to Build and Deploy a Responsive GPT-3 Landing Page with React.js which covers payment integrations.
- Connect Frontend with Backend: Use Axios calls in context API to fetch and update data.
- Deploy: Push code to GitHub, connect repositories with Vercel for frontend and backend deployment. Get deployment best practices from Build a Modern Frontend Developer Portfolio Using Next.js, Tailwind CSS, and Sentry.
User Flow
- Students browse courses, use the search box, and view detailed course pages.
- Users register/sign in via Clerk; profile pictures and user states update dynamically.
- Upon purchasing courses, payment sessions are handled via Stripe, with webhooks confirming payment and updating database.
- Students watch courses, mark lessons complete, and submit course ratings.
- Educators manage courses via dashboards, publishing new courses, viewing enrollments, and earnings.
Conclusion
This tutorial delivers a practical, complete LMS solution leveraging popular modern technologies, focusing on user authentication, secure payments, course management, and smooth user experience. The project is finely tuned with responsive design and robust backend architecture.
Additional Resources
- React Beginner Tutorials (recommended before starting)
- Clerk Documentation for Authentication
- Stripe API & Webhooks Guide
- Tailwind CSS Setup Guide
- MongoDB Atlas for Database Hosting
Feel free to explore, customize, and extend the LMS project for your needs.
hello and welcome to another exciting tutorial of great stack in this tutorial we are going to learn how to create a
full stack learning management system using mongodb Express react and nodejs this is a LMS website where Educators
can upload the courses and students can enroll and watch the courses online in this project we will create the user
login and registration feature using Clerk clerk is a user authentication and user management platform it also
provides beautiful and ready to use UI components like sign in sign up and profile component for react application
we will also add the stripe payment gway in this LMS project so that students can buy the courses online so let's start by
taking a quick look at the project demo that we will be building in this tutorial so this is the homepage of our
lmsb we site where you can see the navigation bar then title and search box then we have the trusted companies logo
then we have some course card after that we have the testimonials and one call to action section then we have this
footer now if I open this course so here you can see this is the course description page where you can see the
course title description and average rating number of our students enrolled in this course then we have the
instructor name and then we have the course structure and we can display the course chapter and lectures title then
we have the free preview option also after that you can see here we have the detailed description of this course and
in the right side we have this card where you can see the course image then we have the offer price actual price and
discount then we have some other data of this course and enroll Now button now if I come back and click on this one
if I click on this button so it will open this course list page where you can see all the courses available on this
LMS website and here we can search for any course by adding any keyword so let me add the keyword JavaScript and click
on this search button now you can see the course related to this search term and here we have the option to remove
this search filter we will click on this cross icon so again we can see all courses now to enroll into any course we
have to create an account on this one so here we have the create account button if I click here it will open a signin
component that is built using Clerk and if you are new on this website you can use this link sign up to create an
account and I already have the account so I'll click on this sign in and sign in using my Google account after sign in
you will find your profile picture here and after that you will see the my enrollments and here you will see the
option to become educator and once you are educator you will see this option educated dashboard so now if I click on
this my enrollments so it will open a list of courses where you have enrolled and if I click on this button it will
open the course player page where you can watch the courses right and you can also rate this course and to play this
course here we have this watch link if if I click here it will start playing the video in right side like this let me
just come back and we will open this course click on this button and here we have this chapters if I click on this
watch button so you can see this course will play in the right side and here we have the chapter number and lecture
number then we have the lecture title and we can also Mark this lesson as completed by using this Mark complete
link now if I go to educator dashboard so here we have the dashboard for educator where educator can see the
status like number of enrollments then total courses and total earning after that here we have this add
course page from where educator can add any new course so here we have the option to add the course title like this
then we can add the course description here after that that here you can enter the course price then you can add the
discount and here we have the option to add the chapters so in the courses we will add the chapters and in each
chapter we can add multiple lectures so let's click on this add chapter button so here we have to add the chapter name
so just add chapter one click on okay so now in this chapter we can add the lectures so just add this lecture here
we will add the lecture title then total duration of this lecture then we have to provide the URL that is the video URL of
this lecture right and if I check this checkbox then it will be available for free preview and after adding all the
detail just click on the add button so this lecture will be added and finally you have to click on this add button so
it will publish your course after that you can see the published courses here in my courses section so in this my
courses you can see I have published one course right and this is the course price and
this is the publish date and here we have the number of students enrolled in this course after that you can go to
this section where you can see the number of enrolled students and the student name right so this is the
educator dashboard now let's try to purchase any course so I'll select this course and click on this enroll Now
button so it will open this a stripe payment Gateway and here we have to add any email ID and click on this card and
here we have to add the card details so right now we are in The Taste mode of this stripe so here we can use the test
card number so the test card number is this one and here we have to add any future date then add any 3digit number
and here we have to add the name then click on pay button so now you can see we have successfully enrolled in this
course also that is cloud computing Essentials and now we can start watching this course so this was the overview of
our LMS project after we finished building this LMS project using marus tag we will deploy it on versal before
we dive into the code if you are completely new to react I highly recommend watching my react beginners
tutorial first it is available for free on my YouTube channel and I will include the link in the description below now
let's get started now we will start creating our LMS project so right now I'm on my desktop
screen and here we will create a folder with the name LMS which is learning management system
now we will open this folder in vs code and our LMS folder is open in this vs code now we will open the terminal so
we'll click here select new terminal so in this terminal you can see we are at this directory LMS so here we have to
create a react project to create the react project we will use wheat package so let's write
npm create we at latest now press enter here we will press y for
yes now it is asking for for the project name so in this project we will create the front end and back end so for the
front end we will write the project name client then press enter after that we will select the
framework react then select JavaScript now our basic react project
has been created next we have to move to this CL client folder so in this terminal we will write CD
client so in the left side bar you can see we have the client folder and in this one we have these files right now
you can see in this terminal we are at the client folder so here we have to install the dependencies
so let's write npm install so it will install all the depend dep is required for the DC
project after executing this command you will see a new folder in the left side that is nodecore
modules in this folder it will install the dependencies after installing it we can
run our project to run the project we will write npm run Dev we have added npm run Dev press
enter so it will run our project so our project is running at this URL Local Host Port
5173 now we will open this link in web browser so this is our basic whe plus react project it is successfully running
in the web browser next we have to clear this project so just come
back and in the left side word you can see here we have this index.html file and in this
one we have this title so in this title we will add our own title so here I'm going to add our website name that is ID
me this is the project name then we will add our channel name great a stack after that we will open this SRC folder
and in this SRC folder you can see we have app. CSS just delete this one then we have this
app.jsx so we will clear all the code from this file and here we will use RF C snip it so it will create this component
structure if this RFC e snippet is not coming for you then you need to install one extension so here in this extensions
you need to search es7 react Redux just install this extension then you can use the RFC
snippet to create the component structure after that here we have this index. CSS file so we will open this and
here we will clear all the codes in this index. CSS next we have to insert the assets
that we will be using on this website so let me just come back to the desktop screen and here we have one folder
called assets and in this one I have all the images and icons that we are going to use on this website so let me just
copy all the images and icons and here we have one assets. JS file file also just copy everything and come back to
the project folder then go to client then go to SRC and in this one you will find this assets folder so in this one
we have to paste all the images and icons so let's paste it here after that in this one you will
find one file called favicon SVG so just copy this favicon . SVG file and come back to the project folder and here you
will find this public folder so in this public folder paste this favicon do SVG file and we can delete this we.
SVG now just come back to the vs code and in the left side you can see we have the assets and in this assets we
have all the images and icons and one assets. JS file and here in this public folder we have this favicon do SVG so we
are going to use this favicon do SVG as a favicon icon for our website so here we will open this index.html file and in
this one you will find this link tag where you will find re icon and here we have this hdf v.svg so
instead of this wheat. SVG we will write favicon do SVG save the changes and come back to
the web page now you can see the icon in this browser tab so it has been updated so we
have added our own favicon icon and you can see the title also it me cre a stack correct now let's come back and here we
have two add some other packages also so to install other packages we have to come to this terminal and first we have
to stop this project for that let's write contrl C press y now we will install some packages so
just write npm install and write the package name so first we will install the react router
Dom using that we can add the routing on our react project after that we will add the
another package that is react YouTube using this react YouTube package we will add the YouTube videos on our
website after that we will add the another package that is unique ID using this unique ID
package we will generate the unique hexad decimal ID for our courses after that we will add the quill package using
this quill package we will generate the rich text for our course description and after that we will add the next package
that is humanized duration so this package will help us to convert the video
duration in hours minutes and seconds so next we will install the RC progress package so this RC progress package will
help us to design a progress bar or circular progress next we will install one more
package that is react simple star rating so the simple react rating package will help us
to display a star ratings for our courses so we have added npm install react router Dom react YouTube then
unique ID quill humaniz duration RC progress react Simple Start rating now press enter so it will install all these
packages after that in the left side bar you will find this package.json file just open
it and in this one you can see we have dependencies and in this dependencies you will find all the packages that we
have installed so we have all the packages right after that we can start our
project to start our project again we will use npm run Dev press [Music]
enter so it will again start the project and if I come back to the web page refresh it so it is
working next we have to add the support of telin CSS in our project so let's open a new tab and search
for V tnd and open this
website and here we have the steps to install telin CSS in our we plus react project so the first step is to create
react project that we have already created then we have the Second Step so we have to use these commands so just
copy this one and come back here and let me again stop this project using contrl
C then paste the command now just come back to the documentation again and copy the second
command and paste it here now let's see the next step so the next step is to configure the tnd config
JS file so just copy everything from here and come back to the vs code and after that in the left side you will
find this telvent config.js file so here we have this file and in this one we will replace these contents so just
remove everything and paste the code that we have just copied that's it after that again come back here and here you
can see the next step we have to add these lines in the index. CSS file so just copy this and come back here and
open SRC index. CSS and paste it like this after that just come back
here and you can see the next step is to start our project that's it so we have configured the telin CSS to start the
project again write this npm run Dev now we can use the tent classes in our react project next we have to add
the Google font on our website to add the Google font let's search for Google
font open this website fonts. goole.com and in this one we have this search box so in this
one we will search for Google font that is outfit select this one now just click on
this get font and here you will see this button get embed code just click here and here we have
this import button we'll click here and just copy this import statement and come back to the vs
code and here before these three lines we will pay the import statement like this after that we have to add the font
family for the entire web page so here we will add a start and font family and we will provide font name
that is outfit so now we have the support of Google font on our complete react
application next we have to create create the folder structure for our project so let me just hide this
terminal and in this left sideb bar we will create the folder structure so in this SRC let's create a folder called
components and in this components folder we will create the components for the educator and also for the students so in
this one we will create another folder called educator and in this components folder
let's create another folder called students so we have the components folder then we have educator and
students now in this SRC let's create another folder called pages so in this Pages folder we have to
create the pages so in this Pages folder again we will create two other folders for
educator and students so create a new folder in this pages and write the folder
name a students or let me write a student and in this Pages let's add
another folder with the name educator and here also I will update the name it will
be a student like this now in this SRC we have to add one more folder that is
context in this context folder we will create the context file of our application where we will store the
state and functions that we will use in the entire application so now let's create the files in all
these folders so first let's open this a student folder in this components so we will create the components for a student
so here we will create a new file in the a student folder and write the file name never.
jsx here we will use ra Ace and let's write the text never we will add it in H1 tag like
this now let's create another file and it will be hero. jsx for hero
component again write RF C snippit and here we will add the title hero now let's add another
component that will be call to action do jsx let's create another component that is
companies here we will add our a fce and write the text companies now let's create a new
component course card do jsx let's add one more
component course section so let me write courses section do
jsx after that we will add the another component in this student that is loading
now let's add next component that is [Music]
rating now we will add the next component that is search bar after that we will add the next
component that is testimonial sections now let's add next component that is
footer do jsx so we have created these components for a student section now we will create
the components for educator so in this educator folder we will create a new file and write the file name nvar we
will display different nvard for educator so we are adding the component nard
dot jsx here we will add the text edu that is Educator
never now in this educator folder we will create a new file and it will be sidebar here we will add the
text sideward and in this educated we will create one more file that is another component called
footer so for the educator we will add different footer here we will add the text a do
footer so we have created the components for educator and students now we have this pages so we will create the pages
so in this one let's create the pages for a student so in this a student we will create a new file and write the
file name home. jsx here we will add the
text homepage now let's add another file that will be course Details page so we will add
course details. jsx now let's write new page so we will
add courses [Music] list after that let's create a new page
that is my enrollments now let's write what more page that
is player where a students can watch the courses so we will add player.
jsx so we have created the pages for a student now we will create the pages for educator so educator will have the add
course page dashboard then educator page then my courses page where educator can see their courses and there will be one
more page called a student enrolled where educator can see who has enrolled to their courses so in this educated
folder let's create a new file and write the file name add course do jsx
add codes now let's create a new file that is dashboard educator dashboard now we will
create a new page that is Educator now we will create a new page called my
courses and we will create one more page that is students enrolled so we have created all pages
and components for our project next we have to create a context file where we will store the common
Logics and we will store the state and functions so in this context folder we will create a new file called add
contact add app context.
jsx in this app context. jsx file we have to create the context so first we have to use the create context hook so
let's write import create context from
react after that using this create context we will create the app context so let's add
const app context equal to create context now we have to export this app
context so just add export like this after that we have to add the app context provider so here we will add
export const app context provider and create this function
so we have created app context provider function and in this one we will get the props
and here we have to return one component so just add return
and we are going to return this app context dot provider component like this and in this one we have to use
this props do children like this next we have to provide
the value in this component so here we will add the value and in this value we have to
provide one object so first let's define one object here so just write con value is equal
to empty object and we will provide it here now whatever States or function we will declare in this value object that
will be passed in this app context. provider right next we have to provide this support of app context in the
complete application for that let's open this main. jsx file and in this one you can see here we
have this a strict mode so let me remove it and here we will use app context
provider like this and just use the same tag for this closing so we will add it
here so we have added opening Tag app context provider and here we have this app context provider closing tag and in
this one we have this app tag then we have this app context provider that is imported from this
context folder app context. jsx file like this now save the changes and now we have the support of app context on
our complete application next we have have to set up the routes so to set up the react router
first in this file we have to import the browser router so we will write import and in this one we will
add browser router from react router Dom correct and after that we have to wrap this one using the browser router so
here let's write browser router tag and close it
here like this so first we have the browser router tag then we have this app context
provider then we have the app component like this so we have wrapped the app context provider using browser router
tag now we have the support of react router in our project next we we have to set up the routes and router for that
let's open this app.jsx file and here in this
one we have this return div so in this div we are going to set up the routes so here let's
write routes tag just select it from suggestion so you can see routes tag has been imported from react router Dom
close this tag here like this now in this routes tag we have to use the route so just write
route select it from here so this route has been imported now just close this tag for
self closing now in this route we have to provide the path so we will add the path
of homepage that is slash so when we will hit this path we have to display the homepage so here we will add element
and in this one we have to provide the page component so here we will add curly bres and provide the home page component
so just add home and select it from here so you can see this home has been imported from Pages a student SL
home like this now now we have to close this tag correct now whenever we will open
this slash then it will open this homepage component if I come back to the web page here you can see the message
homepage that is coming from this page as you can see here we have the pages and in this Pages we have the
student and here we have this home and here you can see the message homepage so the same thing is coming on this website
so it is coming using the react router now again come back to the app.jsx file and we will create the route for other
pages so after that we have to create the route for course list page so just add route or let me just duplicate it
and here we will change the path it will be course list and in this element we will write
course list so you can see this course list has been imported from Pages a student and
course list after that duplicate this one and here we have to add the path for course page so here we will write
path name course and it will be a dynamic route so here we have to display
different courses so here we will add course SL colon ID and we will provide the dynamic ID and
based on this ID we will display different courses so here we have to display the course Details page so just
write course details you can see this course details
has been imported from Pages student now let's duplicate it and here we will add the another page
that is my enrollments and here we will provide
component called my enrollments so it has been
imported here you can see we have added course list component so we have to add one more route for this one course list
and here we have to provide the dynamic input so after this course list we have to provide SL colon
input so based on the different keywords we will display different courses so let me just collect it it will be
input and here also we will Mount the same course list component So based on this input keyword we will display the
filtered course list after that we have added this my enrollments and just duplicate it and
here we have to display the player where user can watch the course so let's write the path player
and this route will be dynamic so we have to display different courses So based on the ID we will display course
on this page so here we will add/ colon course ID and here we have to display the player
component select it from here so this player has been imported after this player we have to
import the loading component so here just duplicate it and let's
write loading SL colon path so so it is also a dynamic route and here we will add the
loading component after adding it let's check all the routes so just copy this path
and come back to the web page and here if I provide Local Host Port 5173
SL course list so you can see here we have the message course list page correct now if I change the route if I
add course and after that we have to add any ID so just come back and here we will write SL course SL in the ID we
will write 10 like this now you can see course Details page so this route is working
now let's check this my enrollments just copy this one paste it here so now you can see my enrollments page so this
route is also working now just copy this player and after that we have to provide the course ID so here we will write
player and write any ID like 10 so you can see player page so it will display the player page now just come back and
here we have this loading and after that we have to add the path so let's write loading and then we will add then we
will add any path so you can see the text loading so these routes are working next we have to add the route for
educators so here after this route we will create one more route and this will be route open and
Route closing tag like this and in this one we have to provide the
path and here let's add educator like this and in this one we have to provide
one element so we will add the element and we will add educator element so you can see this
educator has been imported from Pages educator folder and educator file now just close this tag like
this now in in this one we have to add the nested routes within this educator so here let's write within this opening
and closing route tag we will write another route tag and this will be self closing like this and here we have to
add the path and we will add the path called educator and here we will add the
element and in this element we have to provide the
dashboard so just add dashboard now just duplicate this one
and here we will add the path add course we can remove this Slash from here and here we will
write component that is ADD course and here we will write the path that is my courses and here we will add the
element my courses now just duplicate it and here we will write the path called a student
enrolled and here also so we will add the element that is a student
enrolled so you can see so you can see a student enrolled my courses add course dashboard all pages has been imported
correct now we will test these routes so first we have to use the path educated and after that we will add these path
name so just come back and here let's write SL educator so here you can see educator page and if
I again write SL educator so it is displaying blank page
so we have to display the Nate component here like dashboard so just come back and we will open this Pages educator and
go to educator. jss correct so in this one let's write one div and in this div we have to
provide the outlet so first we have to import the outlet so just write import outlet from react router Dom and
within this D we will write cly bres Outlet we have to use this Outlet tag
and close this tag here now save the changes and come back here now you can see it still it is
blank so we will just come back here and you can see here we have added these nested routes so from this one we will
remove this slash that's it after removing it if I come back here you can see we have the educator page and in
this one we have this dashboard now if I change this path if I write my
courses so here you can see educat page and in this one we have this my courses page if I come back and let's see the
other routes so here we have the add course and a student enrolled so just copy this
one and here we will write SL educator SL add course so here you can see educator page then we have the add
course so all these routes are perfectly working after setting up the route next we have to create the component and we
will Design the component so first we will start with the navigation bar so let's see our figma design file for the
navigation bar design as you can see in this figma design this is the navigation bar and in
this navigation bar we have the logo some links and one button so we will create this navigation bar for the
homepage and in other page let's go to course list page so in this page you can see the background color of this
navigation bar is white and all the contents are same as the homepage and this course Details page
but the background color is white that's it now if I go to other page like this one so this is for the educator
dashboard page where educator can add a new course so in this one you can see the navigation bar looks different so we
will create the different navigation bar for educators so let's start creating the
navigation bar for the homepage for a student so just come back and we will
open this component folder then go to a student then open navb bar. jsx so here we have added this text we
will remove this text from here and we have this div and in this one first we have to add the logo so we will add the
image tag and in this one we have to provide the logo so we will use the logo from assets so if I open this
Assets in in this one we have the assets. JS file and if I open this assets. JS in this one we have imported
all the images using this file path and import a statement and we have provided these
name for import and after that we have exported all the images in this assets object so we can
simply use this assets object and use any image like logo search icon any other image also using this assets
object and after that you can see we have added some other data so here we have the dummy educated data B that we
will display on our website this is an object after that we have this dummy testimonial data so it
is an aray and in this aray we have multiple object that represent individual testimonial data after that
we have the dummy dashboard data then we have this dummy a student enrolled data then we have dummy
courses so we are going to use these dummy data and we will display these data on our
website so right now we are going to use the logo from assets so simply add curly press say then write assets selected
from here so you can see this assets has been imported from assets folder assets file and from this one we will find the
image so from this assets object we will use the logo that's it after that we have to add the alt
property so in this one we will add logo and here we have to provide the classes so we will add the class name property
and we will provide the width and after that we will change the width for different screen size so just
add LG and width 32 after that we will add cursor pointer so in this navigation bar we
have added the image that is the logo after that we have to add different content in desktop view and mobile view
for that we will create two div this is the first div just duplicate it this is for the mobile view so in this one we
are going to add the content that will be displayed on laptop view or desktop view so here in this one we will add the
class name hidden so by default it will be hidden on mobile phones and here we'll add the
screen size medium and above screen so for this one we will add Flex so again it will be visual on medium and larger
screen after that we will add item Center then we will provide the Gap and here we will
add text color so the text color will be gray 500 in the St we have to add some links
so we will add two links so just add a div and within this div we will add two links so here we are going to use button
tag and in this one we will add the button text called become
educator and after that we will use this line and after that we are going to use the link tag so here let's write
link we we will use the link tag from react router Dom so you can
see this link has been imported from react router Dom package now in this
link we can add two property so first let me close this link tag and here we will add the two property and in this
one we will provide the path so simply add SL my
enrollments and here we will use this link and closing link tag like this so within
this link tag we have to add the link text so the link text will be my enrollments like
this so in this navigation bar we have added the logo then we have have added the div for desktop screen and this is
the another div for Mobile screen in this one we have added one div that contains two links we have used one
button tag and one link tag and after this link and button we have to display
one button that will be create account so here let's
add button tag and we will add the button text create account now in this button we will add
classes so just add the class name property and here we will provide the Tailwind classes so let's write
background blue 600 then text white padding X padding Y and rounded full so that the corners will be
round after that here we have the first div so in this one also we will add some classes so here I'm going to add the
class name and in this one we will provide Flex item Center justify between padding X and we will add different
padding X for different screen size then we have added the Border bottom then border color and padding
from y AIS after that we have to add the background color as you can see in the figma design we
have different background color in the navigation bar when we move to course list page and for other page we have
this background color in the navigation bar to do that here before this return a statement
we will add some space and here we will check so just add con is
course list page equal to location
dot path name dot includes so if the URL path name includes this text that is course list
it means we are on the course list page so this variable will be true so whenever it is true we have to add the
background color white and if it is false we have to add another background color so we are going to use the turn
operator so here we have this class name so we have to wrap all these classes in curly
bres to use the template literal here we will add the back tick so remove this single quat and replace it with
backtick and after that here we will use dollar sign curly bres and here we are going to use this
is course list page variable we will check if it is true then what will happen we have to display
the white color in the background so we will add background white and then we will add the colum and it means when it
is false then we will add another color so here we are going to use background
Canan 100/70 now save the changes and next we have to mount this Navar component on
app.jsx file so we will open this app.jsx and in this Navar component and this Navar component will be displayed
on all pages so we will mount it before this routes so before this routes here we will
Mount Navar so we will select this Navar from this components student nabar so you can
see this nabar has been imported from components student naar now this now just close this tag
and here we have this div so in this one also we will add some classes so here let's
provide text default mean height green and background white for entire application after adding it let's come
back and open our website so here you can see we have this navigation bar correct so right now we have added this
navigation bar here in this return in this D so this navigation bar will be displayed on all
the pages including educator dashboard so we have to provide different navigation bar for educator so
we have to hide this one and when we will on the educator page we will hide it so for that here we will
write cons is Educator route so when we are on the educator
route then we have to hide it so here we are using use match from from react router
Dom so here you can see use match has been imported from react router Dom and in this one we have to provide the
path this one so if the path matches SL educator slash anything else right so in that
case this is Educator will be true and whenever this e educated route is true then we have to hide this navigation bar
so here let's write curly presses and in this one we will write not of is Educator
route so whenever it is false then only we have to display the navigation bar so here we will write and operator and we
will move this Navar here that's it save the changes and still you will see the navigation bar on
the homepage so it is hidden it is hidden because we are on the educated path and
if I go to homepage here we have this navigation bar and if I go to any other page that includes the educator in the
URL so you can see when we go to/ educator SL add course then n then the na bar is hidden and if I remove this
path this navigation bar is visible on a student page so this is the home page for a student now we will Design This
navigation bar so just come back we will come back to the nav bar. jsx file and in this one you can see
here we have added the class name for this div and after that we have this div that includes one button and one link so
in this one also we will add the class name and here we will provide the tnd classes so here I'm going to provide
Flex item Center Gap five save the changes just come back to the web
page here we are getting some space in the right side this is because here we have added this another div right so in
this div we will add the class name and we will add medium and above a screen it will be
hidden so it will be hidden on medium and above screen size now you can see we have this navigation bar till this
point so this navigation bar for desktop view is looking nice now we will add the navigation bar for mobile view so just
come back and for now let me reduce the screen size so you can see if I reduce the screen size it is hidden on the
small screen so we have to add the navigation bar for smaller screen so just come back and here
this is for the smaller screen so here let me add one comment for phone screens and here in this
div let's write some classes so we will write Flex item Center Gap two then Gap five and text Gray
500 after that here also we will add two links so we will add the div and in this div
first we will add the button so we will copy this one only paste it here so in this button we have
added we come educated and then we have this link tag that is my enrollments right and after that here we will add
one button and in this button we will add one image so we will add the image
tag then we will use the cly addes assets dot user
icon and after adding it we will come back to the web page now you can see here we have this links become educator
my enrollments and then we have this user icon so instead of button we are displaying one user icon for the smaller
screens like this after that we have to add the Coler authentication on our web page and using
the Coler we will add the functionality in this create account button so that user can click on this button to create
an account and after creating the account we will display the users profile picture here and we will replace
these links according to the US users login estate if the user is logged in then we will display different links and
if the user is not logged in then we will display different links here for that first we have to create the account
on cler to create the user authentication in our project just click on the link given in the description
that will directly take you to this page that is color.com so this clerk is a user
authentication and user manage platform using clerk we can easily integrate the user signin sign up feature in our
website and we can manage the users profile so to integrate the clerk authentication first we have to create
an account on this website I'll click on this link sign in I already have an account so I'll
choose this Google signin then you will find this screen here you have to select create
application and in this one we will write our application name so let's write great a stack
LMS and here we will choose the email signup option and Google sign up option then click on the create application
button after that we have to choose this react and here we have the steps to
integrate the color authentication in our project so the first step is to create a react application using V and
after that you can see the next step so the next step is to install cler so here we have the command that we will execute
in the terminal so just copy this one and and come back to the vs code editor and we will open the
terminal first we have to stop the project using control C press Y and here we will paste this command that will
install the color package after executing this command if I come back to the side word and
open package.json file so in this one you can see we have the dependencies object and in this one we have this
Coler react so the Coler has been installed after that we have to do some setup so you can see the next step we
have to use this color API keys so just copy this key from here and we have to add it in our environment
variable so just come back and here in this client folder we will create a new file with the name
EnV where we will store all the environment variables so in this one we will paste this color publishable
key and we have to start our project so in this terminal we will write npm run Dev so it will start our
project after adding it just come back to the Color website again again and you can see the next step so
we have to import the color publishable key in main. TSX or jsx file so just copy this statement from
here import your publishable key just copy this one and come back to the vs code and we will open main. jsx file and
in this one here we will write this a statement that will import the
publishable key from environment variable right and here we have added it before this create
root correct next we have to add the color provider component for that first we have to import it so here let's write
import curly Braes color provider and we will import it
from single code at Coler SL Coler SL color react we can remove this line from here a strict mode is not
required so we have added this import statement color provider now we will wrap these components using the color
provider so after this browser router here we will write color provider like
this now let's move this app context within this color provider so now you can see first we have the browser router
in this browser router we have the color provider and closing it here then we have the app context provider then we
have the app in this color provider we have to provide our publishable key so we will add the publishable key and
provide this key from here so write this cly bres and provide publishable
key after that in this one we will add one more thing that is after sign out URL we have added this after sign out
URL and in this one we have to provide the path that is SL like this now we have the support of
color authentication in our project now we can simply use the color reusable component to create our login
or signup component so just come back to the navigation bar so in this student we
have this na. jsx so in this one we are going to use
the color component to create the login or sign up form so first we have to import it so here we will write the
import statement in this na. jsx file we will import use
Coler from Coler slash color Crea after that we will import user
button then we will import use user
from color react now we have to add the functionality on the button that will
open the login form for that here we will write const we will get the open sign
in from use cler we are going to use this open
signin when we click on the button so it will open a sign up form after that we have to get the user
from this use user so here let's add const user equal to use
user like this now you can see here we have added this
button create account right so on this button we have to add the onclick property so here we will write on click
and in this on click we will provide the add function and here we will use this open sign
in that's it save the changes and come back to the web page if I click on this create account
button it is opening this login form you can see sign in to Great stack LMS so we can sign in using this Google account or
we can use the email address and if you are new on this website you can create an account using this link we will click
on this one sign up so it will open this sign up form where we can sign up using the Google account or we can use the
email ID and password to create an account but before creating any account we'll just come back to the vs
code and here you can see we have added this button so this is the create account button so whenever we will sign
in or sign up then we have to hide this button and instead of this button we will display the users profile icon for
that here we will wrap this one in a curly Braes and here in this curly bres we
will use this user it means whenever the user is available if the user is already signed up in that case we will display a
user button component so just add user button select this
one and we will add colon so whenever the user is available it means the user has already signed up then we will
display this user button and else we will display this create account button like
this so this is the user button from Coler if I scroll up you can see we have already imported this user button from
cler act right after adding this just come back to the web page and click on this create account button then click on
sign up and I will use this continue with Google option I'll choose this email
ID then click on continue now you can see we are successfully logged in on this website
and here we have the profile icon and instead of this create button we are displaying the profile
icon and if I click on this one here we have the option to manage the account and we have the option to sign out from
this website if I click on this manage account it will open this window where
we can update the profile and we can add another email ID and if I click on this link we can
update the profile image we can click on this button to upload any
image now let's close it we will replace these links according to the user estate if the user is logged
in then we will display different links and if the user is not logged in then we will display different links so just
come back and here you can see we have added become educator and my enrollments
so let's wrap it inside a curly bres like this in this curly bres we have added
this button and this link correct and here we will use user then we will write and operator
then we will use this fragment and close it here after this closing link tag so you
can see whenever the user is logged in then only it will display this become educator and my enrollments
link and if the user is not logged in then we will hide it right so after adding it if I come
back to the web page here we have the option to become educator and go to my enrollments and if I log
out here we have this create account button only because first we have to create account then only we can go to my
enrollments or we can become a educator and if I click on this one it will open this sign in or sign up form
now let's add the same thing for the smaller screen so just come back to the vs code
and here we have this code for phone screen so in this one also you can see we have
this link called my enrollments and this become educator so we will copy the same thing
just copy this Curly bres from here and and we will paste it here within this
div and in this div we have missed the classes so just add the class name
property and here we have to provide Flex item Center Gap then gap for different screen then we'll add the
text extra small and here we are using user if the user is logged in then only will display
this become educator and my enrollments and after that here we have to display
the user icon so if the user is logged out then only we will display this user icon and if the user is already logged
in then we will display the user's profile image from cler so here let's write the curly bres and here we will
write a user and if the user is available then what will happen we have to provide the user
button like this and colon and if the user is not available then we will provide this
button now it is clear now save the changes and come back to the web page so if I change the screen size so
here you can see we have this user icon in a smaller screen and if I click here so it should open the login form so
just come back and here in this button we have to add the onclick property so just
add on click and in this one we will add the Aro
function and in this addo function we will call op signin function that's it now again come back and click on this
user icon so it is opening this signin form and let me sign in using the Google account so now after sign in you can see
we have these links become educator my enrollments and then we have the profile image so now we have completed the
navigation bar for our website after creating this navigation bar let's come back to the figma
design and on this homepage you can see we have to create this section where we will display the welcome message a small
text and one search bar for that let's come back to the vs code editor here we will open this
sidebar and in this one we will go to components a student and open hero. jsx file
now in this one we have to add the welcome text that will be displayed on the hero section so you can see in this
figma design we have this text then a small description and one search bar so just come
back and here let me remove this text
and here we will write H1 tag and we will add the text this
one Empower your future with the courses designed to fit your choice after that we have to
add this text in a span tag so here we will add the as span and uh close it here at this point
and after this asan tag we have to add one image so we will add the image tag and in this SRC we will add the curly
presses select this assets then write dot sketch and here we will add the alt
property a sketch after that we have to add some classes so just add the class name and
in this one we will medium block then hidden so it will be hidden
for small screen and for medium and above screen it will be block then we'll add absolute then bottom minus 7 and
right zero so we have added the position for this a sketch image after that we have
added the asan tag so in this asan tag we will add the classes so here let's write the class
name for this text we have to change the color so here we will use text blue 600 after that here we have the H1 tag
so in this one we will add the class name and here we have to add the classes so for medium and above screen
we will add text home heading large then text home heading small then relative font bold text Gray then maximum width 3
XEL and margin X Auto after that in this first div we will add the class name and here we will
provide the classes like Flex Flex column item Center justify Center then width full for medium screen
we will add the padding top and for smaller screen we will add padding top 20 then padding
X then padding x0 for different size a space y text Center then background gradient so we will add this color in
the background gradient color then we have added the title and in this title we have added the a sketch
image after that we have to add add the a small description so we will use the P tag and in this one we will add this
description text now in this one we will add the class name and here we will
write medium block and hidden so it will be hidden and for medium and above screen it will be displayed then we have
added text Gray and maximum width to XEL and margin X Auto after that we will add another text that will be displayed on
Mobile screen so here we will add this a small description text and here we will add
the class name in this class name we will write medium hidden so for medium and our screen it will be hidden then we
have added text color then maximum width and margin X auto save the changes and next we have to mount this hero. jsx on
the homepage so let's open sidebar and from here we will go to Pages student home.
jsx and in this one you can see we have added the text home so just remove it and here we will Mount our hero
component click here so you can see hero component has been imported from component folder a student folder then
hero close this tag after that here we have this div so in this div we will add some classes so
just add the class name and we will provide Flex Flex column item Center space y then text Center save the
changes and come back to the web page so here you can see we have this title text then small
description and here we have the sketch image so right now this text is looking very small so let me colnect it we will
come back to the vs code and let's come back to the hero. jsx
file in this one you can see we have used the custom class name home heading large and home heading a small right but
we have not declared these classes so let me just come back in the left side bar and we will open this telin
config.js and first we have to create our custom classes in this theme so here in this theme extend
object we have this extend object so in this one we will add font size where we will Define the custom font size so
let's add font size colum then add the the object in this
one we will Define multiple font size so first let's add course details heading a
small and here we will add the column then we will provide 26 pixel
comma 36 pixel now duplicate it and here we will add course details heading
large here we will add the value 36 pixel and 44
pixel we have to add a comma here so now we will duplicate this one and in this one we will add the font
size name that is home heading a small and here we'll add the font size 28 pixel and 34 Pixel duplicate
it here we will add home heading large we will add the font size 48 pixel and 56
pixel and we will add one more custom font size that is default and in this
one let's add 15 pixel and 21 pixel save the changes and come back to the web page now you can see this font
size is looking perfect for this screen correct and if I change the screen size
you can see on a smaller screen it is looking perfect and we have to remove the sketch image from a
smaller screen and then we have the a small description in a smaller screen and here we have the large
description now it is looking beautiful now just come back and we will
open this hero. jsx in this one you can see we have added edit this paragraph text after this paragraph text we have
to add one search bar so we will create a search bar in this search bar component so just open
search bar. jsx file and in this one we have added this text so remove this text and here we will add a form
tag like this now in this form tag we have to add one image and in this image we will
add assets dot search icon and in this alt property we will
add search icon and after that we have to add some classes so here we will add the class
name and in this one we will add width for the medium and above a screen we will add
MD width Auto and after that we will add width 10 for Mobile screen then we will add the
padding from x-axis after that we have to add the input field in this form so we will add
the input type will be text and in the one we will add the placeholder so in this placeholder we will add the text
called search for courses after that we have to add the class name property and in this one we
have to provide some classes like width it will be full height full then outline none text Gray 500/80
after that we have to add one button so we will add the button tag and in this button type we will write
submit then we will add the button text that is search then in this button we will add
the class name and in this one we will provide background blue rounded text white and padding X
then padding x 7 then we will add the padding y for different screen and margin
X1 after adding it here we have this form tag and before that we have this div so we will remove this div we will
simply return the form tag in this component now in this form tag also we will add one class name and let's write
maximum width that is Excel and after that we will add the width full and for different screen we will add
different height 14 and 12 then we will add the flex item center background white border border color and
rounded after adding it we have to use this form component in this home component so just
open this home. jsx and after this P tag we will Mount our search bar so here let's
add search bar so you can see this search bar has been imported and let's close this tag now
just come back and here you can see we have this search bar in this one we have the search icon and search button
correct now if I enter anything in this input field that is the search boox input
field and click on the button it should open the course list page and it should display the courses related to the
search keyword to create that functionality we will come back to the vs code and we will open search bar. jsx
file and in this file before this return statement we will write
const navigate equal to use navigate
hook so we are using this use navigate from react router Dom and now we can use this navigate
function to navigate the users on other page after that we have to add some State variable where we will store the
the input field data so here just add const and the state variable name is
input and the seter function name is set input equal to use a
state use state has been imported from react now here we will initialize this state variable so first we will add the
data and if the data is available then we will add data else we will initialize it with empty
string after that here we have to add form Handler function so let's add one function const
the function name is on search Handler equal to create this Aro
function here we will get the form event and here we will add e do prevent default so whenever we will submit this
form so it will prevent the website from reloading after that we have to navigate the users on
course list page so we will add navigate and in this one we have to provide the path so we will provide the path slash
course list and in this path we will add the input field data so we will add plus and
provide this input like this next we have to link this on submit Handler function with this form tag so we will
add on submit and provide this on submit Handler function in this form tag after
that we have to link this input field with this input state so here in this input
field we will add on change here we will add the arrow
function with this event in the parameter so we have created this Arrow function
and it will call this set input Setter function and here we will set the value using the event do Target dot
value after that we have to add the value property also so just add the value and here we will add input State
that's it so we have added the on change and provided this Setter functions set input so whenever we will add any data
in the input field that will be stored in this input State and when we submit the form then this input keyword will be
added in this path and user will be redirected to the course list page with this input text so just come
back and open the website here we have some issues so just check it we will open the console
tab here you can see we have some error in this search bar. GSX data is not defined right so just come
back and uh here in this search bar we have to get the data from parameter so just add data so if the data is
available in this parameter in this props then we will use this data here and if the data is not available then we
will use empty string to initialize this input State now save the changes and come back to the website again now you
can see we don't have any error and if I type anything in this input field like react and click on this search button so
now you can see we are redirected to this course list page and then we have the/ react so here we have this course
list page correct now on this course list page page we can display the courses
based on this keyword that is react now just come back to the homepage so we have created this
functionality for this search box after that if I open the figma design you can see we have to create
this section that is companies right so to create this just come back to the vs code open open this sidebar and from
here we will open this components a student and open this companies. jsx file right in
this one we have to remove this text so remove this title text and here we will use the text in P tag and here we
will add the text trusted by Learners from and after that we have to add one div
and in this div we will add multiple images so just add the image tag and here we have to add the image so simply
add assets dot then we will add the image name that is Microsoft logo and here we will add
the alt text Microsoft after that here we have to to add the class name so just add the class
name property and we will provide the width 20 and for medium and above a screen size we will add the width 28
that's it now we have to display multiple logo of companies so just duplicate this
line and replace the images so in the second one we will write Walmart logo then we will write
essential logo then we will add Adobe logo and after that we will write P
logo then we will update the alt text also so here we will provide different uh text in the alt property like this
after that here we have this div so in this div we will add some padding from top so we will add the class name and
provide padding top 16 then we have this text in P tag so here we will add the class name and in
this one we have to provide text base text Gray
500 then we have this div that includes all the images so here we will write class name and we will provide Flex Flex
WP item Center justify Center Gap six and for medium and above a screen we will add Gap 16 then for medium and
above screen we will add margin top and then we will add margin top five that's it after adding it we will
Mount this component on home. jsx so just open pages then a student then home. jsx
and in this one you can see we have added this hero component so after this hero component we have to
add company's component so you can see this company's component has been imported from component folder a student
folder and companies now just close this tag and save the changes now just come back to the web
page now you can see here we have all the company logo it looks nice after that if I come back to the
figma design you can see we have to create our next section that is the course section right so to create this
course section first we have to create a course card and in the course section we will display the four course card right
so to create this section we will come back to the vs code we will open
this course section component and in this one we have added added this title in H1 so just remove it and here we have
to add a title in h2 tag so let's write S2 and provide this text after that we have to add some
description in P tag so we will add the P tag and provide this small description right next we have to add
the course components that will be individual course card then we will display one button so here
we will add the space for course card then we will add the button so here we will add the link tag
we will use this link from react router Dom and just add this closing link tag and
we will add the link text that is so all course says and in this one we have to add the two property so just add
path that is/ course list so when we click on this link it will display all courses and it will red us to the course
list page and after that we have to scroll the web page to the top so here we will
add the on click property and in this one we will provide the arrow function and here we will add
a scroll to property and in this one just provide zero and zero so it will scroll the we
page to the top correct now in this one we have to add some classes also so here we will add the class name property and
in this one we will add text Gray 500 that will be the text color then border border color gr
500/30 then padding X padding Y and rounded so we have added the CSS properties for this button now we will
add the CSS properties for this title and description so in this title we have to add the text size so just add the
class name here and provide text 3 XEL font medium and text Gray 800 after that we will add the class name in this
description so here we will provide text a small so the default size will be text a small and then we'll add the medium
for medium and above a screen we have to add the text base then we will add the text color and
margin from the top now we will add the CSS properties in this div so in this div we will add
the class name and here we will provide the padding from y AIS then padding X8 and for medium and above screen size we
will add padding x40 like this save the changes and come back to the web page but before that we have to mount
this courses section so just open home. jsx file and after this companies we will
add courses section component so this courses section has been imported now if I open the homepage
here we have this title learn from the best then we have the description and then we have this button so all courses
and if I click on this button it will open this course list page and if I come back to the homepage here we have this
text so below this description we have to display the course list right so just come back
and we will come to this file that is course card. jsx right and in this one we will create
the course card to create this course card let me just come back to the figma design
again and in this design you can see we have four courses in this course section so in this first course you can
see we have the course thumbnail then we have the course title then educator name then we have the
ratings and price so we have to create this card so to create this one we need the course data
also so if I come back to the vs code and go to this assets and open assets. JS file so in this file you can see we
have already added the dummy course data so let me scroll up here here you can see we have one array with
the name dummy courses and in this one we have multiple object and each object is representing a single course so in
this course we have the course ID course title then we have course description after that we have the course
price then we have is published data then discount so we can also add discount on the course after that we
have the course content so this course content is also an aray and in this aray we have multiple object so for this
course content we have this chapter ID then chapter order chapter title and chapter content and in this chapter
content you can see we have added two lectures so we have the lecture ID and this is the second lecture of the first
chapter so in the first chapter we have added two lecture with the lecture ID lecture one and lecture
two right so right now we will focus on this one this dummy course data where we have the course price course title
course ID discount and if I scroll down here we we have this educator details then we have the enrolled
students and we have this course rating so in this first course I have added only one rating where user has given
five star right so we are going to use these data to create our course card now let me just come back to the course card
and here in this one we will get the course detail in this props so here just add
course so after adding it here we have added this title in H1 so I'm going to remove this one and in this one first we
need the course thumbnail so we are using the image tag and in this image SRC we will add
the image so just add curly say and we will get the image from this props that is
course Dot course thumbnail after that in this one we have
to add the course details like course title then educator name then we will display the ratings so here I'm going to
add a div and in this div we will add the course title in S3
tag and to get the course title we will use curly bres course Dot and the property name that is
course title I'm using this property name from this assets you can see in this asset file we have the course data
and here we have the course title right here you can see we have the course thumbnail
also now just come back here after this course title we will add the instructor name or educator name so we will add it
in the P tag so let me just copy this paste it here and here I'm going to add the property that is educator.
name so it will display the educator name after that we have to display the course rating where we will display the
average rating then we will display the start icons and then we will display total number of ratings so we are going
to group all these things in a div like this and in this div we have to display the average rating that we will display
in P tag suppose we have the average rating of 4.5 I'm adding it manually we will add
the dynamic value here after that we have to display the star ratings so here we will add a div
and in this div we will add the curly presses and here we will add one aray we will
add spread operator aray and provide five now on this one we will use the map
method and in this map method we will add the parameters and create create the arrow
function so in this parameter let's addcore comma I for the index and here we will return one image
tag so write IMG tag in this image tag we will add the key
property so in this key we will add the index I let me close this tag like this in this one we will add the SRC so
let's add SRC
CES I'll move this image tag within this bracket like this now in this SRC for now I'll add the
same icon so let's add assets dot star so it will add the a star icon
for five times after that we will add the alt property
and next we have to add the total number of ratings so we will add it here after this div so we will add a B tag and in
this one we have to add the total number of ratings so let me add any fixed value right now so I'll add
22 after this course rating we have to display the course price so after closing of this div here we will display
the course price in P tag so we have already added the course price in the assets file in the dummy data so we are
going to use that data so we will add CES then we will
use course dot course price but in the assets dummy data you will find we have
added the discount also so we are going to display the final price here after applying the discount so here we will
reduce the discount amount so we have added the discount like this one you can see we have this dummy data and uh in
this dummy data you can see we have this discount that is the 20 it means we have added 20% discount so we are going to
reduce that 20% value so we will add course dot
discount multiplied by course price divide by 100 so we will get the final
price and we are going to display the course price up to two decimal point so we will wrap this one in this
bracket and here we will add dot to fixed and provide the value
two like this and before this course we have to display the currency also so we will get the currency from involement
variable so that we can update the currency at one point and it will update the currency on entire application so to
get the currency from environment variable here we will open EnV
file and here we will declare a new envirment variable that is currency so we will declare it as
Vore currency equal to and here let's add dollar
sign now we will store this currency in a variable in our context file so you can see here
we have app context do jsx file so in this one we are going to declare a very table so in this provider
function let's add a space and here I'll add con currency equal
to import do meta do EnV and Dot we will provide the envirment with variable name that
is V currency now we have this currency variable here to access this currency
variable in entire application we have to pass it through this value object so in this value object we will just add
this currency now we will get this currency in our course card component so where it
is let me open it this one and here we have to get get the currency from our context
so here before this return statement let's
add const cly bres
currency and uh we will get it from Context file so we will use this use context hook so this use context has
been imported now in this one we have to provide our context that is app context so this app context has
been imported now we have this currency so we can use this currency here before this price so here let's add curly
Braes and provide this currency variable that's it save the changes so in this course card you
can see we have added the course thumbnail then course title educator name and then we have
added the rating and this rating is a fixed value this is not Dynamics so we will update
it later and right now here we are displaying the actual price of this course next we are going to display this
course card in the course section so this is the courses section do jsx file in this one we have added these title
description and this button so before this link that is a button we will display the four course card so
first we have to get all courses data from our asset file so again we will open this app context. jsx and in this
one we will get all courses data in a state variable so in this one here we will
create a state variable so just add
const and the variable name is all courses and we will add the setter function set all
courses equal to and we will initialize it with empty aray so we have added one empty aray for
this all courses now whenever we will run this application we have to store the course data from our assets file in
this all courses state for that we will create a function so here only we will create a function let me add the comment
first so we will add the comment pitch all courses and here let's add the function
const pitch all coures is it will be a synchronous function and we will create the Aro function now
in this one we have to store the data from our assets file in this estate so we will use this Setter
function and in this Setter function simply add dummy courses just click on this
suggestion so this dummy courses has been imported from this assets file right
so now we have added the course data in this all courses next we have to pass this all courses through this value
object like this so that we can access it in any other component now let's come back to the courses section and here we
have to get all courses that we have just created in the context file so before this return a
statement let's add const and we will provide this all
courses and we will get it from use context and provide the app
context correct now we have this all courses data that we will display here before this link so before this link we
will add a div and in this D we will add the cly addes and provide all courses and on
this one we will add the slice method here we will add 0a 4 so we will display only four courses so this will
be one array so we can use the map method so we will add the map and in this map we have to add one Aro
function so in this function parameter we will get individual course and we will get the index
number like this after that in this Aro function we will return the component that we have just created that is course
card component so here let's add opening Arrow course card so you can see this course card has
been imported and let's close this tag now in in this course card component we have to provide the
key so in this key we will provide index and uh after that in this one we have to provide the props so we will add
course and just provide course like this so in this course card component we have provided the course data as props
correct now after adding it if I come back to the website here we are not getting the
course data so let me just come back to the vs code and we will open the app context. jsx file so in this one
you can see we have created this function that will fetch the course data from the assets file but we have not
executed this function so we will execute this function using the use effect so before this value object here
we will add use effect and in this one we will create
one Arrow function and here we will add the dependency array that will be impt aray
and in this one simply call this pitch all courses function so now whenever we will run the application
then it will execute this function and this function will find the data from the assets file that is the dummy code
courses and it will store it in this all courses state after that we will display this data on the web page
so now if I come back here you can see we have the course thumbnail then we have the
course title then rating and this is the course price so we have total four course data here right so next we have
to apply the CSS properties for the course card so just come back and we will open course card. jsx file
so first in this one let's add the CSS properties for this div and here you can see we have added this div so instead of
this div we will use the link tag so that we can click on this one so we will use this link from react
router Dom so this link has been imported and you can see we have to change the is closing tag also so it
will be link now in this link tag we have to add the two
property so that when we click on this one it will open any other URL or path so here we have to provide the path it
will be/ course slash then we have to add the
course ID so we will add plus course doore ID so when we will click on this course
thumbnail or course card so it will open a new URL that will be course SL course ID that will be the individual course
page after that here we have to add the on click using that we will scroll the web
page to the top so in this on click we will add one add function and here we will
add scroll two and provide 0 comma 0 so it will scroll the web page to the top after that in this one we will add
some CSS properties so here let's add the class name let me move it in the new line so in this class name we will add
the CSS properties that is border then we'll add the Border color that is
gray then we'll add padding bottom overflow hidden and rounded large after that we have this image so for this
image let's add class name and here we will provide width full next we have this div so for this
div let's add the class name and in this one we have to provide the pad heading and text left after that we have the
course title in this S3 tag so for this course title we will add the class name and provide text base font semi bold now
for the course educator name we will add class name we will add the class name property and provide text Gray 500 so we
will change the text color after that we have the course ratings that is added in this div
so here let's add the class name and for this one we have to add Flex item Center and a space
X2 then we have this div where we have added the star icons so for this div we will add the class name and in this one
we will provide Flex that's it next we have the star
icons here in this image tag so in this one also we will add the classes so just add class name and for this one we have
to provide the width and height so we will add the width and height 3.5 correct next we have the text
in P tag so here let's add the class name and here we are displaying the the total number of rating or review so for
this one we will add the text color that is gray 500 correct next we are displaying the
course price in this P tag so here also we will add the class name and in this one we are going to add the classes text
base font semi bold then text Gray 800 after adding it if I come back to the
page here you can see we have changes in this course title then start ratings and reviews then we have the price it is
looking good now let's come back to the vs code and we will open this courses se. jsx file and in this one we have
added this div so in this one we will add some CSS properties so first We'll add the class name and for this one
we will add grid then we will add
grid call for so it will display four cards in one row after that we'll add the padding from
x-axis then we have to add different padding for different screen so we will add medium screen px0 then we'll add
medium screen margin y then margin Y and GAP four after adding it save the changes
and come back to the web page now you can see all cards are aligned in the same row correct this
text is looking very long so let me add the line break here so in this one here we will add br
now it is looking good but right now we have one issue if I open this web page in a smaller screen you can see this
card becomes very small right so we have to fix it we have to make it
responsive to make that we will add some custom classes so let's come back we will open this telin config.js file
so in this one you can see we have already added the custom CSS for the font size now we will add the custom
classes for grid template so here let's add a comma and we will add the grid template
columns let's add the object in this object let's add the property name that is auto so the
template name is Auto and here we will add the value for this Auto template so in this one we are going to add
repeat autoit min max 200 and one fraction so it will make the responsive layout where it will display number of
cards that will be Auto fit and it will be minimum of 200 pixel and maximum one fraction now we can use this custom
class name here so if I come back here in the courses section do jsx
file and instead of this GRE calls for we will add GRE calls Auto that's it save the changes and come
back to the web page now you can see it is looking same but if I reduce the screen size you can see this layout is
perfectly responsive now we have two cards in a row now we have one card for mobile view
and if I increase the size we have two cards and now we have three cards and if I make it full screen we have total four
cards in a row so this section is responsive and if I click here it will
open uh new path that is SLC course SLC course ID where we will display the individual course detail so let me just
come back here again and instead of coming back like this we have to add the click
functionality on this logo so that when we click on this logo it will take us to the homepage to do that just come
back and in this context file we have to create the navigate function F
so here after this currency let's add const navigate equal
to use navigate from react router Dom now we have to export it so that we can use it in other components so we
will provide it here in this value of object after that we will come back to the Navar file that is Navar do
jsx and here we have to get the navigate function so here let's add
con navigate equal to use
context and here we will add app context now let's use this navigate here
on this image so on this image tag we will add the on click and provide the arrow
function and here just provide this navigate and provide our path that is the
slash so whenever we will click on the logo it will take us to the homepage after that just come back
here and if I click on this card it will open another page and if I click on this logo it will take us to the home page so
it is working now instead of displaying this fixed value in all the course we have to
display the actual data from our dummy data that is provided in the asset file so to do that we have to create a
function that will calculate the course rating that is average rating for the course so to create that just come back
here in this app context here we have to create that
function so here let's add the comment we will add the comment function
to Cal calculate average rating of course now just create a function using const then function
name calculate rating it will be one Aro function and in this one we have to
provide the parameter so we will provide the course now from this course it will calculate the average rating so here
here we will check if this
course dot course rating dot
length is zero it means there is no rating or review on this course then simply we
will return zero it means the average setting of this course is
zero if the course rating length is not equal to zero then we will calculate the average rating so to calculate the
average rating first we have to declare the initial value so just add let total rating is
zero after that we will add the rating for each Dev viws for that we we will add course
dot course ratings dot for each so for each we will get rating and uh here we will use the addo
function and in this one we will return the total rating plus equal
to rating dot rating so it will add all the ratings of each Dev
viws suppose anyone has given five and other person has given four so it will give the output 4 + 5 that is nine now
we have to divide it with total number of rating so here we will
return total rating divide by course dot course rating do
length that's it so now we will get the aage rating of this particular course so now we have to provide this
function here in this value object like this so that we can access
it in any other component after adding it again we will come back here in this course card and in this course
card we have to get the function so here we are getting the currency from this app context so with that we will
get calculate rating function also right now scroll down and here instead of adding this value 4.5 here we will
provide curly bres provide this function calculate rating and here we have to provide the
course that's it so we will get the average rating of this course here in this P tag after that based on this
rating we have to display the start icons we have to display either five 4 4.5 3 3.5 like that
so here we are simply displaying a five star icons right so instead of displaying all the full star icons here
here we will add the tary operator so just remove it and here first we will add I less
than math. Flo and in this one we will provide this calculate rating
course now if the I is less than this one then what will happen we have to display the full start icon so just
add assets do start and if it is false then we will display assets Dot
a start blank like this save the changes and now just come
back here so here you can see we have total five rating and here we have total five stars in first and second one in
the next one we have zero stars and in the fourth one also we have the zero Stars right so this is the average
rating 5 and five and the average rating is 0 and0 now we will replace this value also that is the fixed number of reviews
so just come back and instead of adding this 22 here we will add CES course
dot course ratings. length save the change es now you can see in this one we have one rating in the second one also
we have the one rating and in other two cards we have zero ratings right so the average rating is five and here also we
have the average rating five and here we have Z and zero so now we have created the course card and then we have this
all courses button after completing this courses section if I come back here in this
navigation bar you can see here we have the the link called become educator so if anyone is already educator then we
have to display the educator dashboard instead of this become educator link for that just come
back and let's open this context file that is app context. jsx and in this one we will create one state variable so let
me just duplicate it and here we will add the name is Educator and then we'll add the
setter function set is Educator and we will initialize it with
Boolean data true so it means the user is already educator and if we make it false then the user is not signed up for
the educator after declaring this state variable we have to pass it through this
object so here just add comma and provide this is Educator and set function set is
Educator like this now we can use it in the navigation bar so just open nav bar.
jsx and here you can see we have this button called become educator right so in this
one here let's add erary operator so let me remove it and here we will add the C bres and here we will get the is
Educator seter functions so we have to get it from the app context so in this one with this navigate let's add is
Educator and after that here we are going to check is educated if it is true then what will
happen we have to display the text called educator dashboard and if it is false then we'll
display the text become educator like this and here we have to add the click functionality
also so that if I click here it will open the educator dashboard right so just add on click feature here and
provide the add function and here we will add the navigate in this navigate simply provide
the path that is/ educator like
this now just copy this one and paste it here for the mobile menu here also you can see we have this wecome educator
button so just replace this one after adding it just come back to the web page now you can see here we
have the educated dashboard instead of become educator here we have the educator dashboard and if I click here
it will open this Local Host SL educator and you can see the text educator page now just come back so after creating
this section now just come back here in this figma design and you can see next we have to create this testimonial
section correct to create that we will come back to the vs code we will open this testimonial
section. jsx file and from here let me remove this title and here we will add one text in S2 tag so we will add
the text testimonials after that we have to add the description in P tag so here we will
add the description and in this one we have added this BR tag to add a line break
and uh after adding it we have to mount this component on homepage so let me just go to homepage
home. jsx and in this one you can see we have already added this courses section right so after this
courses section let's add testimonial section and close this
tag now just come back to the web page here you can see we have this title testimonials and this description
so next we have to add the CSS properties for this one and we will display the testimonial data from our
asset so if I go to sidebar go to assets assets. JS file so in this one we have
this dummy a student enrolled and uh before that we have this dummy dashboard and here we have the dummy testimonial
so in this one we have this aray and in this aray we have have multiple object that have the name role image
rating and feedback text so we will display this in the testimonial section using this dummy testimonials data so
let me come back to the testimonials section. jsx file and first we will add the CSS
properties so first in this div we will add the class name and let's provide classes padding bottom padding X and for
medium and above a screen we will add padding x0 after that we will add the CSS properties for the main title so
just add the class name and provide the CSS properties text 3 XL font medium text Gray and 800 after that for this
small description we will provide the class name and here we will provide the text base
for medium and above a screen size then text Gray 500 and margin top after that we have to display the
testimonial data in a div so in this div we will display the testimonial data so just add the curly Braes and we will
use dummy testimonials so you can see dummy testimonials has been imported from Assets Now this is an array so we
will use the map method and on this map method we will add the arrow
function here we will add the parameter that is individual testimonial and index number so just add testimonial and index
and here we will return uh div now in this div first we have to add the key
property and in this key we will add index after that in this div we will add another
div and here we will add the image tag for the users image so let's add the IMG tag
and in this SRC we will provide testimonial dot
image and uh here we will add the alt property so in this alt property let's add
CES testimonial. name after that here we will add another div within this div we will add
the users name in H1 tag so here let's add the users name using this testimonial. name
and after that we will add the small text in P tag and here we will display the users's role so we will add
testimonial. rooll after closing of this div here we will create another div and in this one
we have to display the star rating so here let's add one da
in this one we will add the curly bres then we will add aray and we will add spread operator
array and we will add five here we will use map method and here let's add underscore
comma I we will add it in this parameter of an arrow
function in this Arrow function we will return the image tag and in this image we will add the
key property where we will add I after that we will add the image SRC
so here also we will add the same thing that we have added added in the course card so just add car bres and
provide this one I less than math. flow testimonial. rating assets star and assets star
blank and here we will add a star after that for this image we will add some classes so just add the class
name and here we will add the height five after this start rating we have to
display the review text so just add the P tag and in this one we will add
the testimonial feedback like this and here also we will add the class name so in this one we will add
the text color gray 500 and margin top here you can see we have this div in this one we have added all the start
icons so here just add the class name and we will provide the the flex and we will provide Gap and in the parent div
we will add the class name and in this one we will add the padding and then padding from
bottom next we will add the CSS properties in this text where we have added the role so just add the class
name and we will add the text Gray 880 then we will add the CSS properties in the text where we have added the name
so just add the the class name and provide text large font medium and text Gray
800 after that here we have added the image tag so in this image also we will add some classes so just add the class
name and in this one we will provide the height and width then rounded full so it will be a
circle after that in this parent div we will add some CSS properties so here let's add the class
name we will provide the flex item Center Gap then padding X padding y background gray
510 now in this div where we have added the key property we will add some classes so let's add the class name and
in this one let's add text a small text left border border
gray 530 padding bottom rounded large then background white after that we have to
add the shadow so here we will add Shadow and in this one we will add the
custom value for the shadow so we will add 0 pixelcore 4 pixel
underscore 15 pixel underscore 0 pixel after that we'll add overflow
hidden here we have to add the shadow color also so here just add Shadow
black/ 5 now save the changes and come back to the web page
scroll down so here you can see we have these reviews in the testimonial section
right we have to add the CSS properties here to align it in same horizontal line so just come
back so in this div we will add the class name and we will provide grid then grd columns Auto that we have
already used in the courses section then we have added gap eight and margin top 14 save the changes
and come back here so now you can see it is looking good but we have some white space here and it is aligned in the
right side so let me just correct it and if I come back here in this design you can see we have to align it like
this to do that just come back here in this file we have added everything in this div so so we have to
move this part outside of this div so let me just cut it and we will paste it after
closing of this div like this now save the changes and come back
here now it is looking good right but the icons are not displayed that is the review icon so just come
back here we have added this assets. a star but we have not imported this assets so let me add assets click here
so now this assets has been imported from assets file now save the changes and come
back it should display the start icon now but it is not displaying let's come back
here we have closed this areay here so let me just remove it and we will close it here after
this five bracket like this update this one save the changes and come back here so now we have these start
icons and after this feedback text we have to display one link so just come back and uh here we have
this review description then we have this closing div tag and after that here let's add one a tag
and we will add the hashtag here and in this one we will display the link text that is read
mode like this now here we will add some CSS properties so we will add the class name and in this one we have to add the
text blue 500 underline and padding X save the changes and come back here so now we have completed this testimonial
section also after completing it we will come back to the figma design and scroll down so here
you can see we have to create this call to ation section to create that we will come
back and from this left side word we will open this call to a. jsx
file and in this one here we have this text just remove it and instead of this one we will add the H1
text and here we will add this title learn anything anytime anywhere after that we have to add a small
description in P tag so we will add the P text and write this a small description after that we have to
display two buttons so we will add one div and in this div we will create two
buttons so so let's add one button tag and in this one we will add the button text get
started after that we'll add one more button so just duplicate it and in this one we'll add the button text learn
Moree but with this second button we will add the icon also so after this learn mode we will add the image
tag and in this image we will add the SRC that is asset dot Arrow icon after that in this alt
property we will add Arrow icon after adding it we will come back
here in the home do jsx file we have to mount this component so we will open home. jsx and after this testimonials we
will add call to X and close this one so this call to
action has been imported after adding it just come back here so at the bottom you can see this a
small title description and this get started and learn more text so we have to add the CSS properties for this one
so just come back and we will open
this call to action. jsx file and here we add some CSS properties for the first div so in this first one we'll add the
class name and here we have to provide Flex Flex column item Center Gap four padding top padding bottom padding X and
for medium and above a screen We'll add padding x z after that for this title that is in the H1 tag we will add the
class name so for this one we'll add the text Excel and for medium and above screen we will add the text for XEL
after that we have to change the text color and font weight next we'll add the CSS properties for this description that
is with the P tag here we will add text colored and then for the smaller screen we will add text
small after that we have to align these buttons so for this parent we will add the class name and here just add
Flex item Center font medium Gap six and margin top next we will add the CSS properties
for the buttons so in the first button we will add the class name and here we will provide padding X then padding y
then rounded medium text white then background blue 600 now for the second button just
add class name and here we will add the flex item Center Gap two that's it after adding it save the changes and come back
to the web page now you can see this call to action section is looking good and if I come
back to figma design you can see it is exactly same correct so after creating it next we have to create the footer of
our application so in the footer you can see we have to add the background color then we'll add three columns and in the
first one we'll add the logo and a small description then in the next one we'll add some menu items then in the last one
we'll add this text and this email subscription form and at the bottom we will add this copyright message so to
create this footer we will come back to vs code and from this left side bar we will
open footer. jsx file in this footer. jsx file let me remove this text and here we have this div so let me convert
it in footer tag and here we have this closing footer tag now in this one we have to create a
div where we will create three columns and after this D we will add the copyright text so here we will use the P
tag to add the copyright message so here I'm going to add the copyright message copyright 2025 at greatest tag
all right reserved and within this div we have to create three columns so let's create the div for the First
Column so in this div we will create First Column let me duplicate it so we have total three div tag now in the
first one we have to add One logo so here we will add the IMG tag and to add the logo we will add gly
bres assets assets is not coming in the recommendation so let me open this and after that we will come back to
the footer and if I write assets so we are getting these suggestions so this assets has been
imported after that here we will add the name of the image file that is logo dark then we will add the alt tag so in
the alt we will add the text logo after that below this logo we have to add one small description so I'm going to add
this description here so this is the content for the First Column so let's save the changes and we
will add the CSS properties for this footer so in this footer we will add the class name and and for this footer we
have to add the background color so we will add background gray 900 then we will add the
padding X text left and width full and margin top now here we have this div where we
are adding different columns so for this div we will add some CSS properties so in this one I'm going to add
Flex then Flex column for medium and above a screen we'll add Flex row then we have added items to
start padding X justify Center Gap 10 then Gap 32 for medium and above screen then we have padding y border bottom and
Border color white sl30 that's it now here we have this div for the First Column right where we have
added the image and text so in the first one we will add class
name Flex Flex column and for medium and above a screen we will add items a start then items Center and width full that's
it save the changes now we have to mount this component on homepage so we will open home. jsx
file and after this call to action let's add add footer select it so this footer has been
imported now close this tag save the changes and come back to the web page and now you will see this footer on this
web page so you can see here we have this logo image and we have this text in black color then we have this copyright
message also correct now let's come back and uh we will come to footer. jsx file so here you can see we have this text in
P tag so in this text also we will add the class name so here we will add the margin from Top then text Center then
for medium and above a screen We'll add text left text size will be a small and text color is white
sl80 now save the changes and now you can see this text clearly because it is in the white color
correct after that we have to change the color of this copyright message also so just come back and in this P tag we will
add the class name and here we will add some padding from y AIS after that we will add text Center then text size will
be extra small and for medium and above screen We'll add the text size a small and the text color is white/
60 now if I come back you can see this copyright text is also looking good and it is in the
center correct now we will come back and we'll add the content in other columns so here we have the div for the second
column and the second column will contain the list of menu items right so here in this div we will add one text in
S2 tag so the text is company after that we will add the UL tag and in this UL we will add the LI
tag and in this lii we will add the a tag and here we will add the hdf hashtag and here we have to add the link text
that is home now we will duplicate it and we will update the link text so the second one will be about us then in
the next one we will write contact us and then we will add privacy policy let me remove the extra Li
tag correct after adding it if I come back here you can see we have these content in the right
side it is in the black color so we have to change the color correct so just come back and here we will add the CSS
properties for this div so for this one we will add the class name and in this one also we will add
Flex Flex column and for medium and above we will add items to start then item Center width
full now for this title that is in the S2 tag we will add the class name and we have to add
the font weight that is semi bold then text will be white and margin bottom after that in this UL tag we will add
the CSS properties so in this UL we will add the class name and provide Flex for medium and above the screen we'll add
Flex column then width full justify between text will be small then text will be white then for the medium and
above screen we will add a space Y2 after adding it save the changes and come back to the web page now you can
see this second column is looking good with this title and these link text correct now we will add
the content for the third column and the third column will be hidden in a smaller screen it means it
will be hidden on Mobile screen and it will be visible on medium and above screen size so just come back and here
we have this div for the third column so here in this div we will add the class name and here we will add hidden
so by default it will be hidden then we'll add medium flex so on the medium and above a screen it will be
displayed with display property Flex after that we'll add Flex column items to start and width will be full now in
this one we have to add one title in h2 tag so in this title we will add the text called subscribe to our newsletter
and here we will add the class name so in this one we have to add the font weight semi bold then text white and
margin bottom after this text let's add the description in P tag so here we will add
this description and with this we will add the class name also for this P tag so in this one we have to add the text
size that will be small and then text color white 80 correct if I come back here so you
can can see this title and a small description in the third column after that we have to add one form where user
can enter the email ID and there will be one button called subscribe so just come back and after
this description that is in the P tag here we will add one div and in this div we will add the input field and the
input type will be email then we will add the placeholder and in this placeholder we
will add the text called enter your email like this after that we have to add one button also and in this button
we will add the button text subscribe like this if I come back here you can see here we have the input field
and here we have the Subscribe link now just come back and we will add the CSS properties so first we will add
the CSS for for this div so we'll add the class name and provide Flex item Center Gap two and padding from Top
after that we'll add the CSS properties in the input field so here we have this input field so in this one we will add
the class name so let me come to next line and provide the class name and here we will provide border border gray
500/80 then background color will be gray 800 then text color will be gray 500 then placeholder gray 500 then we'll
add outline none width height and rounded so that the corners will be round then we will add the padding X and
text size will be small next we have to add the CSS properties for the Subscribe button so
in this button we will add the class name and provide background blue 600 then width and height then text color
will be white and and Corners will be rounded save the changes and come back to the web
page now you can see this email subscription form is looking good with this input field and subscribe button so
now we have completed this footer and with that we have completed our homepage of our this LMS website correct after
that we'll create the other page so if I come here and click on this so all courses so you can see it will open this
course list page so now we will Design this course list page for that let's come back to the figma design and if I
move this this is the course description page and here we have this course list page
so we are going to design this page where we will add the navigation bar it is already
there then we will add this text and this search box and then we have this course card right so we will create this
page for that let's come back to the vs code and from this left side bar let's open
pages and in this Pages we will go to student and from here we will open courses
list this one in in this courses list page we will remove this div and here we will use
this fragment right now in this one let's add one div and
here we have to add another div so in this one we have to add one title so we will add one title in H1 tag
and and the title will be course list and after that we will add one small text in P tag so here we will add
the P tag and in this one we will add home and with that if I come back to the figma design you can
see so here we have this course list and after this course list we have this home/ course list so so it is looking
like a bread crumbs so just come back and here in this P tag where we have added home so after this home we have to
add slash and after this slash we will add course list
again like this now we have to change the color of this home text so here we will add the
span tag so let me move it in the new line and here we will use span and close it here after this
home let's wrap this course list also in the span tag so we will add this opening tag here and closing
tag here now in this P we will add the class name to change the text color so we will
add text Gray f 500 like this after that here we have this a span tag for home text so in this
one we'll add the class name and here we will add the blue color of text so we will add text blue 600 and cursor
pointer now when we click on this home text it will redirect us to the homepage for that we have to add the on click
property and we need the navigate function so we have already created the navigate function in the context file so
we will import it from Context right so here before this return statement we will add
const C asss navigate and use this use context
hook so use context has been imported from react now in this one we have to provide the app context
so app context has been imported now we can use this navigate here when we click on this home so in this asan tag let's
add on click and here let's provide the Aro function and provide this navigate and
in this one simply we will provide the path so let's add slash so it will take us to the homepage if I come back to the
web page here you can see we have the this course list then we have home and course
list and if I click on this home we are back to the homepage and if I click here we are back to the course list page
correct now in the right side we have to add one search box like this correct so we have to group this one in a div and
in the right side we have to display this search box so just come back and we will group this one inside a
div so here let's add div tag and move it inside this one and after closing of this
div here we have to add the search box so we have already created the component for the search bar so we will use that
component so just add search bar select from this suggestion so this search bar has been
imported right and close this tag now if I come back here we have this search bar also right now suppose we add
some keyword in this URL like this like JavaScript here in this URL then we have to pass this keyword in this search box
as a props so here we will add data equal to and here in this one we
have to provide the input data so we will get the input data from the URL for that here let's
add const then we will use input and we will use this use padm
hook and that's it so we will get the input from the URL parameter and we will pass it here in this search bar that's
it after adding it next we'll add the CSS properties for these div so let's start
with the first one and here in this first one we will add the class name and in this one we will
provide the position that is relative then we will add the padding X then padding top then text left now
for the second div we will add the class name and here we will add the Flex box CSS so just add Flex for medium
and above screen we will add Flex row and then Flex column Gap six items start justify between and width
full now for this title also will add the classes so just add the class name and in this one we have to increase the
font size so just add text for Exel font will be semi bold then text color will be gray 800
now we have this text in P tag so here we have added the class name and then we have this as span tag so
now we have added the CSS properties for this now just come back to the web page and you can see we have this text in the
left side and in the right side we have the search bar correct after that we have to display
the course card right so to display that just come back and uh here we have this search bar so after closing of this
div here let's add another div in this one we have to display the course so first we need all courses so
we will get all courses from our app context right so here just add the comma and write all courses that we have
already created in context file now we can use this all courses to display the course here using the the course card so
in this one let's add curly bres provide all courses and on this one we will add the map
method and here we will add the arrow function and it will return the course card that we have already created the
course card component so just add course card so this component has been imported
right now in this one we have to provide some props so just add the key property and in this key we have to add the index
number that we will get from this parameter so in this parameter we will add course that will give the individual
course then we will add the index and in this key we will provide Index
right after that we will add the course and here we will provide this course that's it now save the changes and come
back to the web page so here you can see we have all these courses on this course list page correct next we have to add
the CSS properties for this one so just come back and here in this div we will add the grid layout right so here let's
add the class name and provide grid GD column 1 then for small and above screen we will add GD column 2 then then for
medium and above screen we'll add grd column 3 then for large and above screen We'll add grd columns 4 then we have
margin y Gap three then padding X and padding zero for medium and above screen save the changes come back to the web
page so you can see all the course cards are aligned like this correct so right now we are
displaying all the courses now suppose we add any keyword in this field and click on the search button or we have
the search keyword in this URL right so in that case we have to display the filtered course right so we have to get
the filtered course data so just come back and here we will create a function that will filter the course and we'll
create one state variable also that will store the filtered course list so just add con and here we are creating the
estate variable so write the name filtered course and here we will add the setter
function set filtered course and here we will initialize it so just add user
state so it will be a state variable and initialize it with UT array like this after that we have to add the
course data in this filtered course so here let's add use
effect right and in this use effect we will add the Aro function and with that we will add the
dependency aray and in this dependency aray we will add this all courses so whenever all courses will
be changed then it will execute this function in this one we will add one more data that is input so whenever the
input will change then also it will execute this Arrow function right now in this Arrow function we will add the
logic to store the filtered data in this state variable so here first we'll check if we have all
courses and with that we have all courses do length greater than zero so just add all coures do length greater
than zero so in that case what will happen we have to create a
temporary variable so just add const and write the variable name temp courses and in this one we will add this
all courses dot slice like this after that we will check so just
add the turn operator and we are checking if we have the input right if we have the input then we
have to filter the data using this input keyword and if we don't have the input then we will simply store this temporary
courses in filtered course so here we'll add the logic for the filter and uh after that we will add this column so if
we don't have the input in that case we will simply use this Setter function set filtered
course and in this one just provide this temporary courses right and between this question mark and colum we will add
the logic to filter the data using this input field so here let's add this Setter
function set filtered course in this one we are going to use this temp course that is the temporary
courses list right so in this one we'll add the filter method now in this filter we have to add
the item as a parameter and uh here we'll add item do course
title then we have to convert the course title in lower case so we'll add two lower
case and then we'll add dot includes so if the title includes our
input keyword so just add includes and in this one we'll add input and we will convert the input field in lower case so
here also we will add two lowercase so if the course title contains the input keyword then that
course list will be filtered and it will be stored in this filtered course State using this seter
function right so now we have this filtered course so we will use this one here so instead of adding this all
courses we will use filtered course now if I save the changes and come back to the web
page still you can see we have same courses right but if I add some keyword in this search box so we will add
python click on search so now you can see we have only two courses that have the python keyword in the title correct
so this filter is working fine but right now here we have to add one text that will display the search
keyword and we will add the cross icon also that will remove the filter for that just come
back and before this do here we will add the space and here we will add curly brushes and here we will add one
condition if we have the input so just add input so when we have this input then
only we will display this div now in this div we have to display the
text that we have added in the input field so just add the B tag and here we will add the input value right after
that we'll add the cross icon so we will add the IMG tag and in this one we have to add the
file path so just add assets dot cross icon and uh in this one we'll add the
class name also so just add cursor pointer and when we click on this cross icon it
should redirect us to the course list page that is the same page right so here we'll add the on click also so just add
on click and in this one we will add the Aro function and in this addo function we
will return the navigate function and in this navigate we have to provide the path so just provide the
path called course list now here we have this div so in
this div we will add some CSS properties so just add the class name and in this one we will
provide inline Flex item Center Gap 4 padding X padding y border margin top then margin bottom minus 8 then text
Gray 600 that's it save the changes and open the web
page so here you can see we have the keyword that we have searched so we have this python here and then we have this
cross icon and if I click on this cross icon now we have all the courses right after that if I add another term
in this search box so let's add Cloud click on search so now we have the course that contains the cloud text in
the title and if I click on this cross icon again we have the all courses and if I add this here in
this search bar if I add JavaScript pressenter now you can see we
have this JavaScript course on this filtered result and here we have the cross icon to display all courses again
correct so after adding all the course card on this course list we have to display the footer also right so to add
the footer we will just come back here and uh before this closing fragment we have to add the footer component so
here just add footer we will click here so this footer has been imported right after
that just close this tag save the changes and come back to the web page so now you can see here we have this footer
also so we have completed our course list page also it is looking good and if I click
on any course like let me click on the first one so it is opening this course Details page so next we have to design
this course Details page and if I come back to the figma design and move here so this is the course details or Course
Des deson page so we will Design this page for that we will come back to the vs code to create the course Details
page we will come to left side bar and from here we will open this course details. jsx file and in this one we
will display the details about the particular course so let me just come back to the website again and when we go
to this course Details page you can see in this URL we have this path SL course and then we have the course ID
right so we have to find the individual course using this course ID so just come back to the vs code and here before this
return a statement let's add const ID and we will get this ID
from use patterns so this use patterns has been imported from react router Dom so now we have this course ID after
getting the ID here we will add one state variable where we will store the course data so just add
con and write the state variable name that is course data then we will add this Setter
function set course data equal to user
State and we will initialize it with null like this after that we have to get all
courses data that we have already stored in the context file so let's add
con all courses we have all courses in context file so just add equal to use
context and in this one we will provide app context so now we have all courses then we have the ID and using this ID we
will find the particular course from this all courses here we will create the function
to fetch the individual course data so just add const and the function name is fetch course
data equal to as sync it will be a synchronous function and we will create this Arrow function now in this one we
are going to use the all courses and here we will add the find method and here just add the arrow
function with the parameter course and on this course we will find find the ID so just add course doore ID
and we will check if this ID is equal to the ID that we have added here so if this ID is matching then we will get the
individual course so here we will store it in a variable so here let's add const find
course equal to this one now we will set this variable in the state variable that is the course data for that we will use
this Setter function so here we will add set course data and provide this one now we have to execute this function
whenever this component gets mounted for that here we will add the use effect hook in this one we will add
the Aro function and with that we will add the dependency areay that is an empty areay and in this one simply
execute this function fch course data so now we have the course data and now we can display the course data on our
website so to display the course data on this website here we have this div so let me remove the text from this div and
in this one we have to create two columns so here let's add the comment left
column duplicate it and it will be right column like this
now in the left column we will add one div and in the right column we will add another div like
this correct now in this first div we have to add the CSS properties that will align the child div in left and right
column so here we will use the flex box so let's add the CSS properties Flex then Flex column Reserve then Flex
column reverse then for medium and above a screen we will add Flex row then Gap relative item start justify between and
padding X padding top and text left after adding it we have to add the gradient color below the navigation bar
for that here we will create a div and in this one we'll add the CSS properties that will add the gradient color so here
let's add absolute top left width full height section height then Min - Z minus 1 then
background gradient to bottom and this color code like this after that if I come back
here that color is not displayed here because here we have added our custom class name that is section height
so we have to add the custom class name in our telin config file so let's open this telin config.js file and here we'll
add one more CSS property that will be spacing so after this gr column let's
add comma and here we will add spacing right column and create one object so in this object we will add
the custom name that is section height and here we will add the height of 500 pixel save the changes and come back to
the web page now you can see below this navigation bar we have the gradient color now it is looking good so again
come back here and uh just come in this file that is course details do
jsx so now we will add the content in the left column that is here in this div so in this div we have
to add the course title so we will add the title in H1 tag and to add the course title simply we will use this
course State here we have course data State let's add it here and from this course data we have
to find the course title so just add course title like this if I again come back
here go to assets open assets. JS file so here you can see we have dummy courses and in
this one we have this course title right then we have this course description and in this description we have this h2 tag
P so this is the rich text then we have the course price discount then course content and in this
course content we have the chapters and within this chapter we have the lectures so we have to display all these data so
again come back here and here we are displaying the course title right after that we have to
display the course description also so just add the P tag and uh in this one if I simply add this
course data then course description and come back to the web
page it is not working we have some issues so just come back and first we have to add the terity
operator in this return right because it will take some time to fish the course data right right
so until the course data is not loaded till then we will display a loading screen so here let's
add this course data after
this return and then add the question mark So if we have the course data then
only this will be displayed and uh here we will wrap it in a fragment let's close this fragment
here correct now at the end here we have the closing bracket right so after that let's add colon and here we will Mount
our loading component you can see in the left side bar we have created this loading. jsx so we will Mount this
component it is not giving the suggestion so we will open this file and come back
here now if I type loading so we have the suggestion and we have mounted this loading component now if I come back
here you can see we have this loading text but still it is not displaying the course details so let me just come back
to the homepage and click on this one let's click on the first course card so yes now we have this course title
introduction to JavaScript then we have this course description but in this course description you can see it is
displaying all the HTML tags like H2 P UL Li right so we have to hide these tags we will just display the text and
we will display the text up to 200 character for that just come back and
here we have added this P tag so from this P tag we will remove this
and here in this P tag we will add the dangerously set inner HTML here we will add another curly
Braes and then write double uncore HTML colum and then we will provide the course
data dot course description so it will hide all the HTML tags after that we have to display only
200 characters so just add slice method and here we will provide 0 comma 200 that that's it now just come back to
the web page and here you can see we have this course title and small course description right next we have to add
the CSS properties for this one so just come back and let's add the CSS properties for the left column so in
this left column we will add class name and we will provide Max width Xcel Z10 text Gray 500
after that we will add the CSS properties in the title so here just add the class name and provide this class
name text course details heading large then we will add text code details heading a small then we will add font
semi bold and text Gray 800 so right now you can see we have added the custom classes that is course details heading
large course details heading a small right this course details hitting a small will
be applied for the smaller screen and for medium and above a screen this class name will be applied so we have to
Define these custom classes in the telin config file for that let's open the telin config file
again and uh in this one we will add one new property that is font size so you can see we have already declared
that font size and here we have added course details heading a small heading large so we don't have to add again we
have already added so just come back now you can see this course title and description is looking
good now again come back and for this description we will add some CSS properties so here we have this course
details. jsx file so in this P tag we will add the class name so let me move it in the new line and add the class
name so here we will provide padding from Top then text base and text
small so here we have this description after this description we have to display the course rating right so just
come back and uh here after this P tag we have to display the course rating so let
me add the comment here review and rating so to display the course rating
we will just come back to the course card component so let's open this course card where it is it
is in the company comp course card right so in this course card you can see we have already created this
component to display the ratings right so here we have this component and in this one you can see we have added this
course. educated. name but right now we don't have this educated name details in the asset file so we will add the manual
data here so let's add one hardcore data we will add Greatest Tag if I save the changes and come back
to the homepage now we have this instructor name greatest tag so we have added the
same instructor name for all the CES we will update the instructor name when we will connect it with the database so now
just come back and here we have this course rating so just copy this one and we will come back here in this
course details. jsx file and paste it here after adding it you can see here we are using this calculate rating so we
have to import this calculate rating from the use context
so just copy this one and in this use context we will provide this calculate rating after that you can see
here we are using this course so instead of this course we will use our state variable that is course data so just add
course data then here also we have this course so we will add course
data then here also we will update course data after updating it we will come back
to the web page open any course so we have some issues let me check or just come back here and you can
see here we are using this assets so we have to import this assets also so just
add assets and you can see this assets has been imported right now if I come here and open any course you can see
here we have the average rating five then we have the starts then we have total number of rating so with this
total number of rating we have to display the text also like one rating two ratings five ratings for that just
come back and uh let's see where we have added here it is so here it is displaying the total
number of ratings right so after that we have to add the text called rating or ratings for that here after this closing
curly bres we will add another curly bres and in this one we will check if this length is greater than
1 then what will happen we will add the text so if it is greater than one then we will display
the text called ratings if it is not greater than one then we will display rating like this and if I come back here
you can see we have this message five then stars then one rating it looks
good after that we have to display the total number of students who has enrolled in this course so to display
the total number of uh students enrolled in this course here we will add another P tag so after this P we will add one
more P tag and uh in this P tag we have to display the total number of enrolled
students so we will add cly Braes course data enrolled a students. length so we will get the total number after that we
have to display the text called a student or a students so again add this one and here we will check if it is
greater than one then add question mark and colum and here we will display the
text so if it is greater than one then we will add a students and if it is not then we will add a student like
this and uh here we will update the text color so it will be blue
600 after after that here we have this course data and ratings so we will add it in one bracket so just add this small
bracket we will wrap everything in this small bracket now save the changes and uh come
back here so here you can see we have this one rating three students it looks
good now after that we have to add one text where we will display the instructor name so we will come back and
after this div so you can see this div is for this one where we have added Flex item Center so after closing of this
div we will add one P tag and in this P tag we will add the text called course by and then we have to display the
instructor name in different colors so we will add the span tag and in this one we will add the hardcoded name for the
instructor that is great tag right and for this text we will add different color so just add the class name and
here we will add the text blue 600 and underline after that in this P we will add the class name to decrease the text
size so we will add text a small like this and we have to add some a space also
so here you can see we have this D so in this T we will add some padding from Top then padding from
bottom and text a small save the changes and come back here so now you can see we have this ratings and course by greatest
stack and it is looking good correct next we have to display the
course structure like we have to display the course chapters and course lectures if I come back to the
figma design you can see here we have this course structure in this one we have to display the number of sections
number of lectures and total dation then we have to display this type of accordians where we will display
the chapter name and in this chapter name we will display these lectures name and in front of that we will display the
total number of lectures in this chapter then total duration for this individual lectures for that we have to create some
function that will calculate the total time duration and total number of lectures then we will display that on
the website so to display these data we have to create the function for that we will come to app context
from this left sideward we will open app context. jsx file and in this one let's scroll down and after completing this
function we will create another function so we'll add one comment let's write function to
calculate course chapter time so here let's add one function name const
calculate chapter time and create one AR of function so in this parameter we need
the chapter right so just provide the chapter here as parameter now we will add
let time time equal to Z after this let time Z here we will
add chapter dot chapter content in the dummy data we have added the chapter content and on
this chapter content we can use the map method and in this chapter we will get the individual lectures so let's
add lecture in this parameter and here we will return the time plus equal to and here just add
this lecture dot lecture
duration like this so now we will get the time and this time will be in the minutes so we have to convert it into
hours and minutes format for that we will use the humanized duration that we have already
installed so first we have to import it so a scroll up and here we will add import we will import the humanized
duration from and provide the package name humanized duration after importing we can use it
here so here let's write return so it will return the humanized duration and here we have to provide this
time right and in this one we will multiply by 60 and again multiply by 1,000 then in this one we have to
provide the second parameter so in this one we will add units and in this units we will add one
array and this array will contains hours and minutes so just add H
and M that's it so this function will return us the chapter time when we pass the chapter in this function after that
we'll create one more function so here let's write the comment function to calculate the course
duration so it will give the total duration of the course that will include the duration of each chapter right so
here we will add that function so we will add const and write the function
name calculate course duration and we will create this function and in this one we need the
particular course for which we want to calculate the total course duration now we will add the times so just add let
time equal to Zer and after that we will add this course and in this course we have the
course content right so just add course content. map method so it will give the individual
chapter so here let's add the Aro function and here in this one we'll add the chapter
now each chapter has multiple lectures so here we will add this chapter and in this chapter we have the
chapter content and on this chapter content we will use the map
method so in this map method again add the Aro function so let's add this one and
here we will add the lectures because each chapter contains multiple lectures right so just add lecture in this
parameter and here it will return the time plus equal to this lecture dot lecture
duration after that here we will return the total dation using this humanized dation
right so we will just copy this one let's copy it and paste it
here so here also we will get the total time in hours and minutes after that we will create one
more function that will calculate the total number of lectures available in the course so just add the comment
function to calculate number of lectures in the course after that let's add the function
name const calculate number of lectures and uh here we will provide the arrow
function and in this parameter we need the particular course right so just add the course here and
uh in this function we will add let let total lectures is zero suppose the total lecture is zero
so we have iniz the variable with zero after that we will add the lectures in this variable so just add course
dot course content and here we will add the for each in this one we will add the
chapter and create the arrow function now here we will add if and then we will add the
array dot is are [Music]
a then we will add the chapter dot chapter content then we will add the total lectures
here and it will be plus equal to the chapter dot chapter conent do
length so what will happen it will add the length that is the chapter length of this chapter so in this chapter suppose
we have two lectures so the first chapter length will be true so like that it will add all the chapters length
after that here we will add return so it will return this variable
that is total lectures that's it so we have created the function to calculate total number
of lectures then a function to calculate total course duration and one function to calculate
the individual chapter time right now we will pass all these using this value object so that we can
access it in any other component so we will copy this and paste it here let's copy the second
one paste it here and uh let's copy this one calculate chapter
time and paste it in this value object so here we have added this calculate number of lectures calculate
course duration and calculate chapter time now we can access it in our component that is course Details page
right so just open the course Details page again and here we need all these data
from the context so in this context we are getting this all courses and calculate rating so with that we will
get this data also so here let's add the comma and provide this calculate number of lectures calculate course duration
and calculate chapter time so we have this data now we can use it in our course structure
here after this P tag we will create one div so let's add one div and in this D we will add the space
from top and we will change the text color so just add class name and padding top and text Gray
800 after that we have to add the text in S2 tag so we will add the text called course
structure then we will add the class name for this text so in this one we have to increase the font size and font
weight so we will add text Excel font semi bold after that save the changes and
come back to the web page so here you can see this text course structure now just come back and after
this H2 we will add one div in this div we will add the space
from the top so we will add the class name padding top five now in this one we have to display
the course structure so just add the curly bres and here we will add the course data and in this course data we
have the course content and on this course content we will add the map
method in this course content we have multiple chapters so here we will get the individual chapter in this
parameter so let's add the chapter and with that we will add index and here in this one we will
return one div so let add the div and in this div first we have to add the key property and here we will add
this Index right now here we have to add one
div and in this one we will add another div here we will add the image tag and in this image we have to add the
icon so let's add CES assets dot down arrow icon after that we will
add the alt property and the alt text will be Arrow icon next we have to add one text so we
will add the P tag and in this one we have to add the title of the chapter so just add chapter do chapter title in the
curly Braes after adding it save the changes and come back here so you can see here
we have the get started with JavaScript that is the chapter name and here we have this
variables and data types this is also chapter name now in this chapter we have multiple lectures right so we will
display the lectures also and uh after closing of this div here we will add the time of this chapter so just add P tag
and in this one we have to display the chapter time so we will add the curly reses and here let's add
chapter dot chapter content and in this chapter contain we
will add length so so here let's add the text lectures after that we will add the Das
and here we have to display the time for that just add the curlys and we will use the function that we have just created
in the context file so let's add the function name calculate chapter time and in this one we have to provide the
chapter like this after adding it save the changes and come back to the web page so here
you can see with this chapter name we have the number of lectures it has two lecture and it has 35 minutes
duration right so in the second chapter we have two lectures and the duration is 30 minutes correct now we will add the
CSS properties for this one so just come back and let's start with this one here we have this div with the key property
so if in this one we will add the class name and here we will add the border and Border color then background white and
margin bottom and rounded after that here we have this div so here also we will add the class name
and uh in this one we will add the flex box so just add Flex item Center justify between padding X padding y cursor
pointer and select after that here we have this another D where we have added the image and
chapter title so in this one we'll add the class name and here also we need the flex so just add Flex item Center and
GAP two after adding the classes for this div here we have this P tag so in this P
tag We'll add the class name and in this one we have to change the font weight text size
and text size for medium and above screen after that here we have this P tag so in this one we'll add the class
name and in this one let's add text small and for medium and above screen we add text default save the
changes and come back to the web page so now you can see these chapter's name are looking good that is the chapter title
and we have the total number of lectures and and time duration and here we have the drop down
icon correct now within this chapter we have to display the lectures also right so
just come back and uh here we have this B tag then this closing div so after closing of
this div here we will add another div in this div we will add the UL tag and in this UL we will add the cly
presses and here let's add chapter and on this chapter we have the chapter content right so just add
chapter content and here we will use the map method in this one we will get the
individual lectures so just add lecture and with this lecture we will get the index number and create create this Aro
function now this function will return the LI tag that is list
item and in this Li tag we have to add the key property so here we will add key and provide the index
I after that here we have to add the image so just add the image tag and here let's add the file that is assets do
play icon after that in the alt property we will add play
icon after that here we will add some classes also so just add the class name and we will provide the width height and
margin from Top after this image we will add one div so in this div we have to display
the lecture title so we will add the P tag and in this one we will add lecture. lecture title in curly
Braes then we will add another div in this div we have to add one link that is preview if that lecture is
available for free preview for that here we will add the curly bres and we will add lecture
dot is preview free so when it is true in that case we will add the P
tag and in this P tag we will add the text called preview and uh after that here we will
add another P tag and in this one we have to display the total duration of this particular lecture so to get the
duration we will add the curly Braes and here we will get the duration using this lecture do
lecture duration but we have to convert this lecture duration in the hours and minute
format for that we will use the humanized duration so just add humanized
duration and in this one we will provide this lecture duration and then we will multiply it
with 60 and th000 after that let's add comma and provide the second parameter where we will add
the units and in this units we will add the aray and then we will add the H
and M for hours and minutes after adding it save the changes and come back to the web
page so now you can see here we have the chapter title then we have the lecture title that is what is Javascript
and then we have the second lecture setting up your environment and for this one you can see we have the preview
option and we have duration 16 minutes and for this one we have the duration 19 minutes so now we have to add the CSS
properties for these lectures so just come back and let's start with this
du so in this D We'll add the class name and here we will add overflow
hidden transition all then dation 3,000 after that we will
add Max height 96 next we have this UL tag so in this UL tag we will add the class name and
here we will provide the list dis then padding left then padding right
padding y- axis and then text color then we will add the Border top and Border
color after that we have this Li tag right so in this Li tag we will add the class name and here let's provide flex
and uh items start Gap two and padding y1 after that here we have this D right
so in this div we will add the class name and here let's provide Flex item Center justify between withd full text
color gray 800 then text small and for medium and over screen we will add text size that is
default after that here we have this div so in this div we will add the class name so in this one
we will add flex and we will provide the gap of two
right next we have this text in P tag where we are displaying the preview text so here
let's add the class name and in this one we will add the class name that
is text blue 500 and cursor pointer correct after adding it save the
changes and come back to the web page so now you can see these lectures title and duration are aligned in same
horizontal line and it is looking very nice and here we have this preview option
correct next we have to add the click functionality on these chapter title so that when we click here
it will collapse the description area that will hide this lectures and if I click again it
will again display these lectures for that let's come back a scroll up and before this return
a statement here we will create one a state variable so let me create it here
so just duplicate this one and here we will add the state variable name open section and the set function name is set
open section so using this state we will either open or close the chapter section
and here we will initialize it with empty object like this so we have added this a
state variable open section and set open sections and after that we have to
create a toggle function using that we can either close or open this one so here let's add one function
const the function name is toggle section and create the add function now in this one we need the
index and after that here we will use the setter function so just add set open sections and here let's add the Aro
function and in this one we will return one object and in this parameter we will get
the previous value so just add previous and here we will return this object and in this object we will add spread
operator previous comma and then we will add the index and colon we will provide not
of previous and index after adding it just come back to the section where we have created
this course title that is chapter title so here we have this chapter title
right here we have this div where we have added Flex item Center and then we have the cursor pointer select none
right so in this one we have to add the on click property so after this class name we will add the on click and here
we will use the arrow function and in this Arrow function we will provide our toggle function so we
will add toggle section and in this one just add this index like this so it will toggle the
section either open or close so to open and close the section we have to add the feature in
this chapter content where you can see we have added the minimum
height here it is we have this div with minimum height right so in this one we will add the
tary operator to apply the classes so let's add everything in the curly bres just add all classes in this curly bres
and instead of this single quote we will use the backx so that we can add the template literal so here we will add
this backx and uh here we will add back Tex like this now in this
one we have these classes and uh instead of adding this Max height 96 directly here we will use the template little so
just add dollar sign curly bres and here just add open sections and provide the index
and if we will add the question mark So if it is true then we have to display this
class name that is Max height 96 so we have to provide this class name if it is false then
we'll add this colum and here we'll add the height zero that is the maximum height zero so just add Max H and it
will be zero like this now save the changes and come back
to the web page you can see if I click here it should hide this but it is not working
so just come back here we have added this closing curly bres so just move it here after
this height zero now save the changes and come back to the web
page you can see these chapters are hidden and if I click on this chapter title then it will display
the lectures and if I click again it will hide the lecture if I click again it is displaying these lectures and if I
click again it will hide it let me click on the second one so you can see it is also working now when we hide or display
the lecture we have to rotate this drop- down arrow icon right so to rotate this icon we will come back
and let's see where we have added the icon so here we have this image tag right so
in this image we have to add the classes using the turn operator so in this image here let's add
the space and we'll add the class name in this class name let's add C bres and then add the back Tex and here we
will add the classes that is transform transition transform then we will add dollar sign cardly Braes and
here let's add the turn operator so here also we will add this open section index and if it is
true then we will add some classes and if it is false then we will add another class so when it is true we will add
rotate by 180 and if it is false we will simply provide the empty
string that's it after adding it save the changes and come back to the web page if I click
here you can see it will rotate this icon upward and if I click again it will rotate it downwards so you can see the
icon is rotating correct now after displaying this course
structure let's come back to the figma design and here you can see see we have to display the course description right
so to display the course description we will come back to the vs code and uh let's see where we are
closing this div here it is so here let's add another div where we will display the course
description so just add one div and in this one we have to add one text in S3 tag so just add S3 and here
let's add the text called course description right after that we will add the description in P tag so here if I
scroll up you can see we have already used the description here here it is so let me just copy this P from
here and paste it here so in this one we will update the class name so let's
add padding top three and remove this one and in this one here we are using slice 0 to 200 so
we are going to remove it because here we will display the complete description so just add this course description
correct after that we'll add the class name in this S3 tag so just add the class name and here let's provide text
that is Excel then font weight and text color after that in this div we will add the class name and here we will provide
the padding and text size a small and default right after adding it save the changes and come back to the web page so
you can see here we have the course description and then we have the complete description but right now it is
not formatted right so we have to add the format for these text for that we have to apply the custom classes so just
come back and here you can see we have this ptag so in this one we'll add one custom class name that is Rich Text for
this Rich Text we have to add the custom classes for that we will open in the index. CSS file so here we have this
index. CSS file and in this one we will add some custom CSS properties for that rich text
class name so let me paste these CSS properties you will find this
CSS properties in the asset file that you will download from the video description so just copy
these CSS properties and paste it here from the asset file right now in this one we'll add some extra properties so
here let's add atate layer
base and for this one we will provide the HTML SC scroll we have here smooth so the SC scroll will be smooth and
after that we'll add colon web kit scroll bar and for this
one we have to add display none so that the scroll bar will be hidden after adding it we will come back
to the web page and now you can see this course description is looking beautiful with this formatted data where we have
this heading then small paragraphs then we have the list items right so this course description is looking
good after that let's come back to the figma design and here you can see we have to create this right section
correct so to create this right section we will come back to the vs code and uh let's open course details.
jsx files so here you can see we have already added the comment right column and here we have this div so now we will
add the content in this div so in this div first we have to add one image that is the course thumbnail
image so just add image image and in this SRC let's add the curly braces and provide the course data dot course
thumbnail after that we have to add one div and in this div we will display other details of this particular course
so here we will add some space in the top so just add the class name padding top
five right now in this this one we have to add one D and here let's add the image in this
image let's add the SRC so just add assets dot time left clock
icon and uh in the alt text we will add time lift clock icon after that here we have to add the
width also so just add the class name and we will provide the width 3.5 after this image we will add the
text in P tag so in this one we'll add the 5 days
left at this price and we have to change the font weight of this text that is 5 days so we
will wrap it in the span tags so just add span and uh move it
here correct now in this aspan tag we will add the class name and provide the font
medium now for this P tag we will add the class name and here we will add the text color that is red
500 like this if I save the changes and come back to the web page so here in the right side you can see we
have the course thumbnail then we have this clock icon and this text five days left at this price so now we'll add the
CSS properties for the parent div so just come back and here we have this div so in this one let's add class
name and here we will provide Max width course card then Z index then
Shadow custom card we have to create this custom CSS in the telin config file to add the custom Shadow then we have
added the rounded then overflow hidden background white then minimum width right save the changes and if I come
back here here you can see the width of this course card that is the right side word is large so we have to add the
width so just come back here and you can see here also we have the custom class name that is width course card and then
we have this custom class name for this Shadow so we will add these classes in the telin config file so just open telin
config.js and here after this spacing object let's add the comma and here we will add the max
width in this one let's add column and create cre the object here we will add the class name course card and then
we'll add the value that is 424 pixel after that we'll add the shadow so
just add comma and here we'll add the Box Shadow column and then create the object and in this object We'll add
the custom class name that is custom card and here we will add the
value that is 0 4 15 2 and this color correct after adding this value
now just come back to the web page let's go to homepage open any course so you can see the perfect width
for this card and here we have the shadow also right after that let's come back and we have to add the padding here
so just come back here and open the course details. jsx file so here you can see we have added this padding top so
instead of this padding top we will simply add the padding five so you can see we have some space here correct now
just come back and here we have this div so in this one we will add the class name and here let's provide the flex
item Center and GAP two save the changes and now you can see it is aligned in same line
correct after that we have to display the codes price so just come back and uh here we have this div where we are
displaying the message that is 5 days left at this price so after closing of this D here we will create another
d right and in this one we will add the P tag and in this P tag we have to display the course price with the
currency so first we need the currency from the context file so here we have this app context right so in this one
let's add currency so we can use this currency
here so let's add CES currency and and after this currency
we have to display the course price so just add cly bres and in this one we will add course
data dot course price but in the course price we have to display the
final price after applying the discount so here let's add the course discount that is this one and in this one we will
multiply by course price and then divide it with 100 so just add slash 100 so now we will get the actual price and after
that here we will add it in the small bracket and then we will add dot to fixed and provide two after
adding it come back to the web page so here you can see the final price right next we have to display
the general price that is the normal price without discount so just come back and uh here let's add another P tag and
in this one we have to display the normal price so just add this currency and after this currency let's add the
curly Braes and here we have to display the course regular price that is course data doour price right next we have to
display the discount so just add P tag and in this P tag we will add cly bres course data discount
percent off save the changes and come back to the web page and now you can see here we have
this final price then regular price then we have the discount percentage next we have to add
the CSS properties for this one so just come back and let's add the CSS properties for this parent div so in
this one we will provide the flex then Gap and after that we will provide item Center and padding top now in this first
P tag we will add the class name and here let's add the text color then text size and font weight after that in this
second P tag we will add the class name and here we have to provide the text large then text color and line throw now
in this last P tag we will add the class name and here also we will add the text large and text color gray 500 save the
changes and now you can see this price area is looking good after that we have to add some
other information of this course like total number of lectures and total duration right so to display that just
come back and after closing of this div here we will create another div and in this div let's
add class name and here we will add Flex item Center then text small
then text default after that we will add the Gap and padding from top and then text color gray 500 in this one we will
add multiple divs so just add the first div and here we have to add one start icon so just
add image tag and then write assets dot star and in this alt tag we'll add start
icon after this we will add the course average rating so we will add the P tag so in this P tag We'll add
the function that is is calculate course rating so it will provide the average rating of this
course so in this one we have to provide the course data like this next we have to align these things in the same
horizontal line so here we have to add the classes so just add the class name and provide Flex item Center Gap
one correct after adding it if I come back here so here you can see we have the start and
the value five correct now just come back and here we will add one vertical line after this div so here let's add
the div in this div we will add the properties that will create a vertical
line so here just add the class name let me add the space here and here let's add the height
then width pixel then background gray 500/40 after adding it you can see here we have this vertical line correct so
after this vertical line again we have to display some data so again use this content just copy and paste it
here and here we will update the icon so it will be time clock icon and write the alt
text clock icon and here we will add the function that
is calculate course duration so it will display the total duration of this particular
course after that again we have to add the vertical line so just add this div and after that again we have to display
the data so just copy this div here and paste it here and in this one we have to add the total number of lectures so
first we will update the icon it will be time clock icon Let It Be and here we will add the function that will display
the total number of lectures so just add calculate number of lectures and here we will provide this course data and with
that here we will add the text called lessons save the changes and come back to the web
page so now you can see here we have this data that is average rating then we have the total duration of this course
and total number of lessons right and if I come back to this design file here you can see we have
these data here we have to update this icon also so let me just come
back and uh here we will update the icon here we will add assets dot lesson icon save the changes so you can see here we
have updated this icon right after that we have to display these details and we have to display
this button that is enroll now so if the user is already enrolled then we will display another message that is already
enrolled so for that we have to create one state variable so let me just come back to the vs
code and scroll up here we will create one state variable
so here let's write let me duplicate this line only and here we'll add the variable name or a state variable name
that is is already enrolled and this set function name is set is already enrolled and here we will make it
false so we will initialize it with value false now we will use this
data this a state to display different message in the button correct so now just scroll down where we have to add
the button [Music] so here
after this lesson we have this lesson in this div and uh then we have this div that contains all the details right so
after closing of this div here we have to add the button so just add the button tag and in this button tag we have to
add the text that will be based on the a state so just add the curly bres and we will add
is enrolled and if it is true then what we will display we will display the message that is already
enrolled and if it is false then we have to display the button text that is enroll
now correct now in this button we have to add some CSS properties so just add the
class name and here let's add the margin then width padding rounded then background color then text
white and font medium after adding it if I come back here you can see here we have this message enroll now and if I
come back and we will make it true and come back so you can see here we have already enrolled and if I make
it false so then we have this enroll now it works now just come back and scroll down
here after this button we will display some other description that will be displayed in all the courses right so
after this button tag here we will add one div and in this div let's add the text in P tag that
is what's in the course after that we have to display the content in list items so just add the UL
tag then Li tag in this Li tag we will add this text similarly we will add multiple
text in lii tag so let's add these text in Li tag after that we have to add the CSS properties for this one so first
We'll add the CSS properties for this div we will add the class name and padding top after that in the text we
will add the class name and we will add the text large and text Excel then font
medium and text color gray 800 after that we have the UL tag so for this UL tag We'll add the class name and
we will provide the margin from the left padding top and text a small then text default and list disk and text Gray
500 that's it after adding it if I come back here you can see this right side bar is
looking good Cod correct now we have to add the footer on this course description page right so just come back
and here we have this closing fragment right so before that here we will add the
footer select it from the S so the footer will be imported now save the changes and here
you can see at the bottom we have this footer it looks looks good so now we have completed this
course description page where we will display the individual course description and it display the course
structure also like chapter and lectures next we have to add the click feature on this preview link so it will
preview the video here at this place where we are displaying the thumbnail to display the review video at
this place we will come back to the vs code and here in this course details. jsx file here we will create one new
state variable so let me duplicate it and we'll write the variable name or a state variable
name player data and the setter function name is set player data and initialize it
with null so initially player data will be null right after that scroll down and uh
here we have added the preview link so here it is correct so in this P tag you can see we have added the preview so in
this P tag we have to add the on click property so that it will set the preview data so here
in this P tag let's add a space and in this P tag we will add the onli property and in this on click let's add
the Aro function now here we will add the setter function that is set preview data or set
player data let me come back here so you can see here we have added player data and
set player data so the state variable name is set player data so we will use this one here
set player data and here in this one we will add the object and in this object we have to add the property called video
ID and here we will add the value so it will be lecture dot lecture URL so just add lecture
URL we have this data in our assets if I open this assets so here we have this dummy course
data so in this course data you will find this lecture URL right so you can see in
each lecture we have this lecture URL so using that we'll display the video so in this video ID property we are providing
lecture URL and in this one we have to split after this slash so you can see here we have this U and in this one we
have this slash right so after this slash we will get the video ID so here let's
add lecture URL dot split and in this split just add slash
and after that we will add pop method that's it so when we click on this preview link it will set the
a state variable that is player data and in that one it will provide this video ID using this code right so after
getting the video ID we have to display the video in the right side so let's scroll down and here you can see we have
added this right column and in this right column we have this image correct so we have to replace this image with
the video so here we will add the space and here let's add the cly
addes and in this one we will check player data so if we have the player data then we will display the
YouTube video right and after that if we don't have the player data then we will provide this
image like this and before this colum and after this question mark we have to display the YouTube video for that that
we will use the YouTube tag that we will get from the package that we have already
installed that is react YouTube so let's import that we will add import YouTube
from the package name react YouTube Correct now we can use this to
display a video so here let's add the this YouTube
tag it will be self closing like this now in this YouTube tag we have to provide the video ID so just add video
ID and here let's add cly addes and we will get the video ID from player data
dot video ID right then we will add the options and here let's add curly
bres and in this one let's add clear variables so in this one we'll add the object and in this object we
will add the autop playay one so it will play the video automatically and uh after
that here we will add the iframe class name and in this if frame class name we have
to provide width and aspect ratio so the width will be full aspect video that's it so when we have the player data then
it will display this video and it will be autop playay and if we don't have the player data then it will display this
image now save the changes and come back here and now you can see this image here and if I open this chapter and click on
this preview link so now you can see it will start playing this video here but uh it is not removing this image so just
come back you can see we have added it at this place where we have added this
clock icon so by mistake we have added it here we have to add it here instead of this thumbnail image so here let's
add curly brushes and in this one we will paste this code like this and if we have this
player data then this YouTube tag will be displayed and
else we will display this thumbnail using this IMG tag correct now let me change it and here we will remove
this remove this curly bres remove this colum and that's it so in this div we have
this image that is the clock icon and after this clock icon we have this text and here we have this course
thumbnail right so either it will display the YouTube video or course thumbnail save the changes now come back
to the web page so you can see here it is displaying this video and if I go to homepage and open any other course
and click on this one then click on preview so you can see it will replace the thumbnail image and start playing
this video here so this preview is also working after that we have to create the
loaded screen right so just come back and if I open this course and refresh it you can see here we have this loading
text so we have to create a loading animation so just come back and from this left side bar we will open
this loading. jsx file right now in this one we have to create a loading animation so here let's add one
div now in this div we will add some classes so just add class name and we will provide width then width for a
small and above screen then aspect Square then border four then border color then border bottom and Border
top then we will add the Border full and animate a spin in this div we have added the class
name width 16 then width 20 aspect a square border four then border color gray 300 then border top then border top
color that is blue 400 then rounded full and animate spin after that we'll add the CSS properties in
this pent div so here we will add the class name and in this one we will add the minimum height that is a screen and
after that we will add the flex item Center justify Center that's it so we have created this animation effect after
adding this let's come back to the web page and here if I refresh this web page you can see we have this load animation
right but here we have one issue if I reload this web page you can see it is displaying loading animation but after
loading it should display the course Details page so that is not working so just come back
here and we will open course details. jsx file and in this one you can see here we have created this use effect so
in this dependency areay we will add all courses so whenever all courses will be changed then it will execute this fetch
course data save the changes and come back here so now you can see we have the course details and if I reload this
still it is displaying this course details so it is working fine so after creating this course
Details page we have to create this my enrollments page if I click here it will open this my enrollments so here we will
display the courses that any student has enrolled in right so to create that just come
back and from this left side part we will open a student folder and here we have
my enrollments do jsx correct and if I come back here you can see the same message my enrollments
page and here also you can see my enrollments page now now in this one we will create one title so the
title will be my enrollments that's it in H1 tag and after that we have to create one
table so let's add the table tag and in this one we will add the table head so just add T
head and in this this T head we have to add the table row so we will add the TR and in this TR we will add the table
headings so just add th tag so in the first one we'll add the course after that in this one we will
add some CSS properties so here let's add the class name and uh we will provide padding X padding y font we semi
Bol and truncate after that we will duplicate this one and uh in the next one we will add
the dation that will display the course duration after that we will add completed and in the next one we will
add the a status so first we'll display the course title and image then duration then
completed and after that we will add a status after that we have to add the data for this table
and after adding it if I come here you can see here we have these table headings right so for now
let me add the CSS properties for this one so just come back and let's start with the first div so let me wrap this
div inside a fragment so here let's add fragment and uh we will move it here
after closing of this div like this now in the first du we will add the class name so just add the class
name property and here we will provide the padding X then padding top after that we have to add the CSS
properties for the title so in this title we will add text to Excel and font semi bold next we will add the CSS
properties for the table so here we will add table Auto table fixed width will be
full overflow hidden and Border then margin from Top after that we have the table head right so in this T head we
will add the class name and provide text color border bottom then border colored and text small then text alignment left
and for Mobile screen it will be hidden after adding it if I come back here you can see this my enrollments
text and this table heading is looking good correct next we have to display the data of enrolled courses so first we
have to get the enrolled courses data for that we will create one state variable so we will create it in the
context file so just open app context and in this one here we have some State variables so
let me just duplicate this one and here let's add the state variable name enrolled coures and the seter
function name is set enrolled courses correct now in this state we have to add the enrolled courses data
but before that here we will add the initial values so we will initialize it with empty
aray now we will create a function that will add the data in this state so so here let's add one
comment we will add the comment fetch user enrolled courses and we will create the function
using const and the function name is fetch user enrolled courses and it will be asynchronous
function and in this one simply use the set function set enrolled courses and let me provide dummy course or dummy
courses so we have provided the data in this state right next we have to call this function whenever the component
gets loaded so in this use effect we will add this fetch user enrolled courses like this now we have to pass
this estate using this value object right so let me just copy this
one enrolled courses and set enrolled courses let me just copy this one only enrolled
courses and uh we will paste it here in this value object after that we will pass this
function also fch user enrolled courses in this value object so that we can access it in any other components so now
we have this enrolled courses data so we will get it in the my enrollments component or page so let's come back
here in this my enrollments and here we will get this data from the context so just add const here we will write
enrolled courses and we will get it from use context and in this use context we will
provide the app context so this use context and app context has been imported correct after that let's scroll
down and uh here after this T head we have to create the table body so we will use T body tag and in this T body tag we
will add the data so we will add cly bres let's write enrolled courses dot map
in this one we will get the Aro function and in the AR function parameter we will get
the individual course and with that we will get the index right now in this function we will
return the table row and in this table row let's add the key property so in this
key we will provide the index correct after that here we have to display the
table data so just add TD tag and in this TD we will add the image that will be course thumbnail
so here let's add IMG tag and we will provide the course thumbnail
so just add the curly blesses and write course dot course thumbnail after that here we will add
the CSS properties so just add the class name and provide the width for different
screen size after this image we have to display the course title and then we will
display the progress array so we will group it in a div so just add one div and in this div first we will display
the course title so let's write clys and here we will provide course. course title title
correct and after that we have to display the progress line that we will display after few minutes but before
that here let's add another TD tag so here we have this closing TD tag and after that let's
add another TD that is the table data and here we have to display the time that will be
the course duration correct so we have already created the function for course duration so we will import that from the
context so we will add calculate course duration and we will get it from the app context and we can use it here in this
TD so here in this TD let's add cly bres provide this function and here we have to provide the
course so it will return the course duration time correct after that here we will add another TD tag
that is table data and uh in this TD tag we will display how many lectures are completed out of total lecture so let me
write the manual value right now then we will make it Dynamic so here let me dite 4 out of 10 and in the span tag we will
write lectures like this and after that that we will create one more TD tag and in
this one we will add one button and in this button we will either add the text completed or ongoing if all the lectures
are completed then we will display the text completed and if some lectures are left and we have just started then we
will add ongoing so for now let me write ongoing after adding it if I come back here so so here you can see we have this
course thumbnail course title then we have the total duration 1 hour 5 minutes then we have
this completed lectures that is four out of 10 that we have added manually we have added the same thing and in this
status we have this ongoing so now we will add the CSS properties for this one so just come back and let's start with
this table body right so in this table body we will add the class name and we will
add the color then we will add the CSS
properties in the table row right so in this TR tag we will add the class name and provide border bottom then border
color then we have this table data right so in this one just add the class name and
provide padding X padding left then padding left for different screen then ping y then Flex item Center and a space
X3 next we will add the CSS properties for this div right so here in this div we will add the class name and
provide Flex one then we have this P tag where we are displaying the course title so in
this P we will add the class name and provide margin from the bottom and then we'll add the text a small all for phone
screen right after that we will add the CSS properties for this 3D tag where we have
displayed the course duration right so in this one we will add class name property and
write padding X padding Y and it will be hidden for Mobile screen after that we will add the CSS properties for the
table data where we have added the number of lectures completed right so in this one we will add the same CSS
properties that is padding X padding Y and Max SM hidden correct now we have this button in this table data so here
also we will add the class name and in this one we will add padding X padding Y and for Mobile screen it will be text
right that's it save the changes and come back here so you can see here we have
this thumbnail and course title aligned side by side and these contents are also looking good and this will be hidden in
phone screen and uh after that just come back and here we have this button tag so in this button also we will add some
classes so let's add the class name for this button and provide this padding then we will add the background blue 600
then we will add the text size and text color will be white so you can see this button is looking good correct after
that we have to add the progress bar in this one and with that we will add the value here in this completed section
right for that we will create one dummy data so we will come back here scroll up and uh here let's add con
and we will create the estate variable with the name progress array and the seter function name is set progress
array in this one we will add user State and uh we will initialize it with one aray and in this aray we will add some
dummy data right so let's add a space in this aray so initially we will add some dummy data and later we will
add the data from our database then we will build our back end so here let's add the data like this one we will add
multiple objects so let me add the first object and in this one here we will add lecture completed
and total lectures so suppose we have added the lecture two and total lecture is four then the progress were will move
to 50% right so like this we we have to add multiple object so let me add these
object in this progress are we have added the number of objects same as the number of courses that user has enrolled
right now after that we have to use this data here in this one where we are displaying
four out of 10 lectures right so instead of this manual value here we will add the data from that state
so let me remove it and here we will add cly Braes we will
add progress array and in this one we will add the index now we'll add the and
operator and here we will add back Tex and in this one we'll add the CES with dollar sign
now in this one we have to add progress array
index dot lecture completed correct after that we have to
add the forward slash and after this slash we will add the same thing so let me just copy
this and paste it here and instead of this lecture completed we will add total lectures like this after adding it if I
come back here that numbers are not displayed here so just come back here we have added
this square bracket let me remove it from here and we will remove it from end also like this so just connect this one
now save the changes and come back here so now you can see two out of four lectures here we have 1 out of five
lectures then three out of six lectures right here we have four out of four lectures correct now based on this data
we can update the button text suppose we have completed all four lectures then we'll display completed in this button
for that just come back and here we have this button text right so in this button text we will add
the data dynamically so here let's add a space and we will add
craes here also we will add this one Progress areay Index and operator then we will
add progress array index dot lecture completed divide by
Progress aray Index do total lectures and if it is equal to one right then what we will display we will
display the text completed and if it is not equal to one then we'll display ongoing so in this one we'll
add completed and remove this ongoing from here and add it here now save the changes and come back
to the web page so here you can see we have this ongoing ongoing ongoing and in this one where we have completed all
four lectures we have completed a status in this button correct now in this button we have to add the click
functionality so that when we click on this button it will open the player page where user can play that course right so
just come back and uh in this button we have to add the on click cck and in this on click we will add the navigate so
first we have to import the navigate from the context so here just add the comma and we will add
navigate so now we have this navigate from the context file and after that in this button we will add the onclick
property so here we have this button tag so here we will add on click and provide this Arrow
function and this function will execute this navigate function and in this navigate we have to provide the path of
our player page where user can watch the course so we will add slash
player and then slash and in this one we have to provide
the course ID so we will add course do code ID like this we have added this on click property after that save the
changes and come back to the web page if I click on this one you can see it is opening this player page correct and
click on this my enrollments so it will open this my enrollments page now we have to display one progress bar correct
to display the progress bar let's come back and uh if I open our package.json file here you can see we
have already installed the package RC progress right so using this progress package we will display a
progress bar so let me just come back here and in this one first we have to import it so here we will add
import and we will import line tag from from the package name that is RC progress so we have imported this
line tag now we will use this line tag to create our progress bar right so scroll
down and where we have this course title right so here it is after this course title that is in
the P tag here we will add one line tag now in this line tag we have to add
the a stroke width it will be two and then we have to add the percentage so let's add percent and in
this one for now let me add 50 and after that we will add some CSS properties so here we will add the class name and here
let's provide background that is gray 300 and rounded full after adding it if I come back here
here you can see all the progress bar is moving till 50% right because we have added the manual data 50% right but
instead of adding it manually we have to add it using our data that is displayed here right so
we will calculate the percentage according to the completed lecture and total number of lectures to calculate
that here in this percent let's write Progress aray Index and here we add if we have this
progress add index then in that case we will add bracket progress array index dot lecture completed then multiply by
100 then we have to divide it with progress array index dot total lectures so now we'll get the percentage
and if it is not available then we'll display zero or we have to move it
here like this so suppose we have this progress are a index then we will display the
percentage according to this data and if we don't have this progress add a index then we will display zero so it will
display 0% in the progress bar right after adding it let's come back to the web
page and here you can see this progress bar is looking good and it is displaying the actual value according to this
number of lectures correct so here we have completed all lectures so you can see
this progress part is moving till 100% right now in this page we have to add the footer also so just come
back and uh here before this closing fragment here we will add the footer so let's
add footer tag save the changes and now you can see on this page we have this putter also
correct so now we have completed this my enrollments page correct after that if I click on
this one so it will open this course page where user can watch the course so we have to design this page for that
let's come back and from this left side bar we will open this player. jsx that is the player
page here also you can see player page if I go to any code course click here so it will open this player page where user
can play that course so we will Design this page here in this player. jsx file in this page we have to create two
columns so in this div let's add one div that will be for the left column so let me write the comment
here this is for the left column now we'll create one copy of it and here we'll
write right column like this now we will wrap this entire div in a fragment so here we will
add this fragment and close it here so first we have this fragment then we have this div and in this one we have
left column and right column now for this D we will add some CSS properties so just add the class
name and here we will provide the padding for different screen size then we will add the flex Flex column reverse
then grid then grid columns two then Gap 10 and padding from xaxis after that we will come to the
left column so in this left column we have to add one text so let's add one text in h2 tag and here we will add the
text course structure right now for this one also we will add the class name and we will add the text size and font
weight now for the left column we will add the class name and here we have to change the text color that is text Gray
800 right now if I come back to the web page here you can see we have this text course structure so in this left side we
will display the course structure and in the right side user can play the video so just come back and in this left side
we have to display the course structure that we have already created in the previous page that is course Details
page so if I open this course details and here you can see we have created this course
structure right and after this title we have this div where we have added all the course structur code so we will copy
this entire div from here so just scroll down and it is closing here so from here we will copy this div and paste it in
our player. jsx file after this title so let's paste it
and from here we have to update some data so let me move it in the left side like this so let's check one by one here
we have added course data do course content so we will display this once we have the course data so first we need
the course data so here we will create one estate variable so before this return here we
need enrolled courses so we will get the enrolled courses from the context and with that let me import
the chapter time so we have created the function calculate chapter time and we will get it from use
context and in this one we will add the app context after that for this course we
need the course ID so if I come back here and in this URL you can see after this player path we have this ID so this
is the course ID so we will get it from the use padams so we will add const course ID and we will get it from
use padams so use pams has been imported from react router Dom after that we need the course data
so just add one state variable con course data and here we will add the setter function that
is set course data and we will create the user State variable and here we will add the
initial value null like this so we have to get the
individual course data so that we can play that course so to get the individual course data here we'll create
one function so here let's add const get course data equal to one addo
function and here we will use this estate enrolled courses and here we will add the map
method so in this one we'll create the arrow function and in this one we will get the individual course so let's add
course and we'll check with each course so here we'll add if statement and in this one let's write if the course
doore ID is same as this course ID it means we need the data of this particular course right so we
will set that course in this state so here we will use the set function set course data and provide this course now
we have to execute this function whenever the component gets loaded so here let's add the use
effect provide the arrow function and provide this function now here we will add the dependency areay
save the changes so now we have this course data right so here let's write this one in this curly reses we will add
course data and then we'll add the end operators so whenever we have the course data then only we will execute this one
so it will map the chapters right after that let's scroll down and uh here you can see we have this toggle section
right so it will open the chapter and display the lectures so we have to create this toggle section
function right for that here we need one state so just duplicate it and create the
state open sections and the seter function name is set open sections and here we will initialize it with empty
object like this and uh next we have to create that toggle function so we have already created it here so we will copy
from the course Details page and and just copy this one toggle sections and paste it
here like this next we need the one more state so here we will duplicate this one and we
will add the state variable name player data and the seter function name is set player data so using this we will play
the video in the right side so we will initialize it with null right after that let's check the
code again so here you can see we have this on click featured and we are adding toggle
section so now it is correct and if I scroll down here we have this calculate chapter
time so we have already imported it and after that here we have this chapter and chapter
content right so we are mapping the chapter that will display all the chapters so in this one we are
displaying this image that is the play icon so whenever the user played the video and completed this lecture then we
will display one check mark icon or tick icon so that we will get to know whether this chapter is completed or not so here
we will use the terity operator so here in this image
SRC let me remove this one and here for now let me add false right now I'm adding this false and later we will
update it when we will make the back end of our application so that we will get the actual data whether this lecture is
completed or not so here we will add question mark if it is false then we will
display assets dot Bluetick ion and here we will add assets
dot play icon after that we will come back to the web
page so you can see that course content is not displayed here so just come back and let's update other things here so
here we will scroll down and here you can see we have this lecture do is preview free right so
whenever the user enrolled to the course then they can watch all the lectures right so here instead of this preview we
will add watch and we will remove this one and instead of this is preview free we will
add lecture do lecture URL so when the lecture URL is available then user can watch that video
now in this we have this Setter function set player data right so we will update the data here so let me remove this
object and here we will add another object in this set player data and here we will update the
lecture then we'll add chapter and in this chapter we will add index +
1 then add comma and we'll update the lecture and in this lecture property we will
add I plus one now everything will be same and here you can see we are using this humanized
duration right so we have to import it for that we will scroll up and here let's
write import humanized duration and we will import it from the
package so let's write the package name humanized duration save the changes and if I come here still the course
structure is not displayed here so we will go to console and let's see we will open the
enrollments open this one yes now we have this course structure and if I open it
here we have this link watch right if I open this one here also we have this watch
link now let me go to my enrollments and open any other course so let's open the first one introduction to
JavaScript click on this button so now we have this course structure for this course and here we have this time and
this link watch right so we have created the left side of this player page now we'll add the right side but before that
if I refresh this web page you can see that a structure is hidden right so to fix it just come back here scroll up and
in this dependency array we will add enrolled courses after adding it you can see if I
refresh it still it is working right it works now let's add the content in the right side so just come
back here scroll down and here we have added the div for the right column so in this one we have to
add the course thumbnail so just add image SRC and in this one let's add CS we will add course data so when we have
this course data then we will add course data dot then course thumbnail and if we don't have the
course data in that case we will add empty string correct so after that you can see
we have this thumbnail in the right side but when we click on this watch link it should play the video instead of
displaying this thumbnail for that just come back and here in this div we will add
the curly bres and here we will add turn operator we will add player data so when we have the player data then we have to
display the video right so to display the video we will use this tag and uh after that we will add colum
and here we will move this after this image tag so what is happening here when we have this player data then we will
display one div like this and when we don't have the player data then we will display the
thumbnail correct so if I come back here and if I click on this one it should update the player
data and it should display the video here so just come back and here we have to use the YouTube tag so to use the
YouTube tag first we have to import it so here let's add import and let's add the cly addes here we will add import
and then we'll add YouTube and and we will import YouTube
from react YouTube Correct now we can use this tag so scroll down and uh within this div we will use
the YouTube tag and in this you T we have to add the same things that we have added in the
course details so in this course Details page we will come here here you can see we have added this
YouTube tag so just copy this one and paste it here in this player. jsx so in this we have added this video
ID and the video ID is player data dot lecture URL and then we'll add the
split and in this one just add the Slash and after that we'll add
dot pop method so in this one we have provided the video
URL and from this video URL we will extract the video ID and after that let me remove this
options and here we have to provide this iframe class name and in this iframe class name we have added width full
aspect video that's it and after that we have to display Place some other data also
below this video so we will add one div and in this div we have to add one P tag and in this P tag we will
display play data. Chapter do play dat. lecture and then we will display player data. lecture
title right after that we will display one button also so let's add the button and in this button we have to display
the button text either completed or Mark as complete so let me add the text here Mark as complete so just come back here
and if I click on this watch you can see it is playing this video here and below that we have this chapter name and then
we have the number right and then we have this link Mark complete so we will add the CSS properties for this one so
just come back and let's start with this div so in this one we will add the class name property
and we'll add the margin top for medium and above a screen size then we will add the CSS properties for this div so here
just add the class name and provide Flex justify between item Center and margin top after that we will add the CSS
properties in the button so in this button we will add the class name and provide text blue 600 right and in this
one also we have to add different text so for now we will add the false
here later we will update this logic when we will build the back end so here we will add if it is false then we will
add the text completed else we will add Mark
complete like this and uh after updating it if I come back here here you can see we have this chapter name or lecture
name in the left side and in the right side we have this text Mark complete and here we can play the video correct if I
click on the second one now we have this second video here if I click on this one now you can
see another video here and you you can see it is updating the numbers also so this is the second chapter and first
lecture if I click on the last one now you can see this is for the second chapter and second lecture
2.2 then we have the lecture title and Mark complete now in this page we have to add
the footer right so to add the footer we will come back here and scroll down and before closing
of this fragment we will add the footer component so just add footer like this so now you can see here
we have this footer so now on this player page that is the course play page we have to add the ratings also so that
user can rate this course right so we will add that rating in the left side so to add the rating just come back and uh
here we have the closing div for the left column right so before that here we will add one
div and in this one we will add one title in H1 so the title is rate this course and uh for this one we have to
add the CSS properties also so we will increase the text size so just add the class name and text Excel and font bold
now in this one we will add the class last name and here we will add the flex item Center Gap two and padding Y
and margin top if I come back here so you can see here we have this text rate this course
now to create the rating feature we will create a separate component so we have already created the file for that if I
come back to the sidebar and here you can see we have this rating. jsx so in this one we we will create our rating
component so in this rating component let me remove this title and here we have to create one aray so let's write
curly brushes and we'll add the aray Dot from now in this one we will add one object and in this object we
will add the length that is five after that we have to add one Arrow function so so let's
add the arrow function and in this parameter we will get underscore
comma Index right now in this function we will add one variable so just add const and
the variable name is a star value and it will be index + 1 like this after after that here we
will add return statement and we will return this bracket and in this one we will return
the asan tag now in this asan tag we have to add the key property so the key will be
index and within this asan we will add this HTML icon
code right right now for this a span tag we'll add some CSS properties also so we will add it in curly
bres and we will use the back tick so that we can insert the dynamic classes also so here let's
add text Excel then text 2 Xcel for a small and above a screen then cursor pointer
then transition colors and after that here we will add the dynamic class for
that we will use template literal so just add dollar sign curly bres and we will use this a value so if the value is
less than equal to what here we will add rating and for that we have to create one rating state right so before this
return statement let's write con rating and set rating equal to user
State and here we will add the initial rating or we will add the initial value
zero right so we will use this rating here so if the a start value is less than rating then what will happen we
have to display the icon in yellow color so here let's add question mark and we will add the class name text yellow
500 then we'll add the else condition and here we'll add gray color so just add text Gray
400 like this now we'll add one function that will handle the rating so to create that
function here let's write const and write the function name handle
rating and here we'll add the value and create this Arrow function here we will use this Setter
function set rating and here we have to provide value that we will pass in this function as parameter right and after
that we'll add if in this if we have to provide the rating value that user will rate on the
course so we will get it from the props so we will D structure it here so just add the cures and here we will D
structure the initial rating when we will call this component we have to provide the initial rating and with that
we will add the rating that user will provide so we will add that using this name on
rate so we will use it here if on rate is available then we will add on rate and
here we will add the value so we have created this function now we have to execute this function so just add use
effect hook and here we will add the Aro function and with that we will add the
dependency array now in this one we will add the if
statement and we will check if we have this initial rating so in that case here we will
add set rating and in this one just provide initial rating and in this dependency are also
we will add initial rating so that when the initial rating gets changed it will execute this
function and it will set the estate using the setter function this rating estate right now we have to link this
handle rating here on this aspan tag so in this aspan
tag let's write on click property and provide the arrow
function and just provide this function handle rating and in this one we'll add a start
value that's it so we have created this rating component now we will Mount this component on our player page so we will
open player. jsx and here after this title we have to mount the rating component so just
add rating and close this tag and in this one we have to provide the initial
rating so just add the props initial rating and the initial rating will
be zero like this save the changes and come back to the web
page so you can see here we have this rate this course and then we have this five stars in gray color and if I click
on the first one you can see it becomes yellow if I click on fourth one so up to four stars becomes yellow so this is how
we can enable this rating feature we will make it functional when we will create
our back end right so we have created this rating feature ourselves so we have not used the package that we have
already installed while creating the react application so you can see if I go to this package.json and here we have
installed this react Simple Start rating package right so we don't need this anymore we have not used it so we can
also remove it so we will come to this terminal press crl C then we will add npm
uninstall and provide the package name react Simple Start rating press
enter so now you can see that package has been removed from this dependencies right now let's run our project again
using npm run Dev so now project is running and you can see this course play page is working
fine here we can play the course and now we have this enrolled courses page then we have this homepage then we have this
all courses right and in this one we can search the individual course using any
keyword right so now we have completed the front end of our application where we have created all pages for the
students after creating all pages of a student now we will create the pages of educator dashboard so let's open the
figma design and here you can see these are the pages for educators this is the add course page and this one is students
enrolled page then we have this my courses and dashboard right so these are the pages for educator now on these
Pages you you can see we have to create the same navigation word then same left side word and at the bottom we have to
create same footer for all the pages right so we will create the component for footer navigation bar and this left
side bar so let's start with this navigation bar to create this navigation bar let me just come
back and in this left side bar we will go to this components in this components we
will go to educator then open navb bar. jsx and here we will add the elements for
educator Navar so in this one first we need some data from our assets so here let's add
import and we will import the dummy educator data and we will get it
from asset folder and and asset file after importing it next we need the user data and user button from Coler so
we will import it from color react using this import statement right now here we will add const and we will create one
variable called educator data and in this one we will store the imported data that is dummy educator data right after
that we have to get the user from this you use user right so here we'll add const user and we will get the user from
use user right now in this div we have to return the navigation bar so in this navigation bar we have to add one image
so for adding the image we will add the IMG tag and here we'll add the assets. logo right and then we'll add the alt
text and we'll add some CSS properties now we have to wrap this logo using the link tag so that we can click on this
logo so here we'll add the link tag and it will be imported from react router Dom now just close this link tag and uh
we will place this closing tag after this image and in this link We'll add the two property and here we have to
provide the path so when we click on the logo it should redirect us to homepage so we will add slash like this after
that here we have to display the users's name and profile icon and if the user is not logged in then we will display the
one user icon so here we'll add one div and in this div we have to add the user's name so here we'll add High then
we'll use this user data right so if we have the user we will display the user full name and if we don't have this user
we will simply display developers correct after that we have to display either profile icon or user icon so
again we will use this user suppose we have this user then we will display the user button component from cler so we
will display this one so it will add the users profile icon and if it is not available then we will simply provide
one image and in this image we will provide the profile
IMG like this save the changes after adding it we have to add some CSS properties in this div so here in this
div we will add class name and provide these classes corre after that here we have this pent
D so in this one also we will add some classes so here just add the class name and we will provide this class name
after adding it we have to mount this Navar component in the educator page right so from this left side bar we will
open this pages and go to educated and open this educated. jsx file correct now in this educated. jsx we have to place
our never so this never will be displayed in all pages of educat dashboard so we have
to place it here instead of this Title Here we will provide navbar and we will import this
naar from components educator naar correct don't import the student naar here we are importing the educator naar
after that we have to add some classes in the parent div so here we have this div in this one we will add these
classes after adding it if I come back here and go to educ app passw so here you can see we have this navigation bar
and in this navigation bar you can see this logo and in the right side we have the name and profile icon like this and
if I log out from here and now if I try to open this
educator here you can see we have one default profile icon and the name is high developer right and when we will
log in so go to educated dashboard now we have the name from the color data right
and then we have the profile icon and we can manage the profile right now we have to create the sidebar for the educator
dashboard so just come back and from this components we will open this sidebar. jsx now in this sidebar we have
to create some links so that we can click on that link to navigate to different pages like dashboard add
course my courses and a student enrolled right so just come back in this one we have to create some menu
so let's create one array and then we will map this array to create all menus right so here before this return let's
add one aray with the name menu items so you can see in this menu items we have added one are and in this are we have
multiple object and in each object we have the name path and icon so to create one menu we need the menu name then path
so that when we click on that menu we will be directed to this path after that we have to add the icon in each menu so
we have added total four object to create the four menu after that here we need one more
data that is stored in the context file so here we will use this is Educator data and we will import
it from use context and provide the app context correct after that we have to return the
sidebar and we will return the sidebar whenever this e educator is available so here after this return we will add is
Educator and and operator so whenever the is Educator is through then only we will return this div correct and in this
one we will add some CSS properties so here in this div we will provide this class name and add the CSS properties
after that we have to display the menu so we will use the curlys and here we will provide this menu items and on this
one we can use the map method correct and here we will add the arrow function and in this parameter we will get the
individual item right now here we have to provide the menu links that will be clickable so
here we will add the nav link tag we will get the naving tag from react router Dom and when we
are using the navlink tag we can use the two property and in this one we can get the active link also so
here let me close this tag like this so we have the nav link opening and closing tag and in this one we have to display
the menu item name and menu item icon so here we will add the icon using the IMG tag and after that we have to display
the name so here we'll display the name in P tag and here we have added some CSS properties so here we have added item.
name and item do icon correct after that we have to mount this one on this educated. jsx file correct so in
this educated. jsx file after this nav we have this div right so in this D we will add some classes and here we will
provide flex and in this one you can see we have added
this Outlet so before this Outlet we will Mount this sidebar so you can see this sidebar has been imported now just
close this tag and then we have this Outlet right so let me wrap this Outlet also in a div so here we will add one
div and uh close it after this outlet and here we will add the class name and we will provide Flex
one so in the left side we will get the sidebar and in the right side we will get the other component and it will use
the entire space available in the row because we have added the flex one correct now just come
back and here if iess it we have some is so just check it and if I go to console you can see we have the is assets is not
defined so just come back and here we have to import the assets also because in this sidebar you can see we are using
this assets right so we have to import the assets from assets folder and asset file so we have imported the assets save
the changes and come back so now you can see here we have this left side bar but that menu items are not visible
so we will come back and here in this nav link tag we have to add some properties so here
first we will add the two then key and then we will add the end so here we will add two item. path then key item. name
then we will add the end that is item. path equal to educator we are adding the end property for dashboard link here you
can see in this addo function we are returning this C so instead of this one we'll add a small
braet and here also we will update small braet that's it after adding it if I save the changes and come back to the
web page now you can see we have all these icons and menu links correct and we can click on this one to
navigate to different pages if I click on ADD course you can see in this URL we are at the/ educator / add course and
here you can see the text add course correct if I click on dashboard now we are on the
educator right and if I come back to the homepage and click here it will open this educator page now we will add the
CSS properties for this menu links so just come back and uh here in this nav link we will add some CS properties so
here let's add the class name and we will add the cly Braes and here we will add one Aro
function and in this one we will get the parameter and here we will add this is
active so whenever we will click on any menu link then that menu link will be active right so whenever the active is
present we will add different class name and when the active is not available then we will provide different class
name so here we'll add the common class name first so we'll add the back Tex and in this back Tex let's add these classes
so here we have provided this delant classes after adding it save the changes and come back here so you
can see these alignments are looking good and if I click on anyone you can see we have no changes in the navigation
menu in the left side bar right so we have to add some changes when we open any particular page so just come back
and here we'll add this is active so here we'll add the template little we will add dollar and calies is
active correct so when this is active is true then we will provide these classes this one after that we'll add
the column and here we have to provide another class name when is active is false so we have provided this class
name so you can see here we have used this tary operator after adding it if I save the changes and here you can see
when we click on my courses it becomes blue in background if I click on this one you can see the background color is
changing if I click on dashboard now you can see the background color here and in the right side we have this color so you
can see the difference in active and inactive pages right so you will come to know which page is open now we have to
add the footer in the educator dashboard so we will come back here and we will open this
educator then footer. jsx and here we will create the footer for the educator dasboard so here we will use the footer
component in of this T so we will add footer and in this one we'll add some
CSS properties so we will add the class name and provide this Telvin classes now in this one we have to add the left
column and right column correct so in the left column we will add one div and here we
will add one image using this IMG tag and we will provide the logo using assets. logo after that we have added
one div and using this we are adding the background color and after that we have this P tag
and in this P tag we have added this copyright message so this is for the left side of
the footer after that we'll add the content in the right side so here we'll add another D and in this one we have to
add some menu links so we will add the a tag so here we have added total three a tag and
in this one we have added the images right so here we have provided the assets. Facebook icon Twitter icon and
Instagram icon correct after that we have to add the CSS properties for the left column and right column so here in
this right d we will add the class name this one and in the first div that is the left div we
will add the class name Flex item Center and GAP four like this now save the changes and come
back to the web page but before that we have to mount this footer component in the educator. jsx so in this educated.
jsx here you can see we have this closing div tag so before that here we will
provide footer and we will import the footer from educator you can see the footer has been imported from components
educator footer close this tag and come back to the web page this page is not responding so let me just come back
here we have added capital F so let me make it small footer and here also small
footer save the changes refresh again now if I scroll down here you can see we have this footer at the bottom so now in
the educator section we have added the navigation bar sidebar and this footer after that if I come back to the figma
design so here you can see this is the dashboard page of educator where educator can see the total earnings
total courses and total earning then they can see the latest students enrolled data so to create this
dashboard page we will come back to the vs code and from here we will open this pages and go to educator then
open dashboard. jsx correct now in this one we need the state variable where we will store
the dashboard data so here before this return statement we will add one State variable with the name dashboard data
and the set function name is set dashboard data and we will initialize the user State value with null and we
have to import this user state so user state has been imported from react correct now in this one we need the
currency also and we have declared the currency in context file so here we will import the currency from use context so
import this use context and provide the app context so now we have the currency and we have
the estate to store the dashboard data now in this state we have to store the data right so to store the data we will
create one function so here we will create one function with the name f dashbo data it will be asynchronous
function and in this one we will just call this Setter function set dashboard data and in this one we will provide
this dummy data that is available in the assets so we will import this dummy data from assets folder and asset file
correct next we have to execute this function whenever this component gets loaded so here we will add the use
effect so here just add the use effect and provide this function and in this one simply call this PCH dashboard data
and we will import this use effect also so use effect has been imported here correct after that here we have the
return statement correct so in this return first we will check when we have this dashboard data
avev then we will return this bracket and in this one we will return this div correct
and if it is not available here we will add colum and simply we will provide loading component so just add
loading the loading suggestion is not coming so we will open this loading component
here from this students and loading now just come back here and if I type loading so now we are getting this s for
Lo loading component so close this tag and you can see this loading component has been imported correct so what is
happening here if the dashboard data is available then it will return this div and if it is not available then it will
return this loading component right after that in this one here we have this div so let me remove this text from here
and in this div we will add some classes and provide the CSS properties so in this we will provide this class name and
provided this tement class after that we will add another D and in this one we have to add the
space so just add the class name and provide a space y5 like this now in this one we have to
create the row for the dashboard data as you can see here we have three columns so we will create one div that will be
row and in that one we will create three columns so here we will create one div and for this one we will provide the
classes so it will align the child div in columns right after that let's create the First Column so we will create one
div and in this one we will add these data so you can see in this div we have added one image and here we have added
the patients icon so first we will import this assets right so in this D we have added the image tag and provided
the patient icon after that we have one div and in this one we are getting the dashboard data and from this dashboard
data we will add the enrolled student data and find the length so we will get the total number of enrolled
student and here we will display the text total enrollments like this we will create two other columns also so we will
duplicate this one for two times and we will change the content so in the second one you can see
we have added assets. appointments icon then dashboard data do total courses and here we have the text total courses
after that in the third column we will provide the content so here I have provided assets. earning icon then
currency that we have already imported after that we have the dashboard data then total earnings and here we have the
text total earnings correct after adding it now we will come back to the web page so here you can see the dashboard data
is not displaying so to fix it we will come back here and from this left side but we will open app.jsx and in this
nested routes you can see we have added route path educator so here we have to provide slash just add it save the
changes and come back to the web page now you can see when we go to Local Host 5173 educator it is
displaying the Educator's data right and if I click here it will open this add course and if I click on dashboard it
will open this educator data page right so just come back and now we will add the other details in this dashboard so
again we'll open the dashboard. jsx file so in this dashboard. jsx file you can see here we have
added this div for the row and after that here we will add the space correct and here we will add the data that will
display the enrolled students for that here we will create another div in this one we have to add the title
so we will add the title latest enrollments and we have added the classes in this title that is written in
the h2 tag after that we have to display the data in a table so we will create One D and here we will add the CSS
properties so we will provide the class name and provide these tement classes after that we will use the table tag to
create the table so let me create one table here so here we have added one table tag
and provided these classes then we have the table head where we will display the table heading text so in the heading we
will display hashtag then a student name and course title and provided the CSS properties after that we will add the
table body and in this table body we have to display the data like number that will be displayed in hashtag column
then we will display the students name and course title so to get the data here we are using
this dashboard data right so we will use it here dasboard data and in this one we will find the enrolled students data and
this is an array so we can use the map method and in this map method we have provided one Arrow function where we are
getting the items in getting the index then we will display the data in table row so we have
added the TR tag and in this table row we will add the table data using the TD tag so in the first one we have to
display the number so we will use this index and the index start from zero so we will use index + 1 so it will start
the number from 1 2 3 like that and after that we have added the table data where we will display the student image
right so here we have added item a student. image and after that we have to display the a student's name so we have
used the aspan tag and in this aspan tag we have displayed the user's name that is the student name after that in the
third data of the table we will display the course title after adding it if I come back to the web page again so here
you can see we have these data in the educator dashboard correct so after completing this educator dashboard page
we will create this my courses page right so here we will display the all courses published by this particular
educator to create that we will come back to the vs code here we will open this left side
bar and from here we will open pages educator and my courses now in this one we have to
display all courses of particular educator so we have to get the courses from our context file so here before
this return we will add const and we will get the currency from the context and we will also get all
courses from Context file so here we have the currency and all courses and we will get it from Context so just add the
use context and app context after that we will create one state variable where we will store the coures so here we have
created one coures state and the set function name is set courses and we have initialized it with value
null after that we will create one function that will Fitch all the courses right so here we have created this
function with the name Fitch educator courses and in this one we have provided all courses that we are getting from the
app context using this Setter function correct so next we have to execute this function whenever the component gets
loaded for that we'll add the use effect hook and and in this one we will add the F educator courses function so this
function will be executed whenever our component gets loaded after that we have to display the
data through this return statement right so here we will return the div whenever we have the ches right
so here we will use the trary operator and write ches so when we have the course state that is here right when we
have this course say State then we will return this div and if it is not available then we will simply return the
loading component so here we'll add loading like
this after that we have to display the courses data within this div so first we'll display one title in a div so here
let's add one div and in this one we will display one title called my courses so we will add the title in h2
tag and here we have added these CSS properties right and for this D we will add the class name and provide width
full after that here we have just c d so in this one we'll add the class name and we will provide the
classes this one after adding it if I come back to the web page here we have added this use effect
so we have to import this use effect from react so just click here so you can see use effect has been imported save
the changes and come back to the web page so now you can see in the left side we have these menu items and here we
have the title my courses that we have added here right after that we have to display
the table so we will display the table in a div and in this div we will add the table like this and in this table we
will add the table head right so here we will add this table head and in this one we have added these table row and table
heading text that is all course say earnings students and published on correct now we'll add the CSS properties
for these div so in this one we have added this class name and after that in this table we will
add this class name correct after adding it if I come back here you can see here we have the
table headings with all courses earning students and published on now we have to display the course data so in the first
one we will display the course thumbnail and name then we will display the earning then students and published on
data right so just come back and here after this table head we have to display the table
body in this table body we will display the table data using this courses right so here we have added the table body and
provided this class name and then we have this coures state and this will be one are so we have used the map method
and in this one we will get individual ual course right so from this individual course we will get the ID that will be
added in this table row and then we have the table data so in the first one we have to display the thumbnail so we are
getting the thumbnail using course. course thumbnail then we have to display the course title so here we are using
course. course title and we have provided these relevant classes after that in the second one you can see we
are displaying the currency that we have already imported from Context after that we have to display the earning so here
we have we have added the number of our students then we have added the price and we have multiplied it correct after
that we have to display the enrolled students so here we have added enrolled students. length so it will display
total number of enrolled student for the individual course after that we have added the date so it will display the
date when the course was published so after adding it if I come back here you can see here we have all the data like
thumbnail course title earning total number of student enrolled and course published date so we have created this
my courses page after that we will create another page that is enrolled students where educator can see all the
enrolled students for their courses so to create this let's come back to the figma design and here you can
see this is my courses that we have already created and after that here we have a student enrolled
page so here also we have to display one table where we will add the table heading hashtag a student name course
title and date then we will display the data so to create this one we will come back and from this left side word we
will open a student a students enroll. jsx file and in this one first we have to
get the a student data from our assets so here let's import the dummy student enroll data dat from asset
we have added this import statement right after that here we will create one function that will fetch the data from
this dummy student enrolled right so here let's add the function but before that we will create one a state where we
will store the data right so here we will add the state variable en students and the set of function name is set
enrolled students and we have initialized it with null and here we have used the user state so we will
import this user state from react after that we will create the function that will fetch and store the data in this
state so here we have added this fetch enrolled students function and here we have used this set function set enrolled
students and provided this dummy student enrolled next we have to execute this function whenever the component gets
loaded so for that here we have created this use effect and in this one we have called this function and next we have to
import this use effect so just click on the suggestion so use effect has been imported correct now we have to display
the data on web page but we will display the data whenever we have this enrolled a students data so here we'll add the
turn operator so after this return We'll add enrolled students and when it is available we
will return this div and if it is not available here we will add the colum and provide the loading component
like this after that from here we will remove this title and in this one we will display
the table in a div and in this one we have to add the table tag in this one we'll add the
table heading like this after that let's provide the CSS properties for all these div so in this first one we'll add the
CSS properties after that in the second div we will add these tnd
classes and in this table we will add this telin classes and here we have added the telin classes for
the table head and table heading data so after adding it if I come back to the web page and open this a student
enrolled page so here you can see we have this table heading correct next we have to display the data in table body
so we will come back and after closing of this table head we will add the T body and in this one we
will get the data from this estate that is enrolled students right so we will add this enrolled students here and in
this one we will use the map method so here we will add the C and provide this enroll. students. map so in this one
we'll get the individual a student and then we'll add the index in the parameter after that we will return the
table row where we will add the key index and to provided this classes after that in this table data first we have to
display the number so we will add the number using this index so the index start from zero that's why we will add
index + one after that we will add the student image and name so we will add the TD tag and here we have added the
image using the IMG tag and here we are adding this item student. image URL then we have added this a student name then
we have added the course title then we have added the date so after adding it next we have to add the CSS properties
in this table body right so here we will add the class name and provide these tent
classes after adding it just save the changes and come back to the web page so now you can see here we have the data of
a students enrolled for this educator course so here we have the a student profile image name then course title and
enrollment date correct after creating the student enrolled page my courses page and dashboard page we will create
this page add courses from where Educators can publish their new course so let me just come back to the figma
design and here you can see this is the UI design for our add course page so to create this one let's come back to the
vs code and from here we will open this sidebar and open this ad course. jsx file in this ad. jsx this file first we
have to import the unique ID and quill from the packages right so we will use the import statement and here we have
imported unique ID from unique ID package so that we can add a unique ID for each courses right next we have to
add the rich text in the course description so here we will import this quill from Quil so that we can write the
rich text it means the formated text in the course description after that we have to add the use ref so
before the return statement we will add con Quil re is equal to use ref and null we will import this use ref from react
now we will duplicate it and here we will add one more reference variable that is editor ref so that we can add
this edited ref in a HTML element and where we will add the course description correct now in this one we have to
create one form and from that form we will get different data like course title price discount image chapters
right so to store all these things we will create some State variable so here let me create the state
variables course title and the setter function name is set course title and initialize it with empty a string we
will import the user State also so user state has been imported from react then we have added the another state variable
course price then discount image chapters correct after that we will use the popups to add the lectures in the
course so to add the lectures and chapter we will add the popup for that also we will add one state variable so
here we will add cost so popup and set so popup so by default it will be false so initially the popup will be hidden
and when we enable the popup we can add the lectures detail after that we'll add the state variable where we'll add the
chapter ID so just add con current chapter ID and Set current chapter ID correct after that we will add one more
State variable where we will store the lectures details for each chapter so here we have added lecture details and
Setter function is set lecture details then we have added the use state now we will initialize it with object and in
this object we will add these properties that is lecture title so for the each lecture we need the lecture title
duration then lecture URL and then we'll add each preview free so if it is false then it won't be available for free
preview and if it is true user can preview this video for free without purchasing the course so we have added
these stage variables right after that we have to add one use effect so here we will
add use effect and in this one we have to add the add function and here we will add this
statement so it will check if the Quil ref do current is false and when we have the edited ref do current available then
in this Quil ri. current we will assign this new Quil editor ri. current and we will set the theme snow so that in the
editor ref element we can add the rich text and here we have to add the dependency areay that is empty
areay like this so here let me add the comment also we will add initiate Quil only once after that we will create one
form inside this div so first in this div we will add the Telvin classes so we will add these telin classes and after
that remove this title from here and here we will add the form tag and in this form tag first we have to add the
title and one input field so just add the text course title then we have the input field and in this one we have
added the onchange property and in this on change we have added set course title and provided e. target. Val so that if I
type anything in this input field that data will be stored in the course title State and here we have added the value
property also and provided these classes and this field will be required to submit the form so we have added the
first input field and one title for that after that we will add one more input field so here we will
add another div with the class name then the title is course description and here we have added one div and in this div
you can see we have added editor ref right so in this div we can add the text and we can format the text so if I save
the changes and come back to the web page here we have this course title input
field but this course description input field is not working so here we are using the quill package so we will come
to quilljs Doc and here go to documentation and go to installation scroll down and here you will find this
npm and here we have the steps to install it and we can create a new quill so we have already done this and after
that we have to add the CSS link right so we have to import the CSS from this screen so just copy this one and come
back to the vs code and we will open our app.jsx file and in this one we have to just import
the Quil CSS here in this import statement you can see we have this quill code. CSS so instead of this code we are
using the snow theme so here we'll add snow save the changes and let's come back to the web page so now you can see
we have this course description input field and in this input field we can write the formated text so let me write
JavaScript so we can format it like this we can use the heading one we can use the heading three like this we can
select normal text let me duplicate it and we can select it and we can use the ordered list or we can use the
unordered list we can add the Bold text by selecting here we can make it world we can make it italic right we can add
the underline right and we can also add the links so this is how we can add the
formated text in the course description after creting the course title and description field we will come back and
let's open our add course. jsx file and in this one after creating this two input field we will create the input
field for the course price and we'll add the input field for the course thumbnail right
and before that let me add the CSS properties in this form tag so here we'll add this class name like this and
here we will add one div and in this div we will add the two columns so here you can see we have
added this div and in this div this is the first column in this div we have added the flex item Center justify
between Flex lab so the content inside this di will be aligned side by side so this this is the First Column and in the
left side we have added the course price and then we have the input field in this input field we have added the onchange
property and provided the set function set course price so whatever price we will enter in this input field that will
be stored in the course price State using this e. target. value then we have the value property and here the input
type is number then we have added the placeholder so it is zero and then we have added the tmin classes and it is
required after that in the right side we will display one icon using that we can up the course image or course thumbnail
so in this div we have added the CSS properties then we have added the course thumbnail then we have the label tag and
in this one we have added this image right and in this image we have this input tag so here we have added the type
file so that we can upload a file using this input field then here we have added the ID thumbnail and here also we have
used this thumbnail in HTML for for this label tag so that when we click on the label tag it will open
the window to upload a file then we have added the onchange property that will store this file in this image state
after that we have this image so using this image we will display the uploaded image at this
place after that you can see we are using this assets so first we have to import the assets so just select on this
suggestion so assets has been imported after that we will come back to the web page so here you can see we have this
course price input field then we have this course thumbnail correct next we will add the input field
for the course discount so just come back and uh before this form tag we will add one
div so in this div you can see we have added the CSS properties then we have added the text in P tag discount perc
after that we have the input field with onchange property that will store the data in this discount State and after
that here we have added the minimum and maximum value 0 to 100 then placeholder is zero and then we have added the CSS
class name for this input field after adding it if I come back here you can see here we have this discount input
field correct next we have to display the chapters added here and we will also display a button using that we can add
the chapters right so the chapter state is an aray so we can use the math method so here let's add one comment so we will
add the comment adding chapters and lectures so so here we will add one div and in this
div we will display the chapters using the chapters estate and here we will add the map
method and let's create one addo function and in this Aro function we will return this small
bracket here we will add this bracket also now in this one we have to display One
D so in this D we will add the key property that will be chapter index that we are getting from this parameter
after that in this one we have to add some CSS class name so we will add this class name property and provide these
tan classes correct now here we have to add one more D and in this one we will add these
class name next we have to add the icon that will be down arrow icon
and we can also rotate this one right and with that icon we will dis play the number that will be chapter number like
1 two right and then we'll display the chapter title also so we will group all those things in a
d and for this one we will add the classes so just add the class name property and provide these classes and
here first we'll display the icon so we will use the image tag in this image SRC we will add the image from the assets
file so just add cly bres assets Dot and here we will display the drop down icon correct after that we will add the width
so here we will add this width for this image and after this image we have to display the chapter
number and chapter title so we will add the a span tag and in this one you can see we have added this font semi bold
then added this chapter index + one then we'll add chapter dot chapter title so we will add the drop- down icon then
number and chapter title now here in this image also we will add the class name
property and here we will add the classes so we will add the cly places and then write back tick so we can use
the template lital here now in this one we will add this one we will add the delant classes after that we'll add the
template literal and here we have added chapter do collapsed so if the chapter do collapsed is true then we will add
this Telvin classes that is rotate 90 so it will rotate the icon whenever the chapter is collapsed after adding it if
I come back here it should display the chapter but right now we have not added any chapter right so whenever we will
add the chapter that will be displayed here so after this div here we will add the asan tag and in this aspan tag we
have to display the total number of lectures available in this chapter so we will add this chapter
do chapter content. length then lectures and in this one we'll add some classes so we will add text gr
500 correct after this asan tag we have to display one cross icon in the right side so here we will add the IMG tag so
in this cross icon we will add the functionality that will remove the chapters right so so first we will add
the CSS properties in this one so we will add this class name and provide cursor pointer after that we have to add
the cross icon in this SRC so we have added cross icon and then save the changes after adding this image here we
have this div that is closing div tag so here we have to display the lectures available in this chapter whenever it is
not collapsed so here we will add the curly bres and we will check if it is not collapsed then
we will return this bracket and in this one we will display a d where we will display
the lectures right so here we will add this class name and in this one we will display the lectures so we will get the
lectures from where we will get it from chapter only so we will add the curly veres chapter dot chapter content and we
will use the map method now in this one we will create Arrow function and in this function
parameter we will get lecture and lecture index and here we will return one
div so in this div we need the key property so here we will use the key and we will add the lecture index and we
will also add the class name property and provide these classes right so in this one we have to
display the lecture number then lecture title and after that we will display the lecture duration in minutes then we will
add the lecture link and after that we will add the text whether this lecture is available for free preview or it is
paid so to display that here we will add the aspan tag and in this aspan tag we will
add the curly bres and provide lecture index + one then lecture do lecture title then lecture duration
in minutes then we'll add the link tag so we are using the a tag for link and in this one we'll add lecture. lecture
URL after that we will add this terity operator and we are checking if this preview is true then we will add
free preview and if it is false then we'll add the text called paid like this after that we have to add
one icon also so we will use this icon to remove this lecture so we will add the image tag and here we will add the
class name so we will add class name property and provide cursor pointer and in this one we have
to add the cross icon so we will add this assets. cross icon so we have added the div that will
display the chapter and lectures after that we have to add one button that we will use to add a new lecture so after
adding this cross icon we have this closing div tag then we have this closing cly Braes so here we will add
