Fix merge conflict; separate onboarding buy screen

This commit is contained in:
Chi Kei Chan 2017-09-18 15:41:25 -07:00
parent e88baff2ee
commit c6a3d00d80
8 changed files with 9558 additions and 29 deletions

View File

@ -1,4 +1,5 @@
{ {
"parser": "babel-eslint",
"parserOptions": { "parserOptions": {
"sourceType": "module", "sourceType": "module",
"ecmaVersion": 2017, "ecmaVersion": 2017,
@ -10,7 +11,9 @@
"arrowFunctions": true, "arrowFunctions": true,
"objectLiteralShorthandMethods": true, "objectLiteralShorthandMethods": true,
"objectLiteralShorthandProperties": true, "objectLiteralShorthandProperties": true,
"templateStrings": true "templateStrings": true,
"classes": true,
"jsx": true
}, },
}, },
@ -23,7 +26,8 @@
"plugins": [ "plugins": [
"mocha", "mocha",
"chai" "chai",
"react"
], ],
"globals": { "globals": {

View File

@ -66,7 +66,7 @@ class BackupPhraseScreen extends Component {
} }
} }
renderSecretWordsContainer() { renderSecretWordsContainer () {
const { isShowingSecret } = this.state const { isShowingSecret } = this.state
return ( return (
@ -197,7 +197,7 @@ class BackupPhraseScreen extends Component {
) )
} }
renderBack() { renderBack () {
return this.state.page === BackupPhraseScreen.PAGE.CONFIRM return this.state.page === BackupPhraseScreen.PAGE.CONFIRM
? ( ? (
<a <a
@ -216,17 +216,17 @@ class BackupPhraseScreen extends Component {
: null : null
} }
renderContent() { renderContent () {
switch(this.state.page) { switch (this.state.page) {
case BackupPhraseScreen.PAGE.CONFIRM: case BackupPhraseScreen.PAGE.CONFIRM:
return this.renderConfirmationScreen(); return this.renderConfirmationScreen()
case BackupPhraseScreen.PAGE.SECRET: case BackupPhraseScreen.PAGE.SECRET:
default: default:
return this.renderSecretScreen(); return this.renderSecretScreen()
} }
} }
render() { render () {
return this.props.isLoading return this.props.isLoading
? <LoadingScreen loadingMessage="Creating your new account" /> ? <LoadingScreen loadingMessage="Creating your new account" />
: ( : (
@ -245,10 +245,10 @@ export default compose(
({ metamask: { selectedAddress, seedWords }, appState: { isLoading } }) => ({ ({ metamask: { selectedAddress, seedWords }, appState: { isLoading } }) => ({
seedWords, seedWords,
isLoading, isLoading,
address: selectedAddress address: selectedAddress,
}), }),
dispatch => ({ dispatch => ({
confirmSeedWords: () => dispatch(confirmSeedWords()) confirmSeedWords: () => dispatch(confirmSeedWords()),
}) })
) )
)(BackupPhraseScreen) )(BackupPhraseScreen)

View File

@ -1,12 +1,12 @@
import React, {Component, PropTypes} from 'react' import React, {Component, PropTypes} from 'react'
import {connect} from 'react-redux'; import {connect} from 'react-redux'
import CreatePasswordScreen from './create-password-screen' import CreatePasswordScreen from './create-password-screen'
import UniqueImageScreen from './unique-image-screen' import UniqueImageScreen from './unique-image-screen'
import NoticeScreen from './notice-screen' import NoticeScreen from './notice-screen'
import BackupPhraseScreen from './backup-phrase-screen' import BackupPhraseScreen from './backup-phrase-screen'
import ImportAccountScreen from './import-account-screen' import ImportAccountScreen from './import-account-screen'
import BuyEtherScreen from './buy-ether-screen' import BuyEtherScreen from './buy-ether-screen'
import {buyEthView} from '../../../../ui/app/actions' import {onboardingBuyEthView} from '../../../../ui/app/actions'
class FirstTimeFlow extends Component { class FirstTimeFlow extends Component {
@ -33,23 +33,23 @@ class FirstTimeFlow extends Component {
CONFIRM_BACK_UP_PHRASE: 'confirm_back_up_phrase', CONFIRM_BACK_UP_PHRASE: 'confirm_back_up_phrase',
}; };
constructor(props) { constructor (props) {
super(props); super(props)
this.state = { this.state = {
screenType: this.getScreenType() screenType: this.getScreenType(),
} }
} }
setScreenType(screenType) { setScreenType (screenType) {
this.setState({ screenType }) this.setState({ screenType })
} }
getScreenType() { getScreenType () {
const { const {
isInitialized, isInitialized,
seedWords, seedWords,
noActiveNotices, noActiveNotices,
} = this.props; } = this.props
const {SCREEN_TYPE} = FirstTimeFlow const {SCREEN_TYPE} = FirstTimeFlow
// return SCREEN_TYPE.NOTICE // return SCREEN_TYPE.NOTICE
@ -67,7 +67,7 @@ class FirstTimeFlow extends Component {
} }
}; };
renderScreen() { renderScreen () {
const {SCREEN_TYPE} = FirstTimeFlow const {SCREEN_TYPE} = FirstTimeFlow
const {goToBuyEtherView, address} = this.props const {goToBuyEtherView, address} = this.props
@ -109,7 +109,7 @@ class FirstTimeFlow extends Component {
} }
} }
render() { render () {
return ( return (
<div className="first-time-flow"> <div className="first-time-flow">
{this.renderScreen()} {this.renderScreen()}
@ -127,7 +127,7 @@ export default connect(
address: selectedAddress, address: selectedAddress,
}), }),
dispatch => ({ dispatch => ({
goToBuyEtherView: address => dispatch(buyEthView(address)) goToBuyEtherView: address => dispatch(onboardingBuyEthView(address)),
}) })
)(FirstTimeFlow) )(FirstTimeFlow)

View File

@ -67,6 +67,7 @@
"dnode": "^1.2.2", "dnode": "^1.2.2",
"end-of-stream": "^1.1.0", "end-of-stream": "^1.1.0",
"ensnare": "^1.0.0", "ensnare": "^1.0.0",
"eslint-plugin-react": "^7.3.0",
"eth-bin-to-ops": "^1.0.1", "eth-bin-to-ops": "^1.0.1",
"eth-block-tracker": "^2.2.0", "eth-block-tracker": "^2.2.0",
"eth-contract-metadata": "^1.1.4", "eth-contract-metadata": "^1.1.4",

View File

@ -133,6 +133,8 @@ var actions = {
showLoadingIndication: showLoadingIndication, showLoadingIndication: showLoadingIndication,
hideLoadingIndication: hideLoadingIndication, hideLoadingIndication: hideLoadingIndication,
// buy Eth with coinbase // buy Eth with coinbase
onboardingBuyEthView,
ONBOARDING_BUY_ETH_VIEW: 'ONBOARDING_BUY_ETH_VIEW',
BUY_ETH: 'BUY_ETH', BUY_ETH: 'BUY_ETH',
buyEth: buyEth, buyEth: buyEth,
buyEthView: buyEthView, buyEthView: buyEthView,
@ -903,6 +905,13 @@ function buyEth (opts) {
} }
} }
function onboardingBuyEthView (address) {
return {
type: actions.ONBOARDING_BUY_ETH_VIEW,
value: address,
}
}
function buyEthView (address) { function buyEthView (address) {
return { return {
type: actions.BUY_ETH_VIEW, type: actions.BUY_ETH_VIEW,

View File

@ -46,10 +46,9 @@ function mapStateToProps (state) {
accounts, accounts,
address, address,
keyrings, keyrings,
isMascara,
isInitialized, isInitialized,
noActiveNotices, noActiveNotices,
seedWords seedWords,
} = state.metamask } = state.metamask
const selected = address || Object.keys(accounts)[0] const selected = address || Object.keys(accounts)[0]
@ -405,8 +404,8 @@ App.prototype.renderDropdown = function () {
]) ])
} }
App.prototype.renderLoadingIndicator = function({ isLoading, isLoadingNetwork, loadMessage }) { App.prototype.renderLoadingIndicator = function ({ isLoading, isLoadingNetwork, loadMessage }) {
const { isMascara } = this.props; const { isMascara } = this.props
return isMascara return isMascara
? null ? null
@ -541,9 +540,11 @@ App.prototype.renderPrimary = function () {
case 'buyEth': case 'buyEth':
log.debug('rendering buy ether screen') log.debug('rendering buy ether screen')
return isMascara return h(BuyView, {key: 'buyEthView'})
? h(MascaraBuyEtherScreen, {key: 'buyEthView'})
: h(BuyView, {key: 'buyEthView'}) case 'onboardingBuyEth':
log.debug('rendering onboarding buy ether screen')
return h(MascaraBuyEtherScreen, {key: 'buyEthView'})
case 'qr': case 'qr':
log.debug('rendering show qr screen') log.debug('rendering show qr screen')

View File

@ -494,6 +494,17 @@ function reduceApp (state, action) {
}, },
}) })
case actions.ONBOARDING_BUY_ETH_VIEW:
return extend(appState, {
transForward: true,
currentView: {
name: 'onboardingBuyEth',
context: appState.currentView.name,
},
identity: state.metamask.identities[action.value],
})
case actions.COINBASE_SUBVIEW: case actions.COINBASE_SUBVIEW:
return extend(appState, { return extend(appState, {
buyView: { buyView: {

9503
yarn.lock Normal file

File diff suppressed because it is too large Load Diff