From f7e7ff96c09b01f6f988d1597b26f6ca3a0a3e7a Mon Sep 17 00:00:00 2001 From: Nidhi Kumari Date: Thu, 27 Apr 2023 21:15:11 +0530 Subject: [PATCH 1/3] Ux Multichain: Hide search input for single account (#18798) * hide search input for single account * updated test for single account with no search * nit fix * nit fix * added search test for more than one account --------- Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com> --- .../account-list-menu/account-list-menu.js | 25 +++++++++----- .../account-list-menu.test.js | 33 +++++++++++++++++++ 2 files changed, 49 insertions(+), 9 deletions(-) diff --git a/ui/components/multichain/account-list-menu/account-list-menu.js b/ui/components/multichain/account-list-menu/account-list-menu.js index 2e867fa91133..a53ab95ac964 100644 --- a/ui/components/multichain/account-list-menu/account-list-menu.js +++ b/ui/components/multichain/account-list-menu/account-list-menu.js @@ -79,15 +79,22 @@ export const AccountListMenu = ({ onClose }) => { > {/* Search box */} - - setSearchQuery(e.target.value)} - /> - + {accounts.length > 1 ? ( + + setSearchQuery(e.target.value)} + /> + + ) : null} {/* Account list block */} {searchResults.length === 0 && searchQuery !== '' ? ( diff --git a/ui/components/multichain/account-list-menu/account-list-menu.test.js b/ui/components/multichain/account-list-menu/account-list-menu.test.js index 2d34652b79a2..297ada6cbc01 100644 --- a/ui/components/multichain/account-list-menu/account-list-menu.test.js +++ b/ui/components/multichain/account-list-menu/account-list-menu.test.js @@ -100,4 +100,37 @@ describe('AccountListMenu', () => { getByTestId('multichain-account-menu-no-results'), ).toBeInTheDocument(); }); + + it('should not render search bar when there is only one account', () => { + const mockStore = configureStore({ + activeTab: { + title: 'Eth Sign Tests', + origin: 'https://remix.ethereum.org', + protocol: 'https:', + url: 'https://remix.ethereum.org/', + }, + metamask: { + ...mockState.metamask, + accounts: { + '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc': { + balance: '0x346ba7725f412cbfdb', + address: '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc', + }, + }, + }, + }); + const props = { onClose: () => jest.fn() }; + const { container } = renderWithProvider( + , + mockStore, + ); + const searchBox = container.querySelector('input[type=search]'); + expect(searchBox).not.toBeInTheDocument(); + }); + + it('should render search bar when there is more than one account', () => { + render(); + const searchBox = document.querySelector('input[type=search]'); + expect(searchBox).toBeInTheDocument(); + }); }); From d58b1f9aa7ac4b151eae4add9098b490c318d448 Mon Sep 17 00:00:00 2001 From: Frederik Bolding Date: Thu, 27 Apr 2023 17:48:04 +0200 Subject: [PATCH 2/3] Add snaps entries to CODEOWNERS (#18825) * Add snaps entry to CODEOWNERS * Add flask entry --- .github/CODEOWNERS | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index bb69a38633f8..2008248f1db2 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,20 +1,22 @@ # Lines starting with '#' are comments. # Each line is a file pattern followed by one or more owners. # Owners bear a responsibility to the organization and the users of this -# application. Repository administrators have the ability to merge pull -# requests that have not yet received the requisite reviews as outlined -# in this file. Do not force merge any PR without confidence that it -# follows all policies or without full understanding of the impact of +# application. Repository administrators have the ability to merge pull +# requests that have not yet received the requisite reviews as outlined +# in this file. Do not force merge any PR without confidence that it +# follows all policies or without full understanding of the impact of # those changes on build, release and publishing outcomes. * @MetaMask/extension-devs development/ @MetaMask/extension-devs @kumavis lavamoat/ @MetaMask/supply-chain +**/snaps/** @MetaMask/snaps-devs +**/flask/** @MetaMask/snaps-devs # The .circleci/ folder instructs Circle CI on the process by which it # should test, build and publish releases of our application. Due to the # impact that changes to the files contained within this folder may have -# on our releases, only those with the knowledge and responsibility to +# on our releases, only those with the knowledge and responsibility to # publish libraries under the MetaMask name may approve those changes. # Note to reviewers: We employ the use of CircleCI "Orbs", which are # remotely hosted sections of CircleCI configuration and scripts, to From f6210927dd4cbb7948bcbfc484cc32017e355431 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Thu, 27 Apr 2023 18:06:49 +0200 Subject: [PATCH 3/3] Part of #17670: Replace Typography with Text component in RecoveryPhraseReminder (#18639) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add story * replace Typograhy with Text * import ordering * FONT_WEIGHT → FontWeight --------- Co-authored-by: Danica Shen Co-authored-by: Brad Decker --- .../recovery-phrase-reminder.js | 36 +++++++++---------- .../recovery-phrase-reminder.stories.js | 23 ++++++++++++ 2 files changed, 40 insertions(+), 19 deletions(-) create mode 100644 ui/components/app/recovery-phrase-reminder/recovery-phrase-reminder.stories.js diff --git a/ui/components/app/recovery-phrase-reminder/recovery-phrase-reminder.js b/ui/components/app/recovery-phrase-reminder/recovery-phrase-reminder.js index 0448be40c6fb..3343110767cb 100644 --- a/ui/components/app/recovery-phrase-reminder/recovery-phrase-reminder.js +++ b/ui/components/app/recovery-phrase-reminder/recovery-phrase-reminder.js @@ -6,14 +6,14 @@ import { useI18nContext } from '../../../hooks/useI18nContext'; import Box from '../../ui/box'; import Button from '../../ui/button'; import Popover from '../../ui/popover'; -import Typography from '../../ui/typography'; +import { Text } from '../../component-library'; // Helpers import { DISPLAY, TEXT_ALIGN, - TypographyVariant, + TextVariant, BLOCK_SIZES, - FONT_WEIGHT, + FontWeight, JustifyContent, TextColor, } from '../../../helpers/constants/design-system'; @@ -35,27 +35,25 @@ export default function RecoveryPhraseReminder({ onConfirm, hasBackedUp }) { paddingLeft={4} className="recovery-phrase-reminder" > - {t('recoveryPhraseReminderSubText')} - +
    -
  • - - {t('recoveryPhraseReminderItemOne')} - -
  • -
  • {t('recoveryPhraseReminderItemTwo')}
  • -
  • + + {t('recoveryPhraseReminderItemOne')} + + {t('recoveryPhraseReminderItemTwo')} + {hasBackedUp ? ( t('recoveryPhraseReminderHasBackedUp') ) : ( @@ -75,7 +73,7 @@ export default function RecoveryPhraseReminder({ onConfirm, hasBackedUp }) { )} -
  • +
diff --git a/ui/components/app/recovery-phrase-reminder/recovery-phrase-reminder.stories.js b/ui/components/app/recovery-phrase-reminder/recovery-phrase-reminder.stories.js new file mode 100644 index 000000000000..d8fb85216425 --- /dev/null +++ b/ui/components/app/recovery-phrase-reminder/recovery-phrase-reminder.stories.js @@ -0,0 +1,23 @@ +import React from 'react'; +import RecoveryPhraseReminder from '.'; + +export default { + title: 'Components/App/RecoveryPhraseReminder', + + argTypes: { + hasBackedUp: { + control: 'boolean', + }, + onConfirm: { + action: 'onConfirm', + }, + }, + args: { + hasBackedUp: false, + onConfirm: () => console.log('onConfirm fired'), + }, +}; + +export const DefaultStory = (args) => ; + +DefaultStory.storyName = 'Default';