This commit is contained in:
Ren Amamiya
2023-04-05 09:48:57 +07:00
parent fc8dc8fd0d
commit beb622f05e
13 changed files with 23 additions and 233 deletions

View File

@@ -19,11 +19,11 @@ export const ActiveAccount = memo(function ActiveAccount({ user }: { user: any }
const userData = JSON.parse(user.metadata);
const openProfilePage = () => {
router.push(`/users/${user.id}`);
router.push(`/users/${user.pubkey}`);
};
const copyPublicKey = async () => {
await writeText(nip19.npubEncode(user.id));
await writeText(nip19.npubEncode(user.pubkey));
};
const insertFollowsToStorage = useCallback(
@@ -46,7 +46,7 @@ export const ActiveAccount = memo(function ActiveAccount({ user }: { user: any }
[
{
kinds: [3],
authors: [user.id],
authors: [user.pubkey],
},
],
relays,
@@ -65,7 +65,7 @@ export const ActiveAccount = memo(function ActiveAccount({ user }: { user: any }
return () => {
unsubscribe;
};
}, [insertFollowsToStorage, pool, relays, user.id]);
}, [insertFollowsToStorage, pool, relays, user.pubkey]);
return (
<DropdownMenu.Root>

View File

@@ -12,13 +12,13 @@ import { useCallback, useEffect, useState } from 'react';
export default function MultiAccounts() {
const [users, setUsers] = useState([]);
const renderAccount = useCallback((user: { id: string }) => {
const renderAccount = useCallback((user: { pubkey: string }) => {
const activeAccount = JSON.parse(localStorage.getItem('activeAccount'));
if (user.id === activeAccount.id) {
return <ActiveAccount key={user.id} user={user} />;
if (user.pubkey === activeAccount.pubkey) {
return <ActiveAccount key={user.pubkey} user={user} />;
} else {
return <InactiveAccount key={user.id} user={user} />;
return <InactiveAccount key={user.pubkey} user={user} />;
}
}, []);