diff options
Diffstat (limited to 'mascara/src/app')
-rw-r--r-- | mascara/src/app/buy-ether-widget/index.js | 198 | ||||
-rw-r--r-- | mascara/src/app/first-time/backup-phrase-screen.js | 7 | ||||
-rw-r--r-- | mascara/src/app/first-time/breadcrumbs.js | 5 | ||||
-rw-r--r-- | mascara/src/app/first-time/buy-ether-screen.js | 3 | ||||
-rw-r--r-- | mascara/src/app/first-time/create-password-screen.js | 145 | ||||
-rw-r--r-- | mascara/src/app/first-time/import-account-screen.js | 3 | ||||
-rw-r--r-- | mascara/src/app/first-time/import-seed-phrase-screen.js | 170 | ||||
-rw-r--r-- | mascara/src/app/first-time/index.css | 83 | ||||
-rw-r--r-- | mascara/src/app/first-time/index.js | 43 | ||||
-rw-r--r-- | mascara/src/app/first-time/loading-screen.js | 10 | ||||
-rw-r--r-- | mascara/src/app/first-time/notice-screen.js | 72 | ||||
-rw-r--r-- | mascara/src/app/first-time/unique-image-screen.js | 3 | ||||
-rw-r--r-- | mascara/src/app/shapeshift-form/index.js | 3 |
13 files changed, 559 insertions, 186 deletions
diff --git a/mascara/src/app/buy-ether-widget/index.js b/mascara/src/app/buy-ether-widget/index.js new file mode 100644 index 000000000..c60221a0a --- /dev/null +++ b/mascara/src/app/buy-ether-widget/index.js @@ -0,0 +1,198 @@ +import React, { Component } from 'react' +import PropTypes from 'prop-types' +import classnames from 'classnames' +import {connect} from 'react-redux' +import {qrcode} from 'qrcode-npm' +import copyToClipboard from 'copy-to-clipboard' +import ShapeShiftForm from '../shapeshift-form' +import {buyEth, showAccountDetail} from '../../../../ui/app/actions' + +const OPTION_VALUES = { + COINBASE: 'coinbase', + SHAPESHIFT: 'shapeshift', + QR_CODE: 'qr_code', +} + +const OPTIONS = [ + { + name: 'Direct Deposit', + value: OPTION_VALUES.QR_CODE, + }, + { + name: 'Buy with Dollars', + value: OPTION_VALUES.COINBASE, + }, + { + name: 'Buy with Cryptos', + value: OPTION_VALUES.SHAPESHIFT, + }, +] + +class BuyEtherWidget extends Component { + + static propTypes = { + address: PropTypes.string, + skipText: PropTypes.string, + className: PropTypes.string, + onSkip: PropTypes.func, + goToCoinbase: PropTypes.func, + showAccountDetail: PropTypes.func, + }; + + state = { + selectedOption: OPTION_VALUES.QR_CODE, + }; + + + copyToClipboard = () => { + const { address } = this.props + + this.setState({ justCopied: true }, () => copyToClipboard(address)) + + setTimeout(() => this.setState({ justCopied: false }), 1000) + } + + renderSkip () { + const {showAccountDetail, address, skipText, onSkip} = this.props + + return ( + <div + className="buy-ether__do-it-later" + onClick={() => { + if (onSkip) return onSkip() + showAccountDetail(address) + }} + > + {skipText || 'Do it later'} + </div> + ) + } + + renderCoinbaseLogo () { + return ( + <svg width="140px" height="49px" viewBox="0 0 579 126" version="1.1"> + <g id="Page-1" stroke="none" strokeWidth={1} fill="none" fillRule="evenodd"> + <g id="Imported-Layers" fill="#0081C9"> + <path d="M37.752,125.873 C18.824,125.873 0.369,112.307 0.369,81.549 C0.369,50.79 18.824,37.382 37.752,37.382 C47.059,37.382 54.315,39.749 59.52,43.219 L53.841,55.68 C50.371,53.156 45.166,51.579 39.961,51.579 C28.604,51.579 18.193,60.57 18.193,81.391 C18.193,102.212 28.919,111.361 39.961,111.361 C45.166,111.361 50.371,109.783 53.841,107.26 L59.52,120.036 C54.157,123.664 47.059,125.873 37.752,125.873" id="Fill-1" /> + <path d="M102.898,125.873 C78.765,125.873 65.515,106.786 65.515,81.549 C65.515,56.311 78.765,37.382 102.898,37.382 C127.032,37.382 140.282,56.311 140.282,81.549 C140.282,106.786 127.032,125.873 102.898,125.873 L102.898,125.873 Z M102.898,51.105 C89.491,51.105 82.866,63.093 82.866,81.391 C82.866,99.688 89.491,111.834 102.898,111.834 C116.306,111.834 122.931,99.688 122.931,81.391 C122.931,63.093 116.306,51.105 102.898,51.105 L102.898,51.105 Z" id="Fill-2" /> + <path d="M163.468,23.659 C157.79,23.659 153.215,19.243 153.215,13.88 C153.215,8.517 157.79,4.1 163.468,4.1 C169.146,4.1 173.721,8.517 173.721,13.88 C173.721,19.243 169.146,23.659 163.468,23.659 L163.468,23.659 Z M154.793,39.118 L172.144,39.118 L172.144,124.138 L154.793,124.138 L154.793,39.118 Z" id="Fill-3" /> + <path d="M240.443,124.137 L240.443,67.352 C240.443,57.415 234.449,51.263 222.619,51.263 C216.31,51.263 210.473,52.367 207.003,53.787 L207.003,124.137 L189.81,124.137 L189.81,43.376 C198.328,39.906 209.212,37.382 222.461,37.382 C246.28,37.382 257.794,47.793 257.794,65.775 L257.794,124.137 L240.443,124.137" id="Fill-4" /> + <path d="M303.536,125.873 C292.494,125.873 281.611,123.191 274.986,119.879 L274.986,0.314 L292.179,0.314 L292.179,41.326 C296.28,39.433 302.905,37.856 308.741,37.856 C330.667,37.856 345.494,53.629 345.494,79.656 C345.494,111.676 328.931,125.873 303.536,125.873 L303.536,125.873 Z M305.744,51.263 C301.012,51.263 295.491,52.367 292.179,54.103 L292.179,109.941 C294.703,111.045 299.593,112.149 304.482,112.149 C318.205,112.149 328.301,102.685 328.301,80.918 C328.301,62.305 319.467,51.263 305.744,51.263 L305.744,51.263 Z" id="Fill-5" /> + <path d="M392.341,125.873 C367.892,125.873 355.589,115.935 355.589,99.215 C355.589,75.555 380.826,71.296 406.537,69.876 L406.537,64.513 C406.537,53.787 399.439,50.001 388.555,50.001 C380.511,50.001 370.731,52.525 365.053,55.207 L360.636,43.376 C367.419,40.379 378.933,37.382 390.29,37.382 C410.638,37.382 422.942,45.269 422.942,66.248 L422.942,119.879 C416.79,123.191 404.329,125.873 392.341,125.873 L392.341,125.873 Z M406.537,81.391 C389.186,82.337 371.835,83.757 371.835,98.9 C371.835,107.89 378.776,113.411 391.868,113.411 C397.389,113.411 403.856,112.465 406.537,111.203 L406.537,81.391 L406.537,81.391 Z" id="Fill-6" /> + <path d="M461.743,125.873 C451.806,125.873 441.395,123.191 435.244,119.879 L441.08,106.629 C445.496,109.31 454.803,112.149 461.27,112.149 C470.576,112.149 476.728,107.575 476.728,100.477 C476.728,92.748 470.261,89.751 461.586,86.596 C450.228,82.337 437.452,77.132 437.452,61.201 C437.452,47.162 448.336,37.382 467.264,37.382 C477.517,37.382 486.035,39.906 492.029,43.376 L486.665,55.364 C482.88,52.998 475.309,50.317 469.157,50.317 C460.166,50.317 455.118,55.049 455.118,61.201 C455.118,68.93 461.428,71.611 469.788,74.766 C481.618,79.183 494.71,84.072 494.71,100.635 C494.71,115.935 483.038,125.873 461.743,125.873" id="Fill-7" /> + <path d="M578.625,81.233 L522.155,89.12 C523.89,104.42 533.828,112.149 548.182,112.149 C556.699,112.149 565.848,110.099 571.684,106.944 L576.732,119.879 C570.107,123.349 558.75,125.873 547.078,125.873 C520.262,125.873 505.277,108.679 505.277,81.549 C505.277,55.522 519.789,37.382 543.607,37.382 C565.69,37.382 578.782,51.894 578.782,74.766 C578.782,76.816 578.782,79.025 578.625,81.233 L578.625,81.233 Z M543.292,50.001 C530.042,50.001 521.367,60.097 521.051,77.763 L562.22,72.084 C562.062,57.257 554.649,50.001 543.292,50.001 L543.292,50.001 Z" id="Fill-8" /> + </g> + </g> + </svg> + ) + } + + renderCoinbaseForm () { + const {goToCoinbase, address} = this.props + + return ( + <div className="buy-ether__action-content-wrapper"> + <div>{this.renderCoinbaseLogo()}</div> + <div className="buy-ether__body-text">Coinbase is the world’s most popular way to buy and sell bitcoin, ethereum, and litecoin.</div> + <a className="first-time-flow__link buy-ether__faq-link">What is Ethereum?</a> + <div className="buy-ether__buttons"> + <button + className="first-time-flow__button" + onClick={() => goToCoinbase(address)} + > + Buy + </button> + </div> + </div> + ) + } + + renderContent () { + const { address } = this.props + const { justCopied } = this.state + const qrImage = qrcode(4, 'M') + qrImage.addData(address) + qrImage.make() + + switch (this.state.selectedOption) { + case OPTION_VALUES.COINBASE: + return this.renderCoinbaseForm() + case OPTION_VALUES.SHAPESHIFT: + return ( + <div className="buy-ether__action-content-wrapper"> + <div className="shapeshift-logo" /> + <div className="buy-ether__body-text"> + Trade any leading blockchain asset for any other. Protection by Design. No Account Needed. + </div> + <ShapeShiftForm btnClass="first-time-flow__button" /> + </div> + ) + case OPTION_VALUES.QR_CODE: + return ( + <div className="buy-ether__action-content-wrapper"> + <div dangerouslySetInnerHTML={{ __html: qrImage.createTableTag(4) }} /> + <div className="buy-ether__body-text">Deposit Ether directly into your account.</div> + <div className="buy-ether__small-body-text">(This is the account address that MetaMask created for you to recieve funds.)</div> + <div className="buy-ether__buttons"> + <button + className="first-time-flow__button" + onClick={this.copyToClipboard} + disabled={justCopied} + > + { justCopied ? 'Copied' : 'Copy' } + </button> + </div> + </div> + ) + default: + return null + } + } + + render () { + const { className = '' } = this.props + const { selectedOption } = this.state + + return ( + <div className={`${className} buy-ether__content-wrapper`}> + <div className="buy-ether__content-headline-wrapper"> + <div className="buy-ether__content-headline">Deposit Options</div> + {this.renderSkip()} + </div> + <div className="buy-ether__content"> + <div className="buy-ether__side-panel"> + {OPTIONS.map(({ name, value }) => ( + <div + key={value} + className={classnames('buy-ether__side-panel-item', { + 'buy-ether__side-panel-item--selected': value === selectedOption, + })} + onClick={() => this.setState({ selectedOption: value })} + > + <div className="buy-ether__side-panel-item-name">{name}</div> + {value === selectedOption && ( + <svg viewBox="0 0 574 1024" id="si-ant-right" width="15px" height="15px"> + <path d="M10 9Q0 19 0 32t10 23l482 457L10 969Q0 979 0 992t10 23q10 9 24 9t24-9l506-480q10-10 10-23t-10-23L58 9Q48 0 34 0T10 9z" /> + </svg> + )} + </div> + ))} + </div> + <div className="buy-ether__action-content"> + {this.renderContent()} + </div> + </div> + </div> + ) + } +} + +export default connect( + ({ metamask: { selectedAddress } }) => ({ + address: selectedAddress, + }), + dispatch => ({ + goToCoinbase: address => dispatch(buyEth({ network: '1', address, amount: 0 })), + showAccountDetail: address => dispatch(showAccountDetail(address)), + }) +)(BuyEtherWidget) diff --git a/mascara/src/app/first-time/backup-phrase-screen.js b/mascara/src/app/first-time/backup-phrase-screen.js index c68dacea2..9db61f3ab 100644 --- a/mascara/src/app/first-time/backup-phrase-screen.js +++ b/mascara/src/app/first-time/backup-phrase-screen.js @@ -1,5 +1,6 @@ -import React, {Component, PropTypes} from 'react' -import {connect} from 'react-redux'; +import React, { Component } from 'react' +import PropTypes from 'prop-types' +import {connect} from 'react-redux' import classnames from 'classnames' import shuffle from 'lodash.shuffle' import {compose, onlyUpdateForPropTypes} from 'recompose' @@ -194,7 +195,7 @@ class BackupPhraseScreen extends Component { </button> </div> </div> - ) + ) } renderBack () { diff --git a/mascara/src/app/first-time/breadcrumbs.js b/mascara/src/app/first-time/breadcrumbs.js index f8460d200..b81a9fb9b 100644 --- a/mascara/src/app/first-time/breadcrumbs.js +++ b/mascara/src/app/first-time/breadcrumbs.js @@ -1,10 +1,11 @@ -import React, {Component, PropTypes} from 'react' +import React, { Component } from 'react' +import PropTypes from 'prop-types' export default class Breadcrumbs extends Component { static propTypes = { total: PropTypes.number, - currentIndex: PropTypes.number + currentIndex: PropTypes.number, }; render() { diff --git a/mascara/src/app/first-time/buy-ether-screen.js b/mascara/src/app/first-time/buy-ether-screen.js index 45b2df1c8..c5a560638 100644 --- a/mascara/src/app/first-time/buy-ether-screen.js +++ b/mascara/src/app/first-time/buy-ether-screen.js @@ -1,4 +1,5 @@ -import React, {Component, PropTypes} from 'react' +import React, { Component } from 'react' +import PropTypes from 'prop-types' import classnames from 'classnames' import {connect} from 'react-redux' import {qrcode} from 'qrcode-npm' diff --git a/mascara/src/app/first-time/create-password-screen.js b/mascara/src/app/first-time/create-password-screen.js index 2f4b81e7c..450d6a479 100644 --- a/mascara/src/app/first-time/create-password-screen.js +++ b/mascara/src/app/first-time/create-password-screen.js @@ -1,8 +1,11 @@ -import React, {Component, PropTypes} from 'react' -import {connect} from 'react-redux'; +import EventEmitter from 'events' +import React, { Component } from 'react' +import PropTypes from 'prop-types' +import {connect} from 'react-redux' import {createNewVaultAndKeychain} from '../../../../ui/app/actions' import LoadingScreen from './loading-screen' import Breadcrumbs from './breadcrumbs' +import Mascot from '../../../../ui/app/components/mascot' class CreatePasswordScreen extends Component { static propTypes = { @@ -10,92 +13,114 @@ class CreatePasswordScreen extends Component { createAccount: PropTypes.func.isRequired, goToImportWithSeedPhrase: PropTypes.func.isRequired, goToImportAccount: PropTypes.func.isRequired, - next: PropTypes.func.isRequired + next: PropTypes.func.isRequired, } state = { password: '', - confirmPassword: '' + confirmPassword: '', } - isValid() { - const {password, confirmPassword} = this.state; + constructor () { + super() + this.animationEventEmitter = new EventEmitter() + } + + isValid () { + const {password, confirmPassword} = this.state if (!password || !confirmPassword) { - return false; + return false } if (password.length < 8) { - return false; + return false } - return password === confirmPassword; + return password === confirmPassword } createAccount = () => { if (!this.isValid()) { - return; + return } - const {password} = this.state; - const {createAccount, next} = this.props; + const {password} = this.state + const {createAccount, next} = this.props createAccount(password) - .then(next); + .then(next) } - render() { - const { isLoading, goToImportAccount, goToImportWithSeedPhrase } = this.props + render () { + const { isLoading, goToImportWithSeedPhrase } = this.props return isLoading ? <LoadingScreen loadingMessage="Creating your new account" /> : ( - <div className="create-password"> - <div className="create-password__title"> - Create Password + <div> + <div className="first-view-main"> + <div className="mascara-info"> + <Mascot + animationEventEmitter={this.animationEventEmitter} + width="225" + height="225" + /> + <div className="info"> + MetaMask is a secure identity vault for Ethereum. + </div> + <div className="info"> + It allows you to hold ether & tokens, and interact with decentralized applications. + </div> + </div> + <div className="create-password"> + <div className="create-password__title"> + Create Password + </div> + <input + className="first-time-flow__input" + type="password" + placeholder="New Password (min 8 characters)" + onChange={e => this.setState({password: e.target.value})} + /> + <input + className="first-time-flow__input create-password__confirm-input" + type="password" + placeholder="Confirm Password" + onChange={e => this.setState({confirmPassword: e.target.value})} + /> + <button + className="first-time-flow__button" + disabled={!this.isValid()} + onClick={this.createAccount} + > + Create + </button> + <a + href="" + className="first-time-flow__link create-password__import-link" + onClick={e => { + e.preventDefault() + goToImportWithSeedPhrase() + }} + > + Import with seed phrase + </a> + { /* } + <a + href="" + className="first-time-flow__link create-password__import-link" + onClick={e => { + e.preventDefault() + goToImportAccount() + }} + > + Import an account + </a> + { */ } + <Breadcrumbs total={3} currentIndex={0} /> + </div> </div> - <input - className="first-time-flow__input" - type="password" - placeholder="New Password (min 8 characters)" - onChange={e => this.setState({password: e.target.value})} - /> - <input - className="first-time-flow__input create-password__confirm-input" - type="password" - placeholder="Confirm Password" - onChange={e => this.setState({confirmPassword: e.target.value})} - /> - <button - className="first-time-flow__button" - disabled={!this.isValid()} - onClick={this.createAccount} - > - Create - </button> - <a - href="" - className="first-time-flow__link create-password__import-link" - onClick={e => { - e.preventDefault() - goToImportWithSeedPhrase() - }} - > - Import with seed phrase - </a> - { /* } - <a - href="" - className="first-time-flow__link create-password__import-link" - onClick={e => { - e.preventDefault() - goToImportAccount() - }} - > - Import an account - </a> - { */ } - <Breadcrumbs total={3} currentIndex={0} /> </div> ) } diff --git a/mascara/src/app/first-time/import-account-screen.js b/mascara/src/app/first-time/import-account-screen.js index bf8e209e4..ab0aca0f0 100644 --- a/mascara/src/app/first-time/import-account-screen.js +++ b/mascara/src/app/first-time/import-account-screen.js @@ -1,4 +1,5 @@ -import React, {Component, PropTypes} from 'react' +import React, { Component } from 'react' +import PropTypes from 'prop-types' import {connect} from 'react-redux' import classnames from 'classnames' import LoadingScreen from './loading-screen' diff --git a/mascara/src/app/first-time/import-seed-phrase-screen.js b/mascara/src/app/first-time/import-seed-phrase-screen.js index d9a9dc835..de8d675e1 100644 --- a/mascara/src/app/first-time/import-seed-phrase-screen.js +++ b/mascara/src/app/first-time/import-seed-phrase-screen.js @@ -1,7 +1,13 @@ -import React, {Component, PropTypes} from 'react' +import React, { Component } from 'react' +import PropTypes from 'prop-types' import {connect} from 'react-redux' -import LoadingScreen from './loading-screen' -import {createNewVaultAndRestore, hideWarning, displayWarning} from '../../../../ui/app/actions' +import classnames from 'classnames' +import { + createNewVaultAndRestore, + hideWarning, + displayWarning, + unMarkPasswordForgotten, +} from '../../../../ui/app/actions' class ImportSeedPhraseScreen extends Component { static propTypes = { @@ -10,8 +16,8 @@ class ImportSeedPhraseScreen extends Component { next: PropTypes.func.isRequired, createNewVaultAndRestore: PropTypes.func.isRequired, hideWarning: PropTypes.func.isRequired, - isLoading: PropTypes.bool.isRequired, displayWarning: PropTypes.func, + leaveImportSeedScreenState: PropTypes.func, }; state = { @@ -20,88 +26,134 @@ class ImportSeedPhraseScreen extends Component { confirmPassword: '', } - onClick = () => { - const { password, seedPhrase, confirmPassword } = this.state - const { createNewVaultAndRestore, next, displayWarning } = this.props + parseSeedPhrase = (seedPhrase) => { + return seedPhrase + .match(/\w+/g) + .join(' ') + } - if (seedPhrase.split(' ').length !== 12) { - this.warning = 'Seed Phrases are 12 words long' - displayWarning(this.warning) - return - } + onChange = ({ seedPhrase, password, confirmPassword }) => { + const { + password: prevPassword, + confirmPassword: prevConfirmPassword, + } = this.state + const { displayWarning, hideWarning } = this.props + + let warning = null - if (password.length < 8) { - this.warning = 'Passwords require a mimimum length of 8' - displayWarning(this.warning) - return + if (seedPhrase && this.parseSeedPhrase(seedPhrase).split(' ').length !== 12) { + warning = 'Seed Phrases are 12 words long' + } else if (password && password.length < 8) { + warning = 'Passwords require a mimimum length of 8' + } else if ((password || prevPassword) !== (confirmPassword || prevConfirmPassword)) { + warning = 'Confirmed password does not match' } - if (password !== confirmPassword) { - this.warning = 'Confirmed password does not match' - displayWarning(this.warning) - return + if (warning) { + displayWarning(warning) + } else { + hideWarning() } - this.warning = null - createNewVaultAndRestore(password, seedPhrase) + + seedPhrase && this.setState({ seedPhrase }) + password && this.setState({ password }) + confirmPassword && this.setState({ confirmPassword }) + } + + onClick = () => { + const { password, seedPhrase } = this.state + const { + createNewVaultAndRestore, + next, + displayWarning, + leaveImportSeedScreenState, + } = this.props + + leaveImportSeedScreenState() + createNewVaultAndRestore(password, this.parseSeedPhrase(seedPhrase)) .then(next) } render () { - return this.props.isLoading - ? <LoadingScreen loadingMessage="Creating your new account" /> - : ( - <div className="import-account"> - <a - className="import-account__back-button" - onClick={e => { - e.preventDefault() - this.props.back() - }} - href="#" - > - {`< Back`} - </a> - <div className="import-account__title"> - Import an Account with Seed Phrase - </div> - <div className="import-account__selector-label"> - Enter your secret twelve word phrase here to restore your vault. - </div> + const { seedPhrase, password, confirmPassword } = this.state + const { warning } = this.props + const importDisabled = warning || !seedPhrase || !password || !confirmPassword + return ( + <div className="import-account"> + <a + className="import-account__back-button" + onClick={e => { + e.preventDefault() + this.props.back() + }} + href="#" + > + {`< Back`} + </a> + <div className="import-account__title"> + Import an Account with Seed Phrase + </div> + <div className="import-account__selector-label"> + Enter your secret twelve word phrase here to restore your vault. + </div> + <div className="import-account__input-wrapper"> + <label className="import-account__input-label">Wallet Seed</label> <textarea className="import-account__secret-phrase" - onChange={e => this.setState({seedPhrase: e.target.value})} + onChange={e => this.onChange({seedPhrase: e.target.value})} + value={this.state.seedPhrase} + placeholder="Separate each word with a single space" /> - <span - className="error" - > - {this.props.warning} - </span> + </div> + <span + className="error" + > + {this.props.warning} + </span> + <div className="import-account__input-wrapper"> + <label className="import-account__input-label">New Password</label> <input className="first-time-flow__input" type="password" placeholder="New Password (min 8 characters)" - onChange={e => this.setState({password: e.target.value})} + onChange={e => this.onChange({password: e.target.value})} /> + </div> + <div className="import-account__input-wrapper"> + <label + className="import-account__input-label" + className={classnames('import-account__input-label', { + 'import-account__input-label__disabled': password.length < 8, + })} + >Confirm Password</label> <input - className="first-time-flow__input create-password__confirm-input" + className={classnames('first-time-flow__input', { + 'first-time-flow__input__disabled': password.length < 8, + })} type="password" placeholder="Confirm Password" - onChange={e => this.setState({confirmPassword: e.target.value})} + onChange={e => this.onChange({confirmPassword: e.target.value})} + disabled={password.length < 8} /> - <button - className="first-time-flow__button" - onClick={this.onClick} - > - Import - </button> </div> - ) + <button + className="first-time-flow__button" + onClick={() => !importDisabled && this.onClick()} + disabled={importDisabled} + > + Import + </button> + </div> + ) } } export default connect( - ({ appState: { isLoading, warning } }) => ({ isLoading, warning }), + ({ appState: { warning } }) => ({ warning }), dispatch => ({ + leaveImportSeedScreenState: () => { + dispatch(unMarkPasswordForgotten()) + }, createNewVaultAndRestore: (pw, seed) => dispatch(createNewVaultAndRestore(pw, seed)), displayWarning: (warning) => dispatch(displayWarning(warning)), hideWarning: () => dispatch(hideWarning()), diff --git a/mascara/src/app/first-time/index.css b/mascara/src/app/first-time/index.css index 28aa3060a..f59eb4ce1 100644 --- a/mascara/src/app/first-time/index.css +++ b/mascara/src/app/first-time/index.css @@ -1,8 +1,40 @@ + .first-time-flow { - height: 100vh; width: 100vw; - background-color: #FFF; + background-color: #fff; overflow: auto; + display: flex; + justify-content: center; + flex: 1 0 auto; +} + +.alpha-warning { + background: #f7861c; + color: #fff; + line-height: 2em; + padding-left: 10vw; +} + +.first-view-main { + display: flex; + flex-direction: row-reverse; + justify-content: space-between; +} + +.mascara-info { + display: flex; + flex-flow: column; + margin-top: 70px; + width: 35vw; + max-width: 550px; +} + +.mascara-info :first-child { + align-self: flex-end; +} + +.info { + font-size: 19px; } .create-password, @@ -13,10 +45,18 @@ .buy-ether { display: flex; flex-flow: column nowrap; - margin: 67px 0 0 146px; + margin: 67px 0 50px; max-width: 35rem; } +.create-password { + margin: 67px 0 50px; +} + +.import-account { + max-width: initial; +} + @media only screen and (max-width: 575px) { .create-password, .unique-image, @@ -75,7 +115,7 @@ .backup-phrase__tips { margin: 40px 0 !important; - width: initial !important; + width: initial !important; } .backup-phrase__confirm-secret, @@ -104,14 +144,16 @@ .backup-phrase__title, .import-account__title, .buy-ether__title { - width: 280px; color: #1B344D; font-size: 40px; - font-weight: 500; line-height: 51px; margin-bottom: 24px; } +.import-account__title { + margin-bottom: 10px; +} + .tou__title, .backup-phrase__title { width: 480px; @@ -257,9 +299,7 @@ .import-account__back-button:hover { margin-bottom: 18px; color: #22232C; - font-family: Montserrat Regular; font-size: 16px; - font-weight: 500; line-height: 21px; } @@ -280,6 +320,12 @@ button.backup-phrase__reveal-button:hover { .import-account__secret-phrase { font-size: 16px; + margin: initial; +} + +.import-account__secret-phrase::placeholder { + color: #9B9B9B; + font-weight: 200; } .backup-phrase__confirm-seed-options { @@ -319,9 +365,7 @@ button.backup-phrase__confirm-seed-option:hover { .import-account__selector-label { color: #1B344D; - font-family: Montserrat Light; - font-size: 18px; - line-height: 23px; + font-size: 16px; } .import-account__dropdown { @@ -337,7 +381,7 @@ button.backup-phrase__confirm-seed-option:hover { padding: 14px 21px; appearance: none; -webkit-appearance: none; - -moz-appearance: none; + -moz-appearance: none; cursor: pointer; } @@ -363,7 +407,6 @@ button.backup-phrase__confirm-seed-option:hover { margin-top: 10px; width: 422px; color: #FF001F; - font-family: Montserrat Light; font-size: 16px; line-height: 21px; } @@ -371,10 +414,12 @@ button.backup-phrase__confirm-seed-option:hover { .import-account__input-label { margin-bottom: 9px; color: #1B344D; - font-family: Montserrat Light; font-size: 18px; line-height: 23px; - text-transform: uppercase; +} + +.import-account__input-label__disabled { + opacity: 0.5; } .import-account__input { @@ -518,11 +563,15 @@ button.backup-phrase__confirm-seed-option:hover { width: 350px; font-size: 18px; line-height: 24px; - padding: 15px 28px; + padding: 15px; border: 1px solid #CDCDCD; background-color: #FFFFFF; } +.first-time-flow__input__disabled { + opacity: 0.5; +} + .first-time-flow__input::placeholder { color: #9B9B9B; font-weight: 200; @@ -540,10 +589,10 @@ button.backup-phrase__confirm-seed-option:hover { text-transform: uppercase; margin: 35px 0 14px; transition: 200ms ease-in-out; + background-color: rgba(247, 134, 28, 0.9); } button.first-time-flow__button[disabled] { - background-color: rgba(247, 134, 28, 0.9); opacity: .6; } diff --git a/mascara/src/app/first-time/index.js b/mascara/src/app/first-time/index.js index 66b591bd8..da2f6bab9 100644 --- a/mascara/src/app/first-time/index.js +++ b/mascara/src/app/first-time/index.js @@ -1,4 +1,5 @@ -import React, {Component, PropTypes} from 'react' +import React, { Component } from 'react' +import PropTypes from 'prop-types' import {connect} from 'react-redux' import CreatePasswordScreen from './create-password-screen' import UniqueImageScreen from './unique-image-screen' @@ -6,7 +7,10 @@ import NoticeScreen from './notice-screen' import BackupPhraseScreen from './backup-phrase-screen' import ImportAccountScreen from './import-account-screen' import ImportSeedPhraseScreen from './import-seed-phrase-screen' -import {onboardingBuyEthView} from '../../../../ui/app/actions' +import { + onboardingBuyEthView, + unMarkPasswordForgotten, +} from '../../../../ui/app/actions' class FirstTimeFlow extends Component { @@ -32,6 +36,7 @@ class FirstTimeFlow extends Component { NOTICE: 'notice', BACK_UP_PHRASE: 'back_up_phrase', CONFIRM_BACK_UP_PHRASE: 'confirm_back_up_phrase', + LOADING: 'loading', }; constructor (props) { @@ -50,11 +55,15 @@ class FirstTimeFlow extends Component { isInitialized, seedWords, noActiveNotices, + forgottenPassword, } = this.props const {SCREEN_TYPE} = FirstTimeFlow // return SCREEN_TYPE.NOTICE + if (forgottenPassword) { + return SCREEN_TYPE.IMPORT_SEED_PHRASE + } if (!isInitialized) { return SCREEN_TYPE.CREATE_PASSWORD } @@ -70,7 +79,13 @@ class FirstTimeFlow extends Component { renderScreen () { const {SCREEN_TYPE} = FirstTimeFlow - const {goToBuyEtherView, address} = this.props + const { + goToBuyEtherView, + address, + restoreCreatePasswordScreen, + forgottenPassword, + leaveImportSeedScreenState, + } = this.props switch (this.state.screenType) { case SCREEN_TYPE.CREATE_PASSWORD: @@ -91,8 +106,14 @@ class FirstTimeFlow extends Component { case SCREEN_TYPE.IMPORT_SEED_PHRASE: return ( <ImportSeedPhraseScreen - back={() => this.setScreenType(SCREEN_TYPE.CREATE_PASSWORD)} - next={() => this.setScreenType(SCREEN_TYPE.NOTICE)} + back={() => { + leaveImportSeedScreenState() + this.setScreenType(SCREEN_TYPE.CREATE_PASSWORD) + }} + next={() => { + const newScreenType = forgottenPassword ? null : SCREEN_TYPE.NOTICE + this.setScreenType(newScreenType) + }} /> ) case SCREEN_TYPE.UNIQUE_IMAGE: @@ -129,13 +150,23 @@ class FirstTimeFlow extends Component { } export default connect( - ({ metamask: { isInitialized, seedWords, noActiveNotices, selectedAddress } }) => ({ + ({ + metamask: { + isInitialized, + seedWords, + noActiveNotices, + selectedAddress, + forgottenPassword, + } + }) => ({ isInitialized, seedWords, noActiveNotices, address: selectedAddress, + forgottenPassword, }), dispatch => ({ + leaveImportSeedScreenState: () => dispatch(unMarkPasswordForgotten()), goToBuyEtherView: address => dispatch(onboardingBuyEthView(address)), }) )(FirstTimeFlow) diff --git a/mascara/src/app/first-time/loading-screen.js b/mascara/src/app/first-time/loading-screen.js index 732b7f2d7..01e1c1998 100644 --- a/mascara/src/app/first-time/loading-screen.js +++ b/mascara/src/app/first-time/loading-screen.js @@ -1,4 +1,5 @@ -import React, {Component, PropTypes} from 'react' +import React from 'react' +import PropTypes from 'prop-types' import Spinner from './spinner' export default function LoadingScreen({ className = '', loadingMessage }) { @@ -7,5 +8,10 @@ export default function LoadingScreen({ className = '', loadingMessage }) { <Spinner color="#1B344D" /> <div className="loading-screen__message">{loadingMessage}</div> </div> - ); + ) +} + +LoadingScreen.propTypes = { + className: PropTypes.string, + loadingMessage: PropTypes.string, } diff --git a/mascara/src/app/first-time/notice-screen.js b/mascara/src/app/first-time/notice-screen.js index d09070a95..0f0a7e95d 100644 --- a/mascara/src/app/first-time/notice-screen.js +++ b/mascara/src/app/first-time/notice-screen.js @@ -1,10 +1,12 @@ -import React, {Component, PropTypes} from 'react' +import React, { Component } from 'react' +import PropTypes from 'prop-types' import Markdown from 'react-markdown' import {connect} from 'react-redux' import debounce from 'lodash.debounce' import {markNoticeRead} from '../../../../ui/app/actions' import Identicon from '../../../../ui/app/components/identicon' import Breadcrumbs from './breadcrumbs' +import LoadingScreen from './loading-screen' class NoticeScreen extends Component { static propTypes = { @@ -12,25 +14,26 @@ class NoticeScreen extends Component { lastUnreadNotice: PropTypes.shape({ title: PropTypes.string, date: PropTypes.string, - body: PropTypes.string + body: PropTypes.string, }), - next: PropTypes.func.isRequired + next: PropTypes.func.isRequired, + markNoticeRead: PropTypes.func, }; static defaultProps = { - lastUnreadNotice: {} + lastUnreadNotice: {}, }; state = { atBottom: false, } - componentDidMount() { + componentDidMount () { this.onScroll() } acceptTerms = () => { - const { markNoticeRead, lastUnreadNotice, next } = this.props; + const { markNoticeRead, lastUnreadNotice, next } = this.props const defer = markNoticeRead(lastUnreadNotice) .then(() => this.setState({ atBottom: false })) @@ -43,50 +46,53 @@ class NoticeScreen extends Component { if (this.state.atBottom) return const target = document.querySelector('.tou__body') - const {scrollTop, offsetHeight, scrollHeight} = target; - const atBottom = scrollTop + offsetHeight >= scrollHeight; + const {scrollTop, offsetHeight, scrollHeight} = target + const atBottom = scrollTop + offsetHeight >= scrollHeight this.setState({atBottom: atBottom}) }, 25) - render() { + render () { const { address, - lastUnreadNotice: { title, body } - } = this.props; + lastUnreadNotice: { title, body }, + isLoading, + } = this.props const { atBottom } = this.state return ( - <div - className="tou" - onScroll={this.onScroll} - > - <Identicon address={address} diameter={70} /> - <div className="tou__title">{title}</div> - <Markdown - className="tou__body markdown" - source={body} - skipHtml - /> - <button - className="first-time-flow__button" - onClick={atBottom && this.acceptTerms} - disabled={!atBottom} + isLoading + ? <LoadingScreen /> + : <div + className="tou" + onScroll={this.onScroll} > - Accept - </button> - <Breadcrumbs total={3} currentIndex={2} /> - </div> + <Identicon address={address} diameter={70} /> + <div className="tou__title">{title}</div> + <Markdown + className="tou__body markdown" + source={body} + skipHtml + /> + <button + className="first-time-flow__button" + onClick={atBottom && this.acceptTerms} + disabled={!atBottom} + > + Accept + </button> + <Breadcrumbs total={3} currentIndex={2} /> + </div> ) } } export default connect( - ({ metamask: { selectedAddress, lastUnreadNotice } }) => ({ + ({ metamask: { selectedAddress, lastUnreadNotice }, appState: { isLoading } }) => ({ lastUnreadNotice, - address: selectedAddress + address: selectedAddress, }), dispatch => ({ - markNoticeRead: notice => dispatch(markNoticeRead(notice)) + markNoticeRead: notice => dispatch(markNoticeRead(notice)), }) )(NoticeScreen) diff --git a/mascara/src/app/first-time/unique-image-screen.js b/mascara/src/app/first-time/unique-image-screen.js index ef6bd28ab..46448aacf 100644 --- a/mascara/src/app/first-time/unique-image-screen.js +++ b/mascara/src/app/first-time/unique-image-screen.js @@ -1,4 +1,5 @@ -import React, {Component, PropTypes} from 'react' +import React, { Component } from 'react' +import PropTypes from 'prop-types' import {connect} from 'react-redux' import Identicon from '../../../../ui/app/components/identicon' import Breadcrumbs from './breadcrumbs' diff --git a/mascara/src/app/shapeshift-form/index.js b/mascara/src/app/shapeshift-form/index.js index 15c7e95e1..53a63403a 100644 --- a/mascara/src/app/shapeshift-form/index.js +++ b/mascara/src/app/shapeshift-form/index.js @@ -1,4 +1,5 @@ -import React, {Component, PropTypes} from 'react' +import React, { Component } from 'react' +import PropTypes from 'prop-types' import classnames from 'classnames' import {qrcode} from 'qrcode-npm' import {connect} from 'react-redux' |