aboutsummaryrefslogtreecommitdiffstats
path: root/panel/src/components
diff options
context:
space:
mode:
authorLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2024-08-01 17:35:27 +0530
committerLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2024-08-01 17:35:27 +0530
commitfb04271b5288e8fb5891b7d6326f4806d12b82d5 (patch)
treee459c3e1f8bb6e168becdddd0d48779135d91a7f /panel/src/components
parent4bb13ee84f6bb51cba6544ccd0690ab2049512a9 (diff)
parentb3c07fd9f1664dda4f16357aaca74dff8226401d (diff)
downloadadmin-panel-fb04271b5288e8fb5891b7d6326f4806d12b82d5.tar.gz
admin-panel-fb04271b5288e8fb5891b7d6326f4806d12b82d5.tar.bz2
admin-panel-fb04271b5288e8fb5891b7d6326f4806d12b82d5.zip
Merge remote-tracking branch 'project/master'
Diffstat (limited to 'panel/src/components')
-rw-r--r--panel/src/components/Navbar.css27
-rw-r--r--panel/src/components/Navbar.jsx18
-rw-r--r--panel/src/components/PrivateRoute.jsx11
3 files changed, 56 insertions, 0 deletions
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 (
+ <nav className="navbar">
+ <ul className="navbar-list">
+ <li className="navbar-item"><Link to="/dashboard">Dashboard</Link></li>
+ <li className="navbar-item"><Link to="/manage-ads">Manage Ads</Link></li>
+ <li className="navbar-item"><Link to="/roles">Roles</Link></li>
+ <li className="navbar-item"><Link to="/logout">Logout</Link></li>
+ </ul>
+ </nav>
+ );
+};
+
+export default Navbar;
diff --git a/panel/src/components/PrivateRoute.jsx b/panel/src/components/PrivateRoute.jsx
new file mode 100644
index 0000000..e2c502d
--- /dev/null
+++ b/panel/src/components/PrivateRoute.jsx
@@ -0,0 +1,11 @@
+import React from 'react';
+import { Navigate, Outlet } from 'react-router-dom';
+import { useAuth } from '../contexts/AuthContext';
+
+const PrivateRoute = () => {
+ const { currentUser } = useAuth();
+
+ return currentUser ? <Outlet /> : <Navigate to="/login" />;
+};
+
+export default PrivateRoute;