diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json
index de66494e2..c0564e7fc 100644
--- a/app/_locales/en/messages.json
+++ b/app/_locales/en/messages.json
@@ -1753,8 +1753,11 @@
"hardwareWallets": {
"message": "Connect a hardware wallet"
},
+ "hardwareWalletsInfo": {
+ "message": "Hardware wallet integrations use API calls to external servers, which can see your IP address and the smart contract addresses you interact with."
+ },
"hardwareWalletsMsg": {
- "message": "Select a hardware wallet you'd like to use with MetaMask."
+ "message": "Select a hardware wallet you would like to use with MetaMask."
},
"here": {
"message": "here",
diff --git a/ui/pages/create-account/connect-hardware/__snapshots__/index.test.tsx.snap b/ui/pages/create-account/connect-hardware/__snapshots__/index.test.tsx.snap
index 5284b9760..c91962937 100644
--- a/ui/pages/create-account/connect-hardware/__snapshots__/index.test.tsx.snap
+++ b/ui/pages/create-account/connect-hardware/__snapshots__/index.test.tsx.snap
@@ -3,21 +3,35 @@
exports[`ConnectHardwareForm should match snapshot 1`] = `
+
- Select a hardware wallet you'd like to use with MetaMask.
-
+ Select a hardware wallet you would like to use with MetaMask.
+
Continue
+
+ Hardware wallet integrations use API calls to external servers, which can see your IP address and the smart contract addresses you interact with.
+
`;
diff --git a/ui/pages/create-account/connect-hardware/account-list.js b/ui/pages/create-account/connect-hardware/account-list.js
index 1100b5d15..f41bb0992 100644
--- a/ui/pages/create-account/connect-hardware/account-list.js
+++ b/ui/pages/create-account/connect-hardware/account-list.js
@@ -263,7 +263,7 @@ AccountList.propTypes = {
onUnlockAccounts: PropTypes.func,
onCancel: PropTypes.func,
onAccountRestriction: PropTypes.func,
- hdPaths: PropTypes.array.isRequired,
+ hdPaths: PropTypes.object.isRequired,
};
AccountList.contextTypes = {
diff --git a/ui/pages/create-account/connect-hardware/account-list.test.js b/ui/pages/create-account/connect-hardware/account-list.test.js
index 608548117..d9922f882 100644
--- a/ui/pages/create-account/connect-hardware/account-list.test.js
+++ b/ui/pages/create-account/connect-hardware/account-list.test.js
@@ -14,7 +14,7 @@ const render = () => {
});
const props = {
- selectedPath: TREZOR_HD_PATHS[0].path,
+ selectedPath: TREZOR_HD_PATHS[0].value,
device: 'trezor',
accounts: [
{
diff --git a/ui/pages/create-account/connect-hardware/index.js b/ui/pages/create-account/connect-hardware/index.js
index 717192998..e55d16c01 100644
--- a/ui/pages/create-account/connect-hardware/index.js
+++ b/ui/pages/create-account/connect-hardware/index.js
@@ -371,6 +371,7 @@ class ConnectHardwareForm extends Component {
connectToHardwareWallet={this.connectToHardwareWallet}
browserSupported={this.state.browserSupported}
ledgerTransportType={this.props.ledgerTransportType}
+ onCancel={this.onCancel}
/>
);
}
diff --git a/ui/pages/create-account/connect-hardware/index.scss b/ui/pages/create-account/connect-hardware/index.scss
index 3e9f1f79a..16d2f18b8 100644
--- a/ui/pages/create-account/connect-hardware/index.scss
+++ b/ui/pages/create-account/connect-hardware/index.scss
@@ -1,5 +1,4 @@
.hw-tutorial {
- width: 375px;
overflow: visible;
display: block;
padding: 15px 30px;
@@ -8,21 +7,8 @@
.hw-connect {
width: 100%;
- &__header {
- &__title {
- @include H3;
-
- margin-top: 5px;
- margin-bottom: 15px;
- }
-
- &__msg {
- @include H6;
-
- color: var(--color-text-muted);
- margin-top: 10px;
- margin-bottom: 20px;
- }
+ &__header__title-wrapper {
+ width: 100%;
}
&__QR-subtitle {
@@ -70,8 +56,8 @@
&__btn {
background: var(--color-background-alternative);
border: 1px solid var(--color-border-muted);
- height: 100px;
- width: 150px;
+ height: 148px;
+ width: 199px;
flex: 1;
display: flex;
align-items: center;
@@ -81,13 +67,13 @@
margin-right: 15px;
&__img {
- width: 95px;
+ width: 136px;
}
}
&__btn.selected {
border-color: var(--color-primary-default);
- width: 149px;
+ width: 199px;
}
&__btn:first-child {
@@ -118,13 +104,6 @@
}
}
- &__title {
- @include H4;
-
- padding-top: 10px;
- font-weight: 400;
- }
-
&__unlock-title {
@include H3;
@@ -134,12 +113,6 @@
}
&__msg {
- @include H6;
-
- color: var(--color-text-muted);
- margin-top: 10px;
- margin-bottom: 15px;
-
&-link {
@include H6;
@@ -270,10 +243,9 @@
}
.new-external-account-form {
- display: flex;
- flex-flow: column;
- align-items: center;
- padding: 15px 30px 0;
+ &.footer {
+ width: 520px;
+ }
&.unsupported-browser {
height: 210px;
diff --git a/ui/pages/create-account/connect-hardware/index.test.tsx b/ui/pages/create-account/connect-hardware/index.test.tsx
index 395fffaa1..b7503f9f2 100644
--- a/ui/pages/create-account/connect-hardware/index.test.tsx
+++ b/ui/pages/create-account/connect-hardware/index.test.tsx
@@ -28,19 +28,24 @@ jest.mock('../../../selectors', () => ({
},
}));
+const MOCK_RECENT_PAGE = '/home';
jest.mock('../../../ducks/history/history', () => ({
- getMostRecentOverviewPage: () => '',
+ getMostRecentOverviewPage: jest
+ .fn()
+ .mockImplementation(() => MOCK_RECENT_PAGE),
}));
const mockTrackEvent = jest.fn();
-
+const mockHistoryPush = jest.fn();
const mockProps = {
forgetDevice: () => jest.fn(),
showAlert: () => jest.fn(),
hideAlert: () => jest.fn(),
unlockHardwareWalletAccount: () => jest.fn(),
setHardwareWalletDefaultHdPath: () => jest.fn(),
- history: {},
+ history: {
+ push: mockHistoryPush,
+ },
defaultHdPath: "m/44'/60'/0'/0",
mostRecentOverviewPage: '',
trackEvent: () => mockTrackEvent,
@@ -83,6 +88,7 @@ const mockState = {
describe('ConnectHardwareForm', () => {
const mockStore = configureMockStore([thunk])(mockState);
+
it('should match snapshot', () => {
const { container } = renderWithProvider(
,
@@ -92,6 +98,17 @@ describe('ConnectHardwareForm', () => {
expect(container).toMatchSnapshot();
});
+ it('should close the form when close button is clicked', () => {
+ const { getByTestId } = renderWithProvider(
+ ,
+ mockStore,
+ );
+ const closeButton = getByTestId('hardware-connect-close-btn');
+ fireEvent.click(closeButton);
+ expect(mockHistoryPush).toHaveBeenCalledTimes(1);
+ expect(mockHistoryPush).toHaveBeenCalledWith(MOCK_RECENT_PAGE);
+ });
+
describe('U2F Error', () => {
it('should render a U2F error', async () => {
mockConnectHardware.mockRejectedValue(new Error('U2F Error'));
diff --git a/ui/pages/create-account/connect-hardware/select-hardware.js b/ui/pages/create-account/connect-hardware/select-hardware.js
index 62cb61c8f..2f4383ff7 100644
--- a/ui/pages/create-account/connect-hardware/select-hardware.js
+++ b/ui/pages/create-account/connect-hardware/select-hardware.js
@@ -1,7 +1,16 @@
import classnames from 'classnames';
import PropTypes from 'prop-types';
import React, { Component } from 'react';
-import Button from '../../../components/ui/button';
+import {
+ Text,
+ Box,
+ IconName,
+ ButtonIconSize,
+ ButtonIcon,
+ Button,
+ BUTTON_SIZES,
+ BUTTON_VARIANT,
+} from '../../../components/component-library';
import LogoLedger from '../../../components/ui/logo/logo-ledger';
import LogoQRBased from '../../../components/ui/logo/logo-qr-based';
import LogoTrezor from '../../../components/ui/logo/logo-trezor';
@@ -17,6 +26,16 @@ import ZENDESK_URLS from '../../../helpers/constants/zendesk-url';
import { MetaMetricsEventCategory } from '../../../../shared/constants/metametrics';
import { isManifestV3 } from '../../../../shared/modules/mv3.utils';
import { openWindow } from '../../../helpers/utils/window';
+import {
+ AlignItems,
+ Display,
+ FlexDirection,
+ FontWeight,
+ JustifyContent,
+ TextAlign,
+ TextColor,
+ TextVariant,
+} from '../../../helpers/constants/design-system';
export default class SelectHardware extends Component {
static contextTypes = {
@@ -25,6 +44,7 @@ export default class SelectHardware extends Component {
};
static propTypes = {
+ onCancel: PropTypes.func.isRequired,
connectToHardwareWallet: PropTypes.func.isRequired,
browserSupported: PropTypes.bool.isRequired,
ledgerTransportType: PropTypes.oneOf(Object.values(LedgerTransportTypes)),
@@ -127,8 +147,8 @@ export default class SelectHardware extends Component {
renderContinueButton() {
return (
+ {this.context.t('hardwareWalletsInfo')}
+
+ );
+ }
+
renderUnsupportedBrowser() {
return (
-
-
-
+
+
+
{this.context.t('browserNotSupported')}
-
-
+
+
{this.context.t('chromeRequiredForHardwareWallets')}
-
-
+
+
global.platform.openTab({
url: 'https://google.com/chrome',
@@ -160,24 +219,58 @@ export default class SelectHardware extends Component {
>
{this.context.t('downloadGoogleChrome')}
-
+
);
}
renderHeader() {
return (
-
-
- {this.context.t('hardwareWallets')}
-
-
+
+
+
+ {this.context.t('hardwareWallets')}
+
+
+
+
+
{this.context.t('hardwareWalletsMsg')}
-
-
+
+
);
}
- renderTutorialsteps() {
+ renderTutorialSteps() {
switch (this.state.selectedDevice) {
case HardwareDeviceNames.ledger:
return this.renderLedgerTutorialSteps();
@@ -233,13 +326,24 @@ export default class SelectHardware extends Component {
return (
{steps.map((step, index) => (
-
+
{step.title}
{step.renderButtons ? (
- <>
+
{
this.context.trackEvent({
category: MetaMetricsEventCategory.Navigation,
@@ -252,7 +356,7 @@ export default class SelectHardware extends Component {
{
this.context.trackEvent({
category: MetaMetricsEventCategory.Navigation,
@@ -263,7 +367,7 @@ export default class SelectHardware extends Component {
>
{this.context.t('tutorial')}
- >
+
) : null}
{step.message}
{step.asset && (
@@ -274,7 +378,7 @@ export default class SelectHardware extends Component {
alt=""
/>
)}
-
+
))}
);
@@ -303,34 +407,47 @@ export default class SelectHardware extends Component {
return (
{steps.map((step, index) => (
-
+
{step.title}
- {
- this.context.trackEvent({
- category: MetaMetricsEventCategory.Navigation,
- event: 'Clicked GridPlus Buy Now',
- });
- openWindow(HardwareAffiliateLinks.gridplus);
- }}
+
- {this.context.t('buyNow')}
-
- {
- this.context.trackEvent({
- category: MetaMetricsEventCategory.Navigation,
- event: 'Clicked GidPlus Tutorial',
- });
- openWindow(HardwareAffiliateTutorialLinks.gridplus);
- }}
- >
- {this.context.t('tutorial')}
-
+ {
+ this.context.trackEvent({
+ category: MetaMetricsEventCategory.Navigation,
+ event: 'Clicked GridPlus Buy Now',
+ });
+ openWindow(HardwareAffiliateLinks.gridplus);
+ }}
+ >
+ {this.context.t('buyNow')}
+
+ {
+ this.context.trackEvent({
+ category: MetaMetricsEventCategory.Navigation,
+ event: 'Clicked GidPlus Tutorial',
+ });
+ openWindow(HardwareAffiliateTutorialLinks.gridplus);
+ }}
+ >
+ {this.context.t('tutorial')}
+
+
{step.message}
{step.asset && (
)}
-
+
))}
);
@@ -369,34 +486,48 @@ export default class SelectHardware extends Component {
return (
{steps.map((step, index) => (
-
+
{step.title}
- {
- this.context.trackEvent({
- category: MetaMetricsEventCategory.Navigation,
- event: 'Clicked Trezor Buy Now',
- });
- openWindow(HardwareAffiliateLinks.trezor);
- }}
+
- {this.context.t('buyNow')}
-
- {
- this.context.trackEvent({
- category: MetaMetricsEventCategory.Navigation,
- event: 'Clicked Trezor Tutorial',
- });
- openWindow(HardwareAffiliateTutorialLinks.trezor);
- }}
- >
- {this.context.t('tutorial')}
-
+ {
+ this.context.trackEvent({
+ category: MetaMetricsEventCategory.Navigation,
+ event: 'Clicked Trezor Buy Now',
+ });
+ openWindow(HardwareAffiliateLinks.trezor);
+ }}
+ >
+ {this.context.t('buyNow')}
+
+ {
+ this.context.trackEvent({
+ category: MetaMetricsEventCategory.Navigation,
+ event: 'Clicked Trezor Tutorial',
+ });
+ openWindow(HardwareAffiliateTutorialLinks.trezor);
+ }}
+ >
+ {this.context.t('tutorial')}
+
+
+
{step.message}
{step.asset && (
)}
-
+
))}
);
@@ -427,7 +558,7 @@ export default class SelectHardware extends Component {
{
this.context.trackEvent({
category: MetaMetricsEventCategory.Navigation,
@@ -440,7 +571,7 @@ export default class SelectHardware extends Component {
{
this.context.trackEvent({
category: MetaMetricsEventCategory.Navigation,
@@ -462,7 +593,7 @@ export default class SelectHardware extends Component {
{
this.context.trackEvent({
category: MetaMetricsEventCategory.Navigation,
@@ -475,7 +606,7 @@ export default class SelectHardware extends Component {
{
this.context.trackEvent({
category: MetaMetricsEventCategory.Navigation,
@@ -497,7 +628,7 @@ export default class SelectHardware extends Component {
{
this.context.trackEvent({
category: MetaMetricsEventCategory.Navigation,
@@ -510,7 +641,7 @@ export default class SelectHardware extends Component {
{
this.context.trackEvent({
category: MetaMetricsEventCategory.Navigation,
@@ -530,7 +661,7 @@ export default class SelectHardware extends Component {
{this.context.t('dcent')}
{
this.context.trackEvent({
category: MetaMetricsEventCategory.Navigation,
@@ -543,7 +674,7 @@ export default class SelectHardware extends Component {
{
this.context.trackEvent({
category: MetaMetricsEventCategory.Navigation,
@@ -587,12 +718,19 @@ export default class SelectHardware extends Component {
renderConnectScreen() {
return (
-
+
{this.renderHeader()}
{this.renderButtons()}
- {this.state.selectedDevice ? this.renderTutorialsteps() : null}
+ {this.state.selectedDevice ? this.renderTutorialSteps() : null}
{this.renderContinueButton()}
-
+ {this.renderFooter()}
+
);
}
diff --git a/ui/pages/create-account/connect-hardware/select-hardware.stories.js b/ui/pages/create-account/connect-hardware/select-hardware.stories.js
index 40963b529..aa72fb900 100644
--- a/ui/pages/create-account/connect-hardware/select-hardware.stories.js
+++ b/ui/pages/create-account/connect-hardware/select-hardware.stories.js
@@ -10,6 +10,7 @@ export default {
export const DefaultStory = () => {
return (
null}
browserSupported
connectToHardwareWallet={(selectedDevice) =>
action(`Continue connect to ${selectedDevice}`)()
@@ -24,6 +25,7 @@ DefaultStory.storyName = 'Default';
export const BrowserNotSupported = () => {
return (
null}
browserSupported={false}
connectToHardwareWallet={() => undefined}
ledgerTransportType={LedgerTransportTypes.live}
diff --git a/ui/pages/create-account/create-account.component.js b/ui/pages/create-account/create-account.component.js
index e25d95800..f2bd2a14a 100644
--- a/ui/pages/create-account/create-account.component.js
+++ b/ui/pages/create-account/create-account.component.js
@@ -1,12 +1,12 @@
import React from 'react';
import { Route, Switch } from 'react-router-dom';
-import Box from '../../components/ui/box';
+import { Box } from '../../components/component-library';
import { CONNECT_HARDWARE_ROUTE } from '../../helpers/constants/routes';
import ConnectHardwareForm from './connect-hardware';
export default function CreateAccountPage() {
return (
-
+