Npub -> npub, yarn i18n

This commit is contained in:
Alex Gleason 2024-05-14 12:33:42 -05:00
parent 283e865006
commit bed49d1efd
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
2 changed files with 5 additions and 4 deletions

View File

@ -1,7 +1,7 @@
import { useMutation } from '@tanstack/react-query'; import { useMutation } from '@tanstack/react-query';
import { AxiosError } from 'axios'; import { AxiosError } from 'axios';
import { List as ImmutableList } from 'immutable'; import { List as ImmutableList } from 'immutable';
import { npubEncode } from 'nostr-tools/nip19'; import { nip19 } from 'nostr-tools';
import React from 'react'; import React from 'react';
import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
@ -46,7 +46,7 @@ const messages = defineMessages({
mute: { id: 'account.mute', defaultMessage: 'Mute @{name}' }, mute: { id: 'account.mute', defaultMessage: 'Mute @{name}' },
report: { id: 'account.report', defaultMessage: 'Report @{name}' }, report: { id: 'account.report', defaultMessage: 'Report @{name}' },
copy: { id: 'account.copy', defaultMessage: 'Copy link to profile' }, copy: { id: 'account.copy', defaultMessage: 'Copy link to profile' },
npub: { id: 'account.npub', defaultMessage: 'Copy user Npub' }, npub: { id: 'account.npub', defaultMessage: 'Copy user npub' },
share: { id: 'account.share', defaultMessage: 'Share @{name}\'s profile' }, share: { id: 'account.share', defaultMessage: 'Share @{name}\'s profile' },
media: { id: 'account.media', defaultMessage: 'Media' }, media: { id: 'account.media', defaultMessage: 'Media' },
blockDomain: { id: 'account.block_domain', defaultMessage: 'Hide everything from {domain}' }, blockDomain: { id: 'account.block_domain', defaultMessage: 'Hide everything from {domain}' },
@ -281,10 +281,10 @@ const Header: React.FC<IHeader> = ({ account }) => {
const handleCopyNpub: React.EventHandler<React.MouseEvent> = (e) => { const handleCopyNpub: React.EventHandler<React.MouseEvent> = (e) => {
// Check if the account object has an 'pubkey' property, convert to npub, and copy it // Check if the account object has an 'pubkey' property, convert to npub, and copy it
if (account && account.nostr.pubkey) { if (account && account.nostr.pubkey) {
const npub = npubEncode(account.nostr.pubkey); const npub = nip19.npubEncode(account.nostr.pubkey);
copy(npub); copy(npub);
} else { } else {
console.error('Account Npub is not available.'); console.error('Account npub is not available.');
} }
}; };

View File

@ -38,6 +38,7 @@
"account.mute": "Mute @{name}", "account.mute": "Mute @{name}",
"account.muted": "Muted", "account.muted": "Muted",
"account.never_active": "Never", "account.never_active": "Never",
"account.npub": "Copy user npub",
"account.patron": "Patron", "account.patron": "Patron",
"account.posts": "Posts", "account.posts": "Posts",
"account.posts_with_replies": "Posts & replies", "account.posts_with_replies": "Posts & replies",