@@ -9,20 +9,14 @@ import { Link, useLocation, useNavigate } from 'react-router-dom'
99import { ReactComponent as HackertabLogo } from 'src/assets/logo.svg'
1010import { SearchBar } from 'src/components/Elements/SearchBar'
1111import { UserTags } from 'src/components/Elements/UserTags'
12- import { AuthModal , useAuth } from 'src/features/auth'
12+ import { useAuth } from 'src/features/auth'
1313import { Changelog } from 'src/features/changelog'
1414import { identifyUserTheme , trackDNDDisable , trackThemeSelect } from 'src/lib/analytics'
1515import { useBookmarks } from 'src/stores/bookmarks'
1616import { useUserPreferences } from 'src/stores/preferences'
1717
1818export const Header = ( ) => {
19- const { user } = useAuth ( )
20- const [ showAuth , setshowAuth ] = useState ( false )
21- useEffect ( ( ) => {
22- if ( user != null ) {
23- setshowAuth ( false )
24- }
25- } )
19+ const { setIsAuthShowing, user, isConnected } = useAuth ( )
2620
2721 const [ themeIcon , setThemeIcon ] = useState ( < BsMoonFill /> )
2822 const { theme, setTheme, setDNDDuration, isDNDModeActive } = useUserPreferences ( )
@@ -73,8 +67,6 @@ export const Header = () => {
7367
7468 return (
7569 < >
76- { < AuthModal showAuth = { showAuth } setShowAuth = { setshowAuth } /> }
77-
7870 < header className = "AppHeader" >
7971 < span className = "AppName" >
8072 < i className = "logo" >
@@ -108,16 +100,16 @@ export const Header = () => {
108100 < BookmarksBadgeCount />
109101 </ >
110102 </ Link >
111- { user != null ? (
112- < Link to = "/settings/profile" className = "extraBtn" aria-label = "Open profile" >
113- < img className = "profileImage" src = { user . imageURL } />
103+ { isConnected ( ) ? (
104+ < Link to = "/settings/profile" aria-label = "Open profile" >
105+ < img className = "profileImage" src = { user ? .imageURL } />
114106 </ Link >
115107 ) : (
116108 < button
117109 aria-label = "open login"
118110 className = "extraBtn"
119111 onClick = { ( ) => {
120- setshowAuth ( true )
112+ setIsAuthShowing ( true )
121113 } } >
122114 < FaUserLarge />
123115 </ button >
0 commit comments