From a9bdd1f95e9216b0609176c2a760091a87052631 Mon Sep 17 00:00:00 2001 From: Sabir Hassan Date: Tue, 19 Mar 2024 14:36:34 +0500 Subject: [PATCH] chore: show npub in profile page --- src/pages/profile/index.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/pages/profile/index.tsx b/src/pages/profile/index.tsx index e452949..e3cb803 100644 --- a/src/pages/profile/index.tsx +++ b/src/pages/profile/index.tsx @@ -14,6 +14,7 @@ import { LoadingButton } from '@mui/lab' import { Dispatch } from '../../store/store' import { setMetadataEvent } from '../../store/actions' import { LoadingSpinner } from '../../components/LoadingSpinner' +import { LoginMethods } from '../../store/auth/types' export const ProfilePage = () => { const { npub } = useParams() @@ -28,7 +29,7 @@ export const ProfilePage = () => { const [savingProfileMetadata, setSavingProfileMetadata] = useState(false) const metadataState = useSelector((state: State) => state.metadata) const keys = useSelector((state: State) => state.auth?.keyPair) - const usersPubkey = useSelector((state: State) => state.auth.usersPubkey) + const { usersPubkey, loginMethod } = useSelector((state: State) => state.auth) const [isUsersOwnProfile, setIsUsersOwnProfile] = useState(false) @@ -226,10 +227,10 @@ export const ProfilePage = () => { {editItem('about', 'About', true, 4)} {isUsersOwnProfile && ( <> - {keys && - keys.public && - copyItem(nip19.npubEncode(keys.public), 'Public Key')} - {keys && + {usersPubkey && + copyItem(nip19.npubEncode(usersPubkey), 'Public Key')} + {loginMethod === LoginMethods.privateKey && + keys && keys.private && copyItem( '••••••••••••••••••••••••••••••••••••••••••••••••••',