From 945508c8952bef007ce49ef3aa86ff4b40c88ee7 Mon Sep 17 00:00:00 2001 From: David Walsh Date: Wed, 5 Jul 2023 07:57:02 -0500 Subject: [PATCH] UX: Multichain: Convert AccountDetails Popover to Modal (#19811) * UX: Multichain: Convert AccountDetails Popover to Modal * Fix E2E * updated spec file --------- Co-authored-by: NidhiKJha --- test/e2e/tests/import-flow.spec.js | 4 +- test/e2e/tests/incremental-security.spec.js | 4 +- .../account-details/account-details.js | 137 ++++++++---------- 3 files changed, 63 insertions(+), 82 deletions(-) diff --git a/test/e2e/tests/import-flow.spec.js b/test/e2e/tests/import-flow.spec.js index 19f02219a..b89e2bbf5 100644 --- a/test/e2e/tests/import-flow.spec.js +++ b/test/e2e/tests/import-flow.spec.js @@ -51,14 +51,14 @@ describe('Import flow', function () { await driver.findVisibleElement('.qr-code__wrapper'); // shows a QR code for the account - await driver.findVisibleElement('.popover-container'); + await driver.findVisibleElement('.mm-modal'); // shows the correct account address const address = await driver.findElement( '.multichain-address-copy-button', ); assert.equal(await address.getText(), '0x0Cc...afD3'); - await driver.clickElement('[data-testid="popover-close"]'); + await driver.clickElement('.mm-modal button[aria-label="Close"]'); // logs out of the account await driver.clickElement( diff --git a/test/e2e/tests/incremental-security.spec.js b/test/e2e/tests/incremental-security.spec.js index 29535738c..e96b49c19 100644 --- a/test/e2e/tests/incremental-security.spec.js +++ b/test/e2e/tests/incremental-security.spec.js @@ -78,8 +78,8 @@ describe('Incremental Security', function () { const publicAddress = await address.getText(); // wait for account modal to be visible - const accountModal = await driver.findVisibleElement('.popover-bg'); - await driver.clickElement('[data-testid="popover-close"]'); + const accountModal = await driver.findVisibleElement('.mm-modal'); + await driver.clickElement('.mm-modal button[aria-label="Close"]'); // wait for account modal to be removed from DOM await accountModal.waitForElementState('hidden'); diff --git a/ui/components/multichain/account-details/account-details.js b/ui/components/multichain/account-details/account-details.js index c42401d1d..2921b0db0 100644 --- a/ui/components/multichain/account-details/account-details.js +++ b/ui/components/multichain/account-details/account-details.js @@ -1,7 +1,6 @@ import React, { useCallback, useState } from 'react'; import PropTypes from 'prop-types'; import { useDispatch, useSelector } from 'react-redux'; -import Popover from '../../ui/popover/popover.component'; import { setAccountDetailsAddress, clearAccountDetails, @@ -11,9 +10,10 @@ import { AvatarAccount, AvatarAccountSize, AvatarAccountVariant, - ButtonIcon, - IconName, - PopoverHeader, + Modal, + ModalContent, + ModalHeader, + ModalOverlay, Text, Box, } from '../../component-library'; @@ -21,9 +21,7 @@ import { getMetaMaskAccountsOrdered } from '../../../selectors'; import { useI18nContext } from '../../../hooks/useI18nContext'; import { AlignItems, - JustifyContent, TextVariant, - Size, Display, FlexDirection, } from '../../../helpers/constants/design-system'; @@ -61,85 +59,68 @@ export const AccountDetails = ({ address }) => { } address={address} size={AvatarAccountSize.Lg} + style={{ margin: '0 auto' }} /> ); return ( - { + + + + { dispatch(hideWarning()); setAttemptingExport(false); - }} - iconName={IconName.ArrowLeft} - size={Size.SM} - /> - } - > - {t('showPrivateKey')} - - ) : ( - - {avatar} - - ) - } - onClose={onClose} - > - {attemptingExport ? ( - <> - - {avatar} - + {attemptingExport ? t('showPrivateKey') : avatar} + + {attemptingExport ? ( + <> + - {name} - - - - {privateKey ? ( - - ) : ( - - )} - - ) : ( - setAttemptingExport(true)} - /> - )} - + {avatar} + + {name} + + + + {privateKey ? ( + + ) : ( + + )} + + ) : ( + setAttemptingExport(true)} + /> + )} + + ); };