Implementation
This PR implements a Navigation Bar and Application Bar component.
It includes the definition of private routes.
Components:
Updated the content of the component NavBar (frontend/src/components/NavBar.jsx).
It now renders a Navigation Bar and Application Bar.
The Application Bar displays the application name using the AppBar component from MUI.
The Navigation Bar display the user navigation options. It implements a responsive drawer.
Protected Routes
Inside the src folder, created an utility folder named utils and under it, created a new file to define the private routes called privateRoutes.jsx.
It validates if there is a valid token, i.e. the user is authenticated. If the token is valid, the access is granted, if not, the user is redirected to login.
Router
Updated the main.jsx file to include a Router for the App.
App
In the App file, redefined the routes in order to include the private routes and the route for the NavBar component.
A new route is included for all (*) the invalid urls in order to display a not found error message.
The menu options for the Navigation Bar is defined in this file, when a new option need to be included, the menuOptions needs to be updated with the new option definition.
It includes a NotFound component definition in order to display an error message when the user tries to access an invalid URL and a H1 component to display a message.
This PR addresses issue #85
Implementation This PR implements a Navigation Bar and Application Bar component. It includes the definition of private routes.
Components: Updated the content of the component NavBar (frontend/src/components/NavBar.jsx). It now renders a Navigation Bar and Application Bar. The Application Bar displays the application name using the AppBar component from MUI. The Navigation Bar display the user navigation options. It implements a responsive drawer.
Protected Routes Inside the
src
folder, created an utility folder namedutils
and under it, created a new file to define the private routes called privateRoutes.jsx. It validates if there is a valid token, i.e. the user is authenticated. If the token is valid, the access is granted, if not, the user is redirected to login.Router
Updated the
main.jsx
file to include a Router for the App.The menu options for the Navigation Bar is defined in this file, when a new option need to be included, the
menuOptions
needs to be updated with the new option definition. It includes aNotFound
component definition in order to display an error message when the user tries to access an invalid URL and aH1
component to display a message.