chore: if name or display name is not defined in metadata, set npub in top right
This commit is contained in:
parent
2b9617232e
commit
ba1219b790
@ -28,6 +28,7 @@ import {
|
|||||||
} from '../../routes'
|
} from '../../routes'
|
||||||
import {
|
import {
|
||||||
clearAuthToken,
|
clearAuthToken,
|
||||||
|
hexToNpub,
|
||||||
saveNsecBunkerDelegatedKey,
|
saveNsecBunkerDelegatedKey,
|
||||||
shorten
|
shorten
|
||||||
} from '../../utils'
|
} from '../../utils'
|
||||||
@ -60,13 +61,17 @@ export const AppBar = () => {
|
|||||||
setUserAvatar(picture || userRobotImage)
|
setUserAvatar(picture || userRobotImage)
|
||||||
}
|
}
|
||||||
|
|
||||||
setUsername(shorten(display_name || name || '', 7))
|
const npub = authState.usersPubkey
|
||||||
|
? hexToNpub(authState.usersPubkey)
|
||||||
|
: ''
|
||||||
|
|
||||||
|
setUsername(shorten(display_name || name || npub, 7))
|
||||||
} else {
|
} else {
|
||||||
setUserAvatar(userRobotImage || '')
|
setUserAvatar(userRobotImage || '')
|
||||||
setUsername('')
|
setUsername('')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [metadataState, userRobotImage])
|
}, [metadataState, userRobotImage, authState.usersPubkey])
|
||||||
|
|
||||||
const handleOpenUserMenu = (event: React.MouseEvent<HTMLElement>) => {
|
const handleOpenUserMenu = (event: React.MouseEvent<HTMLElement>) => {
|
||||||
setAnchorElUser(event.currentTarget)
|
setAnchorElUser(event.currentTarget)
|
||||||
|
Loading…
Reference in New Issue
Block a user