mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-06-08 10:22:47 -04:00
enhancement: use isLoggedIn hook
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
parent
8e10fb6804
commit
3dfad0cea5
5 changed files with 19 additions and 10 deletions
|
@ -3,15 +3,15 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
import { SignInButton } from '../../../landing-layout/navigation/sign-in-button'
|
||||
import { UserDropdown } from '../../../landing-layout/navigation/user-dropdown'
|
||||
import React from 'react'
|
||||
import { useIsLoggedIn } from '../../../../hooks/common/use-is-logged-in'
|
||||
|
||||
/**
|
||||
* Renders either the user dropdown or the sign-in button depending on the user state.
|
||||
*/
|
||||
export const UserElement: React.FC = () => {
|
||||
const userExists = useApplicationState((state) => !!state.user)
|
||||
const userExists = useIsLoggedIn()
|
||||
return userExists ? <UserDropdown /> : <SignInButton size={'sm'} className={'h-100'} />
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue