From b511813db1f432cb80db8a3ffc5d4fc06a897aee Mon Sep 17 00:00:00 2001 From: jojobyte <184880+jojobyte@users.noreply.github.com> Date: Thu, 1 Feb 2024 15:46:51 -0700 Subject: [PATCH] fix(ui): :bug: show/hide pass & wallet backup on first load/setup --- src/components/dialog.js | 8 ++++---- src/main.js | 22 ++++++++++++++++++++++ src/rigs/wallet-backup.js | 2 +- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/components/dialog.js b/src/components/dialog.js index 928a1e0..ddda3c5 100644 --- a/src/components/dialog.js +++ b/src/components/dialog.js @@ -129,10 +129,10 @@ const initialState = { // resolve = res=>{}, // reject = res=>{}, ) => { - console.log( - 'handle dialog render', - state, - ) + // console.log( + // 'handle dialog render', + // state, + // ) }, handleClose: ( state, diff --git a/src/main.js b/src/main.js index 0727098..7eae9bb 100644 --- a/src/main.js +++ b/src/main.js @@ -513,6 +513,27 @@ async function main() { // .catch(console.error) } }) + document.addEventListener('input', async event => { + let { + // @ts-ignore + name: fieldName, form, + } = event?.target + + if ( + fieldName === 'show_pass' + ) { + event.stopPropagation() + event.preventDefault() + + let { pass, show_pass, } = form + + if (show_pass?.checked) { + pass.type = 'text' + } else { + pass.type = 'password' + } + } + }) document.addEventListener('change', async event => { let { // @ts-ignore @@ -690,6 +711,7 @@ async function main() { appDialogs.walletBackup.render( { wallet, + wallets, }, 'afterend', ) diff --git a/src/rigs/wallet-backup.js b/src/rigs/wallet-backup.js index 9eb654c..86119ef 100644 --- a/src/rigs/wallet-backup.js +++ b/src/rigs/wallet-backup.js @@ -98,7 +98,7 @@ export let walletBackupRig = (function (globals) { event.preventDefault() event.stopPropagation() - let storedWallet = wallets?.[appState.selectedWallet] + let storedWallet = state.wallets?.[appState.selectedWallet] let ks = storedWallet?.keystore let fde = formDataEntries(event)