diff --git a/client/src/components/Navbar.jsx b/client/src/components/Navbar.jsx index 258115f..703fe35 100644 --- a/client/src/components/Navbar.jsx +++ b/client/src/components/Navbar.jsx @@ -31,6 +31,10 @@ const Navbar = () => { const handleToggleMode = () => { setDark(dark === 'light' ? 'dark' : 'light'); }; + const handleLogoutlocal = () => { + localStorage.removeItem('basicDetails'); + window.location.reload(); + }; // Scroll event listener const controlNavbar = useCallback(() => { @@ -185,6 +189,15 @@ const Navbar = () => { )} + + {localStorage.getItem('basicDetails') ? ( + + {isAuthenticated ? ( <> {/* Profile Avatar with Name */} @@ -213,6 +226,7 @@ const Navbar = () => { Log Out + ) : (
{

About

+ + + {' '} +

Lab Test

+
+ + {/* Add the new Hospitals Around Link for Desktop */} + + +

+ Hospitals Around +

+
+ + {localStorage.getItem('basicDetails') ? ( + {/* Conditional Links */} {!isAuthenticated && ( @@ -271,6 +301,7 @@ const Navbar = () => { {/* Show Lab Tests and Hospitals Around for regular user */} {isAuthenticated && user?.role === 'user' && ( + <> @@ -284,18 +315,38 @@ const Navbar = () => {

+ + ) : ( + + + )} {/* Show only Hospitals Around for hospital */} {isAuthenticated && user?.role === 'hospital' && ( +

Hospitals Around

)} + +
+ {localStorage.getItem('basicDetails') ? ( + + {isAuthenticated ? ( <> {/* Profile Avatar with Name */} @@ -328,6 +379,7 @@ const Navbar = () => { Log Out + ) : (
{ e.preventDefault(); @@ -91,23 +90,29 @@ function StepOne() { })); return; } - nextStep(); + + // Store basicDetails in localStorage + localStorage.setItem('basicDetails', JSON.stringify(basicDetails)); + + nextStep(); // Move to the next step }; return ( <>
@@ -115,10 +120,11 @@ function StepOne() { name="type" value={basicDetails.type} onChange={handleChange} - className={`${dark === 'dark' - ? 'bg-gray-800 text-yellow-400 border-yellow-400' - : 'bg-white text-gray-700 border-gray-300' - }`} + className={`${ + dark === 'dark' + ? 'bg-gray-800 text-yellow-400 border-yellow-400' + : 'bg-white text-gray-700 border-gray-300' + }`} > @@ -128,10 +134,11 @@ function StepOne() {