From 6bc97f51620bac9dbf676fca9db6ce8eeeb50644 Mon Sep 17 00:00:00 2001 From: Catherine Molina Betancourt Date: Mon, 8 Dec 2025 08:45:01 -0800 Subject: [PATCH] fix/navbar --- public/_redirects | 1 + src/components/MobileMenu.jsx | 44 ++++++++++++--------- src/components/Navbar.jsx | 74 +++++++++++++++++++---------------- src/pages/Community.jsx | 4 +- 4 files changed, 70 insertions(+), 53 deletions(-) create mode 100644 public/_redirects diff --git a/public/_redirects b/public/_redirects new file mode 100644 index 0000000..50a4633 --- /dev/null +++ b/public/_redirects @@ -0,0 +1 @@ +/* /index.html 200 \ No newline at end of file diff --git a/src/components/MobileMenu.jsx b/src/components/MobileMenu.jsx index 28775cf..140c8f3 100644 --- a/src/components/MobileMenu.jsx +++ b/src/components/MobileMenu.jsx @@ -1,17 +1,19 @@ // react import React from 'react'; -import { Link } from 'react-router-dom'; +import { Link, useLocation} from 'react-router-dom'; import { AiOutlineClose } from 'react-icons/ai'; import { RiLayoutHorizontalFill, RiUser3Fill } from 'react-icons/ri'; import { MdForum } from "react-icons/md"; import { PiListBulletsFill } from 'react-icons/pi'; const MobileMenu = ({ isOpen, toggleMenu }) => { + const location = useLocation(); + const navLinks = [ { name: 'Dashboard', href: '/dashboard', icon: PiListBulletsFill }, { name: 'Detox Challenge', - href: '/detoxChallenge', + href: '/Challenges', icon: RiLayoutHorizontalFill, }, { @@ -44,22 +46,28 @@ const MobileMenu = ({ isOpen, toggleMenu }) => { {/* Links with Icons */} diff --git a/src/components/Navbar.jsx b/src/components/Navbar.jsx index eb185bf..09ceb33 100644 --- a/src/components/Navbar.jsx +++ b/src/components/Navbar.jsx @@ -1,6 +1,6 @@ //react import React, { useState, useEffect } from 'react'; -import { Link, useNavigate } from 'react-router-dom'; +import { Link, useNavigate, useLocation } from 'react-router-dom'; //icons import { MdOutlineLogin } from 'react-icons/md'; @@ -17,6 +17,7 @@ function Navbar() { const [isMenuOpen, setIsMenuOpen] = useState(false); // mobile menu state const [isAuthenticated, setIsAuthenticated] = useState(false); // user authentication state const navigate = useNavigate(); + const location = useLocation(); // check authentication from localstorage useEffect(() => { @@ -117,38 +118,45 @@ function Navbar() { >
{ return ( -
+
-

+

Community Forum