From dcdb84d0ed9183fdb0bdb09d1e408da1e4fde7b8 Mon Sep 17 00:00:00 2001 From: "plebeius.eth" Date: Mon, 25 Mar 2024 16:12:03 +0100 Subject: [PATCH] style(wallet settings): move save button --- .../wallet-settings.module.css | 8 +--- .../wallet-settings/wallet-settings.tsx | 44 +++++++++---------- 2 files changed, 23 insertions(+), 29 deletions(-) diff --git a/src/views/settings/wallet-settings/wallet-settings.module.css b/src/views/settings/wallet-settings/wallet-settings.module.css index 3e1a5cc4..95d76335 100644 --- a/src/views/settings/wallet-settings/wallet-settings.module.css +++ b/src/views/settings/wallet-settings/wallet-settings.module.css @@ -2,8 +2,8 @@ margin-bottom: 7px; } -.saveWallets{ - margin-top: 7px; +.save { + margin-left: 5px; } .walletTitle { @@ -45,10 +45,6 @@ text-decoration: underline; } -.pasteSignature button { - margin-left: 5px; -} - .show { display: block; } diff --git a/src/views/settings/wallet-settings/wallet-settings.tsx b/src/views/settings/wallet-settings/wallet-settings.tsx index 8bad11e5..5a47b59e 100644 --- a/src/views/settings/wallet-settings/wallet-settings.tsx +++ b/src/views/settings/wallet-settings/wallet-settings.tsx @@ -74,6 +74,24 @@ const CryptoWalletsForm = ({ account }: { account: Account | undefined }) => { setShowWallet(newShowWallet); }; + const save = () => { + const wallets: { [key: string]: { address: string; timestamp: number; signature: { signature: string; type: string } } } = {}; + walletsArray.forEach((wallet) => { + if (wallet.chainTicker && wallet.address && wallet.signature && wallet.timestamp) { + wallets[wallet.chainTicker] = { + address: wallet.address, + timestamp: wallet.timestamp, + signature: { + signature: wallet.signature, + type: 'eip191', + }, + }; + } + }); + setAccount({ ...account, author: { ...account.author, wallets } }); + alert(t('saved')); + }; + const walletsInputs = walletsArray.map((wallet, index) => ( <>
@@ -107,41 +125,21 @@ const CryptoWalletsForm = ({ account }: { account: Account | undefined }) => {
{t('paste_signature')}
setWalletsArrayProperty(index, 'signature', e.target.value)} value={wallet.signature} placeholder='0x...' /> +
)); - const save = () => { - const wallets: { [key: string]: { address: string; timestamp: number; signature: { signature: string; type: string } } } = {}; - walletsArray.forEach((wallet) => { - if (wallet.chainTicker && wallet.address && wallet.signature && wallet.timestamp) { - wallets[wallet.chainTicker] = { - address: wallet.address, - timestamp: wallet.timestamp, - signature: { - signature: wallet.signature, - type: 'eip191', - }, - }; - } - }); - setAccount({ ...account, author: { ...account.author, wallets } }); - alert(t('saved')); - }; - return ( <>
setWalletsArray([...walletsArray, defaultWalletObject])} /> }} />
{walletsInputs} - {walletsArray.length > 0 && ( -
- }} /> -
- )} ); };