fix: messages link

This commit is contained in:
2023-08-17 20:06:04 +01:00
parent f6a46e3523
commit 3b11f63573
2 changed files with 31 additions and 3 deletions

View File

@ -1,6 +1,8 @@
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { KieranPubKey } from "Const"; import { KieranPubKey } from "Const";
import { FormattedMessage } from "react-intl"; import { FormattedMessage } from "react-intl";
import { TLVEntryType, encodeTLVEntries, NostrPrefix } from "@snort/system";
import { bech32ToHex } from "SnortUtils";
export default function HelpPage() { export default function HelpPage() {
return ( return (
@ -12,7 +14,16 @@ export default function HelpPage() {
<FormattedMessage <FormattedMessage
defaultMessage="If you have an enquiry about your NIP-05 order please DM {link}" defaultMessage="If you have an enquiry about your NIP-05 order please DM {link}"
values={{ values={{
link: <Link to={`/messages/${KieranPubKey}`}>Kieran</Link>, link: (
<Link
to={`/messages/${encodeTLVEntries("chat4" as NostrPrefix, {
type: TLVEntryType.Author,
length: 64,
value: bech32ToHex(KieranPubKey),
})}`}>
Kieran
</Link>
),
}} }}
/> />
</p> </p>

View File

@ -2,7 +2,15 @@ import "./ProfilePage.css";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { useIntl, FormattedMessage } from "react-intl"; import { useIntl, FormattedMessage } from "react-intl";
import { useNavigate, useParams } from "react-router-dom"; import { useNavigate, useParams } from "react-router-dom";
import { encodeTLV, EventKind, HexKey, NostrPrefix, tryParseNostrLink } from "@snort/system"; import {
encodeTLV,
encodeTLVEntries,
EventKind,
HexKey,
NostrPrefix,
TLVEntryType,
tryParseNostrLink,
} from "@snort/system";
import { LNURL } from "@snort/shared"; import { LNURL } from "@snort/shared";
import { useUserProfile } from "@snort/system-react"; import { useUserProfile } from "@snort/system-react";
@ -325,7 +333,16 @@ export default function ProfilePage() {
)} )}
{loginPubKey && ( {loginPubKey && (
<> <>
<IconButton onClick={() => navigate(`/messages/${hexToBech32(NostrPrefix.PublicKey, id)}`)}> <IconButton
onClick={() =>
navigate(
`/messages/${encodeTLVEntries("chat4" as NostrPrefix, {
type: TLVEntryType.Author,
length: 64,
value: id,
})}`
)
}>
<Icon name="envelope" size={16} /> <Icon name="envelope" size={16} />
</IconButton> </IconButton>
</> </>