From b3c07fd9f1664dda4f16357aaca74dff8226401d Mon Sep 17 00:00:00 2001 From: Biswakalyan Bhuyan Date: Thu, 1 Aug 2024 17:21:25 +0530 Subject: updated project --- panel/src/components/Navbar.css | 27 +++++++++++++++++++++++++++ panel/src/components/Navbar.jsx | 18 ++++++++++++++++++ panel/src/components/PrivateRoute.jsx | 24 +++++++++--------------- 3 files changed, 54 insertions(+), 15 deletions(-) create mode 100644 panel/src/components/Navbar.css create mode 100644 panel/src/components/Navbar.jsx (limited to 'panel/src/components') diff --git a/panel/src/components/Navbar.css b/panel/src/components/Navbar.css new file mode 100644 index 0000000..ee38707 --- /dev/null +++ b/panel/src/components/Navbar.css @@ -0,0 +1,27 @@ +.navbar { + background-color: #343a40; + padding: 1rem; + display: flex; + justify-content: center; +} + +.navbar-list { + list-style: none; + padding: 0; + margin: 0; + display: flex; +} + +.navbar-item { + margin: 0 1rem; +} + +.navbar-item a { + color: white; + text-decoration: none; + font-weight: bold; +} + +.navbar-item a:hover { + text-decoration: underline; +} diff --git a/panel/src/components/Navbar.jsx b/panel/src/components/Navbar.jsx new file mode 100644 index 0000000..b287e97 --- /dev/null +++ b/panel/src/components/Navbar.jsx @@ -0,0 +1,18 @@ +import React from 'react'; +import { Link } from 'react-router-dom'; +import './Navbar.css'; + +const Navbar = () => { + return ( + + ); +}; + +export default Navbar; diff --git a/panel/src/components/PrivateRoute.jsx b/panel/src/components/PrivateRoute.jsx index 2160f74..e2c502d 100644 --- a/panel/src/components/PrivateRoute.jsx +++ b/panel/src/components/PrivateRoute.jsx @@ -1,17 +1,11 @@ -import { BrowserRouter as Router, Route, Routes } from 'react-router-dom'; -import LoginPage from '../pages/LoginPage'; -import Dashboard from '../pages/Dashboard'; // Assuming you have a Dashboard component +import React from 'react'; +import { Navigate, Outlet } from 'react-router-dom'; +import { useAuth } from '../contexts/AuthContext'; -function App() { - return ( - - - } /> - } /> - {/* Other routes */} - - - ); -} +const PrivateRoute = () => { + const { currentUser } = useAuth(); -export default App; + return currentUser ? : ; +}; + +export default PrivateRoute; -- cgit v1.2.3-59-g8ed1b