From d82f06c7103876e9d953b19d92411c64ad9e83f3 Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Mon, 30 Mar 2020 21:08:02 -0230 Subject: [PATCH] Convert Connected Sites page to modal (#8254) This commit updates the existing _Connected Sites_ section to a modal using the `Popover` component. This will serve as a base for the new modal design. --- test/e2e/permissions.spec.js | 3 +- .../connected-sites.component.js | 14 ++----- ui/app/pages/connected-sites/index.scss | 37 ------------------- ui/app/pages/home/home.component.js | 5 ++- ui/app/pages/index.scss | 2 - ui/app/pages/routes/routes.component.js | 5 +-- 6 files changed, 10 insertions(+), 56 deletions(-) delete mode 100644 ui/app/pages/connected-sites/index.scss diff --git a/test/e2e/permissions.spec.js b/test/e2e/permissions.spec.js index 8a18b5bf4..8bf97b4fb 100644 --- a/test/e2e/permissions.spec.js +++ b/test/e2e/permissions.spec.js @@ -135,7 +135,7 @@ describe('MetaMask', function () { it('shows connected sites', async function () { await driver.clickElement(By.xpath(`//button[contains(text(), 'Connected Sites')]`)) - await driver.findElement(By.css('.connected-sites__title')) + await driver.findElement(By.xpath(`//h2[contains(text(), 'Connected Sites')]`)) const domains = await driver.findClickableElements(By.css('.connected-sites-list__domain')) assert.equal(domains.length, 1) @@ -163,6 +163,7 @@ describe('MetaMask', function () { await driver.switchToWindow(extension) await driver.clickElement(By.xpath(`//button[contains(text(), 'Disconnect All')]`)) + await driver.clickElement(By.css('.popover-header__close')) const disconnectModal = await driver.findElement(By.css('span .modal')) diff --git a/ui/app/pages/connected-sites/connected-sites.component.js b/ui/app/pages/connected-sites/connected-sites.component.js index d9009e89d..4fbad5997 100644 --- a/ui/app/pages/connected-sites/connected-sites.component.js +++ b/ui/app/pages/connected-sites/connected-sites.component.js @@ -4,6 +4,7 @@ import ConnectedSitesList from '../../components/app/connected-sites-list' import { DEFAULT_ROUTE, } from '../../helpers/constants/routes' +import Popover from '../../components/ui/popover/popover.component' export default class ConnectSites extends Component { static propTypes = { @@ -19,18 +20,9 @@ export default class ConnectSites extends Component { history, } = this.props return ( -
-
-
- { this.context.t('connectedSites') } -
-
history.push(DEFAULT_ROUTE)} - /> -
+ history.push(DEFAULT_ROUTE)}> -
+ ) } } diff --git a/ui/app/pages/connected-sites/index.scss b/ui/app/pages/connected-sites/index.scss deleted file mode 100644 index b4b308bc5..000000000 --- a/ui/app/pages/connected-sites/index.scss +++ /dev/null @@ -1,37 +0,0 @@ -.connected-sites { - width: 408px; - background-color: #fff; - box-shadow: 0 0 7px 0 rgba(0, 0, 0, 0.08); - z-index: 25; - display: -webkit-box; - display: flex; - -webkit-box-orient: vertical; - -webkit-box-direction: normal; - flex-flow: column; - border-radius: 8px; - overflow-y: auto; - - @media screen and (min-width: 576px) { - max-height: 82vh; - min-height: 570px; - -webkit-box-flex: 0; - flex: 0 0 auto; - margin-right: auto; - margin-left: auto; - } - - &__header { - display: flex; - height: 67px; - justify-content: space-between; - align-items: center; - width: 100%; - padding-left: 16px; - padding-right: 16px; - border-bottom: 1px solid #C4C4C4; - } - - &__title { - @extend %header--24; - } -} \ No newline at end of file diff --git a/ui/app/pages/home/home.component.js b/ui/app/pages/home/home.component.js index 156e67805..e646fe2c7 100644 --- a/ui/app/pages/home/home.component.js +++ b/ui/app/pages/home/home.component.js @@ -1,7 +1,7 @@ import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import Media from 'react-media' -import { Redirect } from 'react-router-dom' +import { Redirect, Route } from 'react-router-dom' import { formatDate } from '../../helpers/utils/util' import HomeNotification from '../../components/app/home-notification' import DaiMigrationNotification from '../../components/app/dai-migration-component' @@ -10,6 +10,7 @@ import WalletView from '../../components/app/wallet-view' import TransactionList from '../../components/app/transaction-list' import TransactionViewBalance from '../../components/app/transaction-view-balance' import MenuBar from '../../components/app/menu-bar' +import ConnectedSites from '../connected-sites/connected-sites.component' import { RESTORE_VAULT_ROUTE, @@ -17,6 +18,7 @@ import { CONFIRM_ADD_SUGGESTED_TOKEN_ROUTE, INITIALIZE_BACKUP_SEED_PHRASE_ROUTE, CONNECT_ROUTE, + CONNECTED_ROUTE, } from '../../helpers/constants/routes' export default class Home extends PureComponent { @@ -170,6 +172,7 @@ export default class Home extends PureComponent { return (
+
- - + )