From ba1219b790e9e51a413561c5c2fdc6acb4f36e2e Mon Sep 17 00:00:00 2001 From: SwiftHawk Date: Thu, 30 May 2024 22:36:17 +0500 Subject: [PATCH] chore: if name or display name is not defined in metadata, set npub in top right --- src/components/AppBar/AppBar.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/AppBar/AppBar.tsx b/src/components/AppBar/AppBar.tsx index 6d54e77..1bc1839 100644 --- a/src/components/AppBar/AppBar.tsx +++ b/src/components/AppBar/AppBar.tsx @@ -28,6 +28,7 @@ import { } from '../../routes' import { clearAuthToken, + hexToNpub, saveNsecBunkerDelegatedKey, shorten } from '../../utils' @@ -60,13 +61,17 @@ export const AppBar = () => { setUserAvatar(picture || userRobotImage) } - setUsername(shorten(display_name || name || '', 7)) + const npub = authState.usersPubkey + ? hexToNpub(authState.usersPubkey) + : '' + + setUsername(shorten(display_name || name || npub, 7)) } else { setUserAvatar(userRobotImage || '') setUsername('') } } - }, [metadataState, userRobotImage]) + }, [metadataState, userRobotImage, authState.usersPubkey]) const handleOpenUserMenu = (event: React.MouseEvent) => { setAnchorElUser(event.currentTarget)