Skip to content

Commit

Permalink
fix: improve mnemonic reset warning popup modal
Browse files Browse the repository at this point in the history
  • Loading branch information
greatertomi committed Apr 29, 2024
1 parent 6dd077d commit a36c419
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,12 @@ export const WalletSetupWizard = ({
moveForward();
};

const handleCloseMnemonicResetModal = () => {
setIsResetMnemonicModalOpen(false);
setResetMnemonicStage('');
setIsBackFromNextStep(false);
};

const renderedMnemonicStep = () => {
if ([SetupType.RESTORE, SetupType.FORGOT_PASSWORD].includes(setupType)) {
const isMnemonicSubmitEnabled = util.validateMnemonic(util.joinMnemonicWords(mnemonic));
Expand Down Expand Up @@ -242,7 +248,6 @@ export const WalletSetupWizard = ({
onReset={(resetStage) => {
setResetMnemonicStage(resetStage);
resetStage === 'input' ? setIsResetMnemonicModalOpen(true) : onCancel();
resetStage === 'input' && setIsBackFromNextStep(false);
}}
renderVideoPopupContent={({ onClose }) => (
<MnemonicVideoPopupContent
Expand Down Expand Up @@ -301,17 +306,13 @@ export const WalletSetupWizard = ({
visible={isResetMnemonicModalOpen}
cancelLabel={t('browserView.walletSetup.mnemonicResetModal.cancel')}
confirmLabel={t('browserView.walletSetup.mnemonicResetModal.confirm')}
onCancel={() => {
setIsResetMnemonicModalOpen(false);
setResetMnemonicStage('');
}}
onCancel={handleCloseMnemonicResetModal}
onConfirm={() => {
handleCloseMnemonicResetModal();
setMnemonic(util.generateMnemonicWords());
setIsResetMnemonicModalOpen(false);
if (resetMnemonicStage === 'writedown') {
moveBack();
}
setResetMnemonicStage('');
}}
/>
)}
Expand Down

0 comments on commit a36c419

Please sign in to comment.