Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New settings page rebased #6333

Merged
merged 14 commits into from
Mar 25, 2019
30 changes: 27 additions & 3 deletions app/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
"providerRequestInfo": {
"message": "This site is requesting access to view your current account address. Always make sure you trust the sites you interact with."
},
"aboutUs": {
"message": "About Us"
},
"accept": {
"message": "Accept"
},
Expand Down Expand Up @@ -71,6 +74,12 @@
"address": {
"message": "Address"
},
"advanced": {
"message": "Advanced"
},
"advancedSettingsDescription": {
"message": "Access developer features, download State Logs, Reset Account, setup testnets and custom RPC."
},
"advancedOptions": {
"message": "Advanced Options"
},
Expand All @@ -89,9 +98,6 @@
"addAcquiredTokens": {
"message": "Add the tokens you've acquired using MetaMask"
},
"advanced": {
"message": "Advanced"
},
"agreeTermsOfService": {
"message": "I agree to the Terms of Service"
},
Expand Down Expand Up @@ -227,6 +233,9 @@
"chromeRequiredForHardwareWallets": {
"message": "You need to use MetaMask on Google Chrome in order to connect to your Hardware Wallet."
},
"company": {
"message": "Company"
},
"confirm": {
"message": "Confirm"
},
Expand Down Expand Up @@ -607,6 +616,12 @@
"gasPriceRequired": {
"message": "Gas Price Required"
},
"general": {
"message": "General"
},
"generalSettingsDescription": {
"message": "Currency conversion, primary currency, language, blockies identicon"
},
"generatingTransaction": {
"message": "Generating transaction"
},
Expand Down Expand Up @@ -778,6 +793,9 @@
"ledgerAccountRestriction": {
"message": "You need to make use your last account before you can add a new one."
},
"legal": {
"message": "Legal"
},
"lessThanMax": {
"message": "must be less than or equal to $1.",
"description": "helper for inputting hex as decimal input"
Expand Down Expand Up @@ -1228,6 +1246,12 @@
"secretPhrase": {
"message": "Enter your secret twelve word phrase here to restore your vault."
},
"securityAndPrivacy": {
"message": "Security & Privacy"
},
"securitySettingsDescription": {
"message": "Privacy settings and wallet seed phrase"
},
"secondsShorthand": {
"message": "Sec"
},
Expand Down
18 changes: 18 additions & 0 deletions app/images/caret-left-black.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 12 additions & 4 deletions test/e2e/beta/metamask-beta-ui.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,11 @@ describe('MetaMask', function () {
await customRpcButton.click()
await delay(regularDelayMs)

const privacyToggle = await findElement(driver, By.css('.settings-page__content-row:nth-of-type(10) .settings-page__content-item-col > div'))
const securityTab = await findElement(driver, By.xpath(`//div[contains(text(), 'Security & Privacy')]`))
await securityTab.click()
await delay(regularDelayMs)

const privacyToggle = await findElement(driver, By.css('.settings-page__content-row:nth-of-type(1) .settings-page__content-item-col > div'))
await privacyToggle.click()
await delay(largeDelayMs * 2)
})
Expand Down Expand Up @@ -472,15 +476,19 @@ describe('MetaMask', function () {
const settingsButton = await findElement(driver, By.xpath(`//div[contains(text(), 'Settings')]`))
settingsButton.click()

await findElement(driver, By.css('.tab-bar'))
// await findElement(driver, By.css('.tab-bar'))

const advancedTab = await findElement(driver, By.xpath(`//div[contains(text(), 'Advanced')]`))
await advancedTab.click()
await delay(regularDelayMs)

const showConversionToggle = await findElement(driver, By.css('.settings-page__content-row:nth-of-type(3) .settings-page__content-item-col > div'))
const showConversionToggle = await findElement(driver, By.css('.settings-page__content-row:nth-of-type(7) .settings-page__content-item-col > div'))
await showConversionToggle.click()

const advancedGasTitle = await findElement(driver, By.xpath(`//span[contains(text(), 'Advanced gas controls')]`))
await driver.executeScript('arguments[0].scrollIntoView(true)', advancedGasTitle)

const advancedGasToggle = await findElement(driver, By.css('.settings-page__content-row:nth-of-type(12) .settings-page__content-item-col > div'))
const advancedGasToggle = await findElement(driver, By.css('.settings-page__content-row:nth-of-type(5) .settings-page__content-item-col > div'))
await advancedGasToggle.click()
windowHandles = await driver.getAllWindowHandles()
extension = windowHandles[0]
Expand Down
4 changes: 2 additions & 2 deletions ui/app/components/app/dropdowns/network-dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const Dropdown = require('./components/dropdown').Dropdown
const DropdownMenuItem = require('./components/dropdown').DropdownMenuItem
const NetworkDropdownIcon = require('./components/network-dropdown-icon')
const R = require('ramda')
const { SETTINGS_ROUTE } = require('../../../helpers/constants/routes')
const { ADVANCED_ROUTE } = require('../../../helpers/constants/routes')

// classes from nodes of the toggle element.
const notToggleElementClassnames = [
Expand Down Expand Up @@ -233,7 +233,7 @@ NetworkDropdown.prototype.render = function () {
DropdownMenuItem,
{
closeMenu: () => this.props.hideNetworkDropdown(),
onClick: () => this.props.history.push(SETTINGS_ROUTE),
onClick: () => this.props.history.push(ADVANCED_ROUTE),
style: dropdownMenuItemStyle,
},
[
Expand Down
30 changes: 17 additions & 13 deletions ui/app/components/app/tab-bar.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const { Component } = require('react')
const h = require('react-hyperscript')
import React, { Component } from 'react'
const PropTypes = require('prop-types')
const classnames = require('classnames')

Expand All @@ -8,18 +7,23 @@ class TabBar extends Component {
const { tabs = [], onSelect, isActive } = this.props

return (
h('.tab-bar', {}, [
tabs.map(({ key, content }) => {
return h('div', {
className: classnames('tab-bar__tab pointer', {
<div className="tab-bar">
{tabs.map(({ key, content, description }) => (
<div
key={key}
className={classnames('tab-bar__tab pointer', {
'tab-bar__tab--active': isActive(key, content),
}),
onClick: () => onSelect(key),
key,
}, content)
}),
h('div.tab-bar__tab.tab-bar__grow-tab'),
])
})}
onClick={() => onSelect(key)}
>
<div className="tab-bar__tab__content">
<div className="tab-bar__tab__content__title">{content}</div>
<div className="tab-bar__tab__content__description">{description}</div>
</div>
<div className="tab-bar__tab__caret" />
</div>
))}
</div>
)
}
}
Expand Down
68 changes: 60 additions & 8 deletions ui/app/css/itcss/components/tab-bar.scss
Original file line number Diff line number Diff line change
@@ -1,21 +1,73 @@
.tab-bar {
display: flex;
flex-direction: row;
flex-direction: column;
justify-content: flex-start;
align-items: flex-end;
}

.tab-bar__tab {
display: flex;
flex-flow: row nowrap;
align-items: flex-start;
min-width: 0;
flex: 0 0 auto;
padding: 15px 25px;
border-bottom: 1px solid $alto;
box-sizing: border-box;
font-size: 18px;
}
font-size: 16px;
padding: 16px 24px;
opacity: .5;
transition: opacity 200ms ease-in-out;

@media screen and (min-width: 576px) {
&:hover {
opacity: .4;
}

&:active {
opacity: .6;
}
}

@media screen and (max-width: 575px) {
font-size: 18px;
padding: 24px;
border-bottom: 1px solid $alto;
opacity: 1;
}

&__content {
flex: 1 1 auto;
width: 0;

&__description {
display: none;

@media screen and (max-width: 575px) {
display: block;
font-size: 14px;
font-weight: 300;
margin-top: 8px;
min-height: 14px;
}
}
}

&__caret {
display: none;

@media screen and (max-width: 575px) {
display: block;
background-image: url('/images/caret-right.svg');
width: 36px;
height: 36px;
opacity: .5;
background-size: contain;
background-repeat: no-repeat;
background-position: center;
}
}

.tab-bar__tab--active {
border-color: $black;
&--active {
opacity: 1 !important;
}
}

.tab-bar__grow-tab {
Expand Down
10 changes: 10 additions & 0 deletions ui/app/helpers/constants/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ const DEFAULT_ROUTE = '/'
const UNLOCK_ROUTE = '/unlock'
const LOCK_ROUTE = '/lock'
const SETTINGS_ROUTE = '/settings'
const GENERAL_ROUTE = '/settings/general'
const INFO_ROUTE = '/settings/info'
const ADVANCED_ROUTE = '/settings/advanced'
const SECURITY_ROUTE = '/settings/security'
const COMPANY_ROUTE = '/settings/company'
const ABOUT_US_ROUTE = '/settings/about-us'
const REVEAL_SEED_ROUTE = '/seed'
const MOBILE_SYNC_ROUTE = '/mobile-sync'
const CONFIRM_SEED_ROUTE = '/confirm-seed'
Expand Down Expand Up @@ -80,4 +85,9 @@ module.exports = {
CONFIRM_TOKEN_METHOD_PATH,
SIGNATURE_REQUEST_PATH,
INITIALIZE_METAMETRICS_OPT_IN_ROUTE,
ADVANCED_ROUTE,
SECURITY_ROUTE,
COMPANY_ROUTE,
GENERAL_ROUTE,
ABOUT_US_ROUTE,
}
Loading