From d6eebeac4ae76882366215b1b6bb5113dc6c23d7 Mon Sep 17 00:00:00 2001 From: PrathamX595 Date: Mon, 1 Jul 2024 00:33:10 +0530 Subject: [PATCH] fixed conflicts --- frontend/src/Navbar.tsx | 134 +++++++++++++++++++++++----------------- 1 file changed, 78 insertions(+), 56 deletions(-) diff --git a/frontend/src/Navbar.tsx b/frontend/src/Navbar.tsx index 3c80690..f15fa22 100644 --- a/frontend/src/Navbar.tsx +++ b/frontend/src/Navbar.tsx @@ -130,6 +130,34 @@ const rules = ( const Navbar: React.FC = () => { const [sidebarOpen, setSidebarOpen] = useState(false); + const links = [ + { + text: 'Login', + type: 'link', + callback: () => navigate('/login'), + }, + { + text: 'Logout', + type: 'link', + callback: () => auth.logout, + }, + { + text: 'About Us', + type: 'modal', + callback: () => + modal.show('aboutUsModal', aboutUs, 'large', [ + { text: 'Close', type: 'submit' }, + ]), + }, + { + text: 'Rules', + type: 'modal', + callback: () => + modal.show('rulesModal', rules, 'large', [ + { text: 'Close', type: 'submit' }, + ]), + }, + ]; const auth = useAuth(); const modal = useModal(); const navigate = useNavigate(); @@ -219,67 +247,61 @@ const Navbar: React.FC = () => {
{auth.getUser()?.name}
- +
+ {links.map((link, index) => { + if ( + link.text === 'Logout' || + link.type === 'modal' + ) { + return ( +
+ +
+ ); + } + })} +
) : ( <> - +
+ {links.map((link, index) => { + if ( + link.text === 'Login' || + link.type === 'modal' + ) { + return ( +
+ +
+ ); + } + })} +
)} -
- -
-
- -