Skip to content

Commit 6ad00fb

Browse files
Merge pull request #7 from paritytech/yuri/wallet-names
Better wallet names
2 parents 38252fd + 98463bf commit 6ad00fb

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

templates/react-papi-tailwind/src/components/AccountList.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { useAccounts } from "@reactive-dot/react";
2+
import { getWalletMetadata } from "dot-connect";
23

34
function AccountInfo({ address, name, wallet }: { address: string; name?: string, wallet: string }) {
45
return <div className="container md grid grid-cols-2 border rounded p-2 my-2">
@@ -19,11 +20,16 @@ export function AccountList() {
1920
<div>
2021
<h3 className="text-left text-lg font-bold">Connected accounts:</h3>
2122
<ul>
22-
{accounts.map((account, index) => (
23-
<li key={index}>
24-
<AccountInfo address={account.address} name={account.name} wallet={account.wallet.name} />
25-
</li>
26-
))}
23+
{accounts.map((account, index) => {
24+
const walletMeta = getWalletMetadata(account.wallet);
25+
const walletName = walletMeta?.name ?? account.wallet.name;
26+
27+
return (
28+
<li key={index}>
29+
<AccountInfo address={account.address} name={account.name} wallet={walletName} />
30+
</li>
31+
);
32+
})}
2733
</ul>
2834
</div>
2935
);

0 commit comments

Comments
 (0)