@@ -2,7 +2,6 @@ import { useState, useRef, useEffect, Fragment } from "react";
22// import { useState, Fragment } from "react";
33import accountLogo from "../../assets/account.svg" ;
44import { Link , useNavigate , useLocation } from "react-router-dom" ;
5- import LoginMenuDropDown from "./LoginMenuDropDown" ;
65import "../../components/Header/header.css" ;
76import Chat from "./Chat" ;
87import { FeatureMenuDropDown } from "./FeatureMenuDropDown" ;
@@ -24,7 +23,6 @@ const Header: React.FC<LoginFormProps> = ({ isAuthenticated, isSuperuser }) => {
2423 const dropdownRef = useRef ( null ) ;
2524 let delayTimeout : number | null = null ;
2625 const [ showChat , setShowChat ] = useState ( false ) ;
27- const [ showLoginMenu , setShowLoginMenu ] = useState ( false ) ;
2826 const [ redirect , setRedirect ] = useState ( false ) ;
2927 const { setShowSummary, setEnterNewPatient, triggerFormReset, setIsEditing } =
3028 useGlobalContext ( ) ;
@@ -36,19 +34,6 @@ const Header: React.FC<LoginFormProps> = ({ isAuthenticated, isSuperuser }) => {
3634 setRedirect ( false ) ;
3735 } ;
3836
39- const guestLinks = ( ) => (
40- < nav onClick = { handleLoginMenu } className = "flex cursor-pointer items-center" >
41- < img
42- src = { accountLogo }
43- alt = "logo"
44- className = "mr-5 h-5 object-contain lg:h-4 "
45- />
46- < span className = " text-black hover:border-b-2 hover:border-blue-600 hover:text-black hover:no-underline lg:text-sm xl:text-lg" >
47- Sign in
48- </ span >
49- </ nav >
50- ) ;
51-
5237 const authLinks = ( ) => (
5338 < nav onClick = { logout_user } className = "flex cursor-pointer items-center" >
5439 < img src = { accountLogo } alt = "logo" className = "mr-5 h-5 object-contain " />
@@ -58,10 +43,6 @@ const Header: React.FC<LoginFormProps> = ({ isAuthenticated, isSuperuser }) => {
5843 </ nav >
5944 ) ;
6045
61- const handleLoginMenu = ( ) => {
62- setShowLoginMenu ( ! showLoginMenu ) ;
63- } ;
64-
6546 const handleMouseEnter = ( ) => {
6647 if ( delayTimeout !== null ) {
6748 clearTimeout ( delayTimeout ) ;
@@ -136,7 +117,7 @@ const Header: React.FC<LoginFormProps> = ({ isAuthenticated, isSuperuser }) => {
136117 Balancer
137118 </ span >
138119 </ Link >
139- < nav className = " flex space-x-2 font-satoshi lg:space-x-3 xl:gap-3 xl:font-bold " >
120+ < nav className = "flex space-x-2 font-satoshi lg:space-x-3 xl:gap-3 xl:font-bold " >
140121 < Link
141122 to = "/"
142123 onClick = { ( ) => handleForm ( ) }
@@ -196,7 +177,7 @@ const Header: React.FC<LoginFormProps> = ({ isAuthenticated, isSuperuser }) => {
196177 >
197178 Donate
198179 </ a >
199- { isSuperuser && (
180+ { ( isAuthenticated && isSuperuser ) && (
200181 < div
201182 onMouseEnter = { handleMouseEnter }
202183 onMouseLeave = { handleMouseLeave }
@@ -230,15 +211,12 @@ const Header: React.FC<LoginFormProps> = ({ isAuthenticated, isSuperuser }) => {
230211 { redirect ? navigate ( "/" ) : < Fragment > </ Fragment > }
231212 </ >
232213 </ nav >
233- < LoginMenuDropDown
234- showLoginMenu = { showLoginMenu }
235- handleLoginMenu = { handleLoginMenu }
236- />
237214 { isAuthenticated && (
238- < Chat showChat = { showChat } setShowChat = { setShowChat } />
215+ < >
216+ < Chat showChat = { showChat } setShowChat = { setShowChat } />
217+ </ >
239218 ) }
240- { /* <Chat showChat={showChat} setShowChat={setShowChat} /> */ }
241- { isAuthenticated ? authLinks ( ) : guestLinks ( ) }
219+ { isAuthenticated && authLinks ( ) }
242220 </ div >
243221 < MdNavBar handleForm = { handleForm } isAuthenticated = { isAuthenticated } />
244222 </ header >
0 commit comments