From: Chris Duncan Date: Sat, 19 Oct 2024 09:47:42 +0000 (-0700) Subject: x-button is usable in x-menu, so start refactoring wallet and account x-select elemen... X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=369cd466ad165e2c2efc55bdd13270ec8a2accfe;p=nemo-wallet.git x-button is usable in x-menu, so start refactoring wallet and account x-select elements to use this technique. --- diff --git a/app/pages/nemo-wallet.html b/app/pages/nemo-wallet.html index ff966a4..b37e018 100644 --- a/app/pages/nemo-wallet.html +++ b/app/pages/nemo-wallet.html @@ -61,12 +61,18 @@ } async function updateWallet () { - const wallet = document.querySelector('#wallet').value - if (wallet !== '_new' && wallet !== '_import' && wallet !== '_ledger') { - return await updateAccount() - } - if (wallet === '_ledger') { - return await LedgerWallet.create() + const wallet = document.querySelector('#wallet') + const account = document.querySelector('#account') + if (wallet.value === '_ledger') { + try { + await LedgerWallet.create() + account.removeAttribute('disabled') + } catch (err) { + account.setAttribute('disabled', '') + notify.error(`Error connecting to Ledger: ${err}`) + } finally { + return + } } const form = document.querySelector('#wallet-form') const walletType = document.querySelector('#wallet-form-wallet-type') @@ -104,7 +110,7 @@ const walletSelect = document.querySelector('#wallet') const form = document.querySelector('#wallet-form') const name = form.querySelector('#wallet-form-name x-input').value - if (name === '_new' || name === '_import' || name === '_ledger') { + if (name === '_ledger') { walletSelect.value = null notify.warn(`Invalid wallet name "${name}".`) return @@ -175,7 +181,7 @@ const importTypeContainer = document.querySelector('#wallet-form-import-type') const importType = importTypeContainer.firstChild const saltContainer = document.querySelector('#wallet-form-salt') - if (walletType.value === 'bip44' && importType.value === 'mnemonic') { + if (walletType.value === 'bip44' && importType.value !== 'seed') { saltContainer.classList.remove('hide') } else { saltContainer.classList.add('hide') @@ -206,7 +212,13 @@ } async function deriveAccounts () { - const wallet = document.querySelector('#wallet').value + const wallet = document.querySelector('#wallet') + const account = document.querySelector('#account') + if (!wallet.value) { + account.value = null + notify.error(`Select a wallet first`) + return + } const form = btn.querySelector('#account-form') await console.log('deriveAccounts') } @@ -271,6 +283,11 @@ dialog .hide { display: none; } + x-button[skin="nav"].menubtn { + justify-content: flex-start; + padding: 0 12px 0 23px; + width: 100%; + } nav { align-items: flex-end; bottom: 0; @@ -309,100 +326,131 @@ - - New - - - Import - + Wallets + + + New Wallet + + + + Name + + + + + BIP-44 + BLAKE2b + + + + Salt + Optional + + + Lock + Password + + + + + Cancel + + + OK + + + + + + + + + Import Wallet + + + + Name + + + + + BIP-44 + BLAKE2b + + + + + + Import mnemonic + Import seed + + + + + + + + + Salt + Optional + + + Lock + Password + + + + + Cancel + + + OK + + + + + +
- + + Ledger
- - - - Name - - - - - BIP-44 - BLAKE2b - - - - - - Import mnemonic - Import seed - - - - - - - - - Salt - Optional - - - Lock - Password - - - - - Cancel - - - OK - - - - -
- + - - New - - - Import - + Accounts + + + New Account + + + + Name + + + + Index (optional) + + + + + Cancel + + + OK + + + + +
- - - New Account - - - - Name - - - - Index (optional) - - - - - Cancel - - - OK - - - - -