fix(profile): convert page id to npub bech32

This commit is contained in:
Fernando López Guevara 2023-02-16 14:19:40 -03:00
parent 3b68153105
commit f698806b82

View File

@ -75,6 +75,8 @@ export default function ProfilePage() {
users: new Map(), users: new Map(),
creator: "", creator: "",
}); });
const npub = !id.startsWith("npub") ? hexToBech32("npub", id || undefined) : id;
const lnurl = extractLnAddress(user?.lud16 || user?.lud06 || ""); const lnurl = extractLnAddress(user?.lud16 || user?.lud06 || "");
const website_url = const website_url =
user?.website && !user.website.startsWith("http") ? "https://" + user.website : user?.website || ""; user?.website && !user.website.startsWith("http") ? "https://" + user.website : user?.website || "";
@ -121,7 +123,7 @@ export default function ProfilePage() {
<FollowsYou followsMe={follows.includes(id)} /> <FollowsYou followsMe={follows.includes(id)} />
</h2> </h2>
{user?.nip05 && <Nip05 nip05={user.nip05} pubkey={user.pubkey} />} {user?.nip05 && <Nip05 nip05={user.nip05} pubkey={user.pubkey} />}
<Copy text={params.id || ""} /> <Copy text={npub} />
{links()} {links()}
</div> </div>
); );