fix profile qr code & id
This commit is contained in:
@ -3,7 +3,6 @@ import { useEffect, useState } from "react";
|
|||||||
import { FormattedMessage } from "react-intl";
|
import { FormattedMessage } from "react-intl";
|
||||||
import { useLocation, useNavigate, useParams } from "react-router-dom";
|
import { useLocation, useNavigate, useParams } from "react-router-dom";
|
||||||
import {
|
import {
|
||||||
encodeTLV,
|
|
||||||
encodeTLVEntries,
|
encodeTLVEntries,
|
||||||
EventKind,
|
EventKind,
|
||||||
MetadataCache,
|
MetadataCache,
|
||||||
@ -12,10 +11,10 @@ import {
|
|||||||
TLVEntryType,
|
TLVEntryType,
|
||||||
tryParseNostrLink,
|
tryParseNostrLink,
|
||||||
} from "@snort/system";
|
} from "@snort/system";
|
||||||
import { LNURL, fetchNip05Pubkey } from "@snort/shared";
|
import { fetchNip05Pubkey, LNURL } from "@snort/shared";
|
||||||
import { useUserProfile } from "@snort/system-react";
|
import { useUserProfile } from "@snort/system-react";
|
||||||
|
|
||||||
import { findTag, getLinkReactions, unwrap } from "@/SnortUtils";
|
import { findTag, getLinkReactions, hexToBech32, parseId, unwrap } from "@/SnortUtils";
|
||||||
import Note from "@/Element/Event/Note";
|
import Note from "@/Element/Event/Note";
|
||||||
import { Tab, TabElement } from "@/Element/Tabs";
|
import { Tab, TabElement } from "@/Element/Tabs";
|
||||||
import Icon from "@/Icons/Icon";
|
import Icon from "@/Icons/Icon";
|
||||||
@ -23,7 +22,6 @@ import useFollowsFeed from "@/Feed/FollowsFeed";
|
|||||||
import useProfileBadges from "@/Feed/BadgesFeed";
|
import useProfileBadges from "@/Feed/BadgesFeed";
|
||||||
import useModeration from "@/Hooks/useModeration";
|
import useModeration from "@/Hooks/useModeration";
|
||||||
import FollowButton from "@/Element/User/FollowButton";
|
import FollowButton from "@/Element/User/FollowButton";
|
||||||
import { parseId } from "@/SnortUtils";
|
|
||||||
import Avatar from "@/Element/User/Avatar";
|
import Avatar from "@/Element/User/Avatar";
|
||||||
import Timeline from "@/Element/Feed/Timeline";
|
import Timeline from "@/Element/Feed/Timeline";
|
||||||
import Text from "@/Element/Text";
|
import Text from "@/Element/Text";
|
||||||
@ -298,7 +296,8 @@ export default function ProfilePage({ id: propId, state }: ProfilePageProps) {
|
|||||||
function renderIcons() {
|
function renderIcons() {
|
||||||
if (!id) return;
|
if (!id) return;
|
||||||
|
|
||||||
const link = encodeTLV(CONFIG.profileLinkPrefix, id);
|
const profileId = hexToBech32(CONFIG.profileLinkPrefix, id);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<IconButton onClick={() => setShowProfileQr(true)} icon={{ name: "qr", size: 16 }} />
|
<IconButton onClick={() => setShowProfileQr(true)} icon={{ name: "qr", size: 16 }} />
|
||||||
@ -306,8 +305,8 @@ export default function ProfilePage({ id: propId, state }: ProfilePageProps) {
|
|||||||
<Modal id="profile-qr" className="qr-modal" onClose={() => setShowProfileQr(false)}>
|
<Modal id="profile-qr" className="qr-modal" onClose={() => setShowProfileQr(false)}>
|
||||||
<ProfileImage pubkey={id} />
|
<ProfileImage pubkey={id} />
|
||||||
<div className="flex flex-col items-center">
|
<div className="flex flex-col items-center">
|
||||||
<QrCode data={link} className="m10" />
|
<QrCode data={`nostr:${profileId}`} className="m10" />
|
||||||
<Copy text={link} className="py-3" />
|
<Copy text={profileId} className="py-3" />
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
)}
|
)}
|
||||||
|
Reference in New Issue
Block a user