aboutsummaryrefslogtreecommitdiffstats
path: root/mascara
diff options
context:
space:
mode:
authorAlexander Tseung <alextsg@gmail.com>2018-04-03 07:24:37 +0800
committerAlexander Tseung <alextsg@gmail.com>2018-04-03 07:24:37 +0800
commit516c1869b0f366a42282a66e14185ce630f883dd (patch)
tree2da85b6a5995ba45338fc661f1436de8a55b60cb /mascara
parent92f8157dfeffff8173f6abc896cad59ada9a48ef (diff)
downloaddexon-wallet-516c1869b0f366a42282a66e14185ce630f883dd.tar.gz
dexon-wallet-516c1869b0f366a42282a66e14185ce630f883dd.tar.zst
dexon-wallet-516c1869b0f366a42282a66e14185ce630f883dd.zip
Fix lint errors
Diffstat (limited to 'mascara')
-rw-r--r--mascara/src/app/first-time/confirm-seed-screen.js16
-rw-r--r--mascara/src/app/first-time/create-password-screen.js35
-rw-r--r--mascara/src/app/first-time/import-account-screen.js1
-rw-r--r--mascara/src/app/first-time/index.js141
-rw-r--r--mascara/src/app/first-time/notice-screen.js10
-rw-r--r--mascara/src/app/first-time/seed-screen.js1
6 files changed, 19 insertions, 185 deletions
diff --git a/mascara/src/app/first-time/confirm-seed-screen.js b/mascara/src/app/first-time/confirm-seed-screen.js
index 6eabd754..359e3d7f 100644
--- a/mascara/src/app/first-time/confirm-seed-screen.js
+++ b/mascara/src/app/first-time/confirm-seed-screen.js
@@ -9,7 +9,7 @@ import Identicon from '../../../../ui/app/components/identicon'
import { confirmSeedWords } from '../../../../ui/app/actions'
import Breadcrumbs from './breadcrumbs'
import LoadingScreen from './loading-screen'
-import { INITIALIZE_ROUTE, DEFAULT_ROUTE } from '../../../../ui/app/routes'
+import { DEFAULT_ROUTE } from '../../../../ui/app/routes'
class ConfirmSeedScreen extends Component {
static propTypes = {
@@ -35,21 +35,21 @@ class ConfirmSeedScreen extends Component {
componentWillMount () {
const { seedWords, history } = this.props
+
if (!seedWords) {
- history.push(INITIALIZE_ROUTE)
+ history.push(DEFAULT_ROUTE)
}
}
handleClick () {
- this.props.confirmSeedWords()
- .then(() => {
- console.log('FINISHED')
- this.props.history.push(DEFAULT_ROUTE)
- })
+ const { confirmSeedWords, history } = this.props
+
+ confirmSeedWords()
+ .then(() => history.push(DEFAULT_ROUTE))
}
render () {
- const { seedWords, confirmSeedWords, history } = this.props
+ const { seedWords } = this.props
const { selectedSeeds, shuffledSeeds } = this.state
const isValid = seedWords === selectedSeeds.map(([_, seed]) => seed).join(' ')
diff --git a/mascara/src/app/first-time/create-password-screen.js b/mascara/src/app/first-time/create-password-screen.js
index 7b8971af..6ec05e11 100644
--- a/mascara/src/app/first-time/create-password-screen.js
+++ b/mascara/src/app/first-time/create-password-screen.js
@@ -1,19 +1,16 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import {connect} from 'react-redux'
-import { withRouter, Redirect } from 'react-router-dom'
+import { withRouter } from 'react-router-dom'
import { compose } from 'recompose'
import { createNewVaultAndKeychain } from '../../../../ui/app/actions'
-import LoadingScreen from './loading-screen'
import Breadcrumbs from './breadcrumbs'
import EventEmitter from 'events'
import Mascot from '../../../../ui/app/components/mascot'
import classnames from 'classnames'
import {
- DEFAULT_ROUTE,
INITIALIZE_UNIQUE_IMAGE_ROUTE,
INITIALIZE_IMPORT_WITH_SEED_PHRASE_ROUTE,
- // INITIALIZE_IMPORT_ACCOUNT_ROUTE,
INITIALIZE_NOTICE_ROUTE,
} from '../../../../ui/app/routes'
@@ -30,19 +27,17 @@ class CreatePasswordScreen extends Component {
state = {
password: '',
confirmPassword: '',
- isLoading: false,
}
- constructor () {
- super()
+ constructor (props) {
+ super(props)
this.animationEventEmitter = new EventEmitter()
}
componentWillMount () {
- const { isInitialized, isUnlocked, history, noActiveNotices } = this.props
+ const { isInitialized, history } = this.props
if (isInitialized) {
- console.log('%c IM already initialized', 'background: #222; color: #bada55')
history.push(INITIALIZE_NOTICE_ROUTE)
}
}
@@ -71,16 +66,11 @@ class CreatePasswordScreen extends Component {
this.setState({ isLoading: true })
createAccount(password)
- .then(() => {
- // this.setState({ isLoading: false })
- history.push(INITIALIZE_UNIQUE_IMAGE_ROUTE)
- })
- .catch(() => this.setState({ isLoading: false}))
+ .then(() => history.push(INITIALIZE_UNIQUE_IMAGE_ROUTE))
}
renderFields () {
const { isMascara, history } = this.props
- const { isLoading } = this.state
return (
<div className={classnames({ 'first-view-main-wrapper': !isMascara })}>
@@ -154,20 +144,7 @@ class CreatePasswordScreen extends Component {
}
render () {
- const { isInitialized, isUnlocked, history, noActiveNotices, isMascara } = this.props
-
- // if (isInitialized) {
- // console.log('%c IM already initialized', 'background: #222; color: #bada55')
- // if (!noActiveNotices) {
- // console.log('%c GOING TO NOTICES', 'background: #222; color: #bada55')
- // // history.replace(INITIALIZE_NOTICE_ROUTE)
- // return <Redirect to={INITIALIZE_NOTICE_ROUTE} />
- // } else {
- // console.log('%c GOING TO DEFAULT', 'background: #222; color: #bada55')
- // // history.replace(DEFAULT_ROUTE)
- // return <Redirect to={DEFAULT_ROUTE} />
- // }
- // }
+ const { history, isMascara } = this.props
return (
<div className={classnames({ 'first-view-main-wrapper': !isMascara })}>
diff --git a/mascara/src/app/first-time/import-account-screen.js b/mascara/src/app/first-time/import-account-screen.js
index fdcaa719..ab0aca0f 100644
--- a/mascara/src/app/first-time/import-account-screen.js
+++ b/mascara/src/app/first-time/import-account-screen.js
@@ -142,7 +142,6 @@ class ImportAccountScreen extends Component {
render () {
const { OPTIONS } = ImportAccountScreen
const { selectedOption } = this.state
- console.log('RENDER IMPORT')
return this.props.isLoading
? <LoadingScreen loadingMessage="Creating your new account" />
diff --git a/mascara/src/app/first-time/index.js b/mascara/src/app/first-time/index.js
index 5f47145a..01e5d67a 100644
--- a/mascara/src/app/first-time/index.js
+++ b/mascara/src/app/first-time/index.js
@@ -1,7 +1,7 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import {connect} from 'react-redux'
-import { withRouter, Switch, Route, Redirect } from 'react-router-dom'
+import { withRouter, Switch, Route } from 'react-router-dom'
import { compose } from 'recompose'
import CreatePasswordScreen from './create-password-screen'
import UniqueImageScreen from './unique-image-screen'
@@ -11,13 +11,6 @@ import ImportAccountScreen from './import-account-screen'
import ImportSeedPhraseScreen from './import-seed-phrase-screen'
import ConfirmSeed from './confirm-seed-screen'
import {
- onboardingBuyEthView,
- unMarkPasswordForgotten,
- showModal,
-} from '../../../../ui/app/actions'
-import {
- DEFAULT_ROUTE,
- WELCOME_ROUTE,
INITIALIZE_ROUTE,
INITIALIZE_IMPORT_ACCOUNT_ROUTE,
INITIALIZE_UNIQUE_IMAGE_ROUTE,
@@ -48,131 +41,6 @@ class FirstTimeFlow extends Component {
noActiveNotices: false,
};
- static SCREEN_TYPE = {
- CREATE_PASSWORD: 'create_password',
- IMPORT_ACCOUNT: 'import_account',
- IMPORT_SEED_PHRASE: 'import_seed_phrase',
- UNIQUE_IMAGE: 'unique_image',
- NOTICE: 'notice',
- BACK_UP_PHRASE: 'back_up_phrase',
- CONFIRM_BACK_UP_PHRASE: 'confirm_back_up_phrase',
- LOADING: 'loading',
- };
-
- constructor (props) {
- super(props)
- this.state = {
- screenType: this.getScreenType(),
- }
- }
-
- componentDidMount () {
- const { isInitialized, isUnlocked, history, noActiveNotices } = this.props
-
- // if (isInitialized || isUnlocked) {
- // history.push(DEFAULT_ROUTE)
- // }
-
- // if (!noActiveNotices) {
- // console.log('INITIALIZE ACTIVE NOTICES')
- // history.push(INITIALIZE_NOTICE_ROUTE)
- // }
-
- }
-
- setScreenType (screenType) {
- this.setState({ screenType })
- }
-
- getScreenType () {
- const {
- 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
- }
-
- if (!noActiveNotices) {
- return SCREEN_TYPE.NOTICE
- }
-
- if (seedWords) {
- return SCREEN_TYPE.BACK_UP_PHRASE
- }
- };
-
- renderScreen () {
- const {SCREEN_TYPE} = FirstTimeFlow
- const {
- openBuyEtherModal,
- address,
- restoreCreatePasswordScreen,
- forgottenPassword,
- leaveImportSeedScreenState,
- } = this.props
-
- switch (this.state.screenType) {
- case SCREEN_TYPE.CREATE_PASSWORD:
- return (
- <CreatePasswordScreen
- next={() => this.setScreenType(SCREEN_TYPE.UNIQUE_IMAGE)}
- goToImportAccount={() => this.setScreenType(SCREEN_TYPE.IMPORT_ACCOUNT)}
- goToImportWithSeedPhrase={() => this.setScreenType(SCREEN_TYPE.IMPORT_SEED_PHRASE)}
- />
- )
- case SCREEN_TYPE.IMPORT_ACCOUNT:
- return (
- <ImportAccountScreen
- back={() => this.setScreenType(SCREEN_TYPE.CREATE_PASSWORD)}
- next={() => this.setScreenType(SCREEN_TYPE.NOTICE)}
- />
- )
- case SCREEN_TYPE.IMPORT_SEED_PHRASE:
- return (
- <ImportSeedPhraseScreen
- back={() => {
- leaveImportSeedScreenState()
- this.setScreenType(SCREEN_TYPE.CREATE_PASSWORD)
- }}
- next={() => {
- const newScreenType = forgottenPassword ? null : SCREEN_TYPE.NOTICE
- this.setScreenType(newScreenType)
- }}
- />
- )
- case SCREEN_TYPE.UNIQUE_IMAGE:
- return (
- <UniqueImageScreen
- next={() => this.setScreenType(SCREEN_TYPE.NOTICE)}
- />
- )
- case SCREEN_TYPE.NOTICE:
- return (
- <NoticeScreen
- next={() => this.setScreenType(SCREEN_TYPE.BACK_UP_PHRASE)}
- />
- )
- case SCREEN_TYPE.BACK_UP_PHRASE:
- return (
- <BackupPhraseScreen
- next={() => openBuyEtherModal()}
- />
- )
- default:
- return <noscript />
- }
- }
-
render () {
return (
<div className="first-time-flow">
@@ -219,12 +87,7 @@ const mapStateToProps = ({ metamask }) => {
}
}
-const mapDispatchToProps = dispatch => ({
- leaveImportSeedScreenState: () => dispatch(unMarkPasswordForgotten()),
- openBuyEtherModal: () => dispatch(showModal({ name: 'DEPOSIT_ETHER'})),
-})
-
export default compose(
withRouter,
- connect(mapStateToProps, mapDispatchToProps)
+ connect(mapStateToProps)
)(FirstTimeFlow)
diff --git a/mascara/src/app/first-time/notice-screen.js b/mascara/src/app/first-time/notice-screen.js
index 6d45f435..a449ccfa 100644
--- a/mascara/src/app/first-time/notice-screen.js
+++ b/mascara/src/app/first-time/notice-screen.js
@@ -8,11 +8,7 @@ import debounce from 'lodash.debounce'
import { markNoticeRead } from '../../../../ui/app/actions'
import Identicon from '../../../../ui/app/components/identicon'
import Breadcrumbs from './breadcrumbs'
-import {
- INITIALIZE_ROUTE,
- DEFAULT_ROUTE,
- INITIALIZE_BACKUP_PHRASE_ROUTE,
-} from '../../../../ui/app/routes'
+import { INITIALIZE_BACKUP_PHRASE_ROUTE } from '../../../../ui/app/routes'
import LoadingScreen from './loading-screen'
class NoticeScreen extends Component {
@@ -42,9 +38,8 @@ class NoticeScreen extends Component {
atBottom: false,
}
- componentWillMount () {
+ componentDidMount () {
if (this.props.noActiveNotices) {
- console.log('%c NOTICESCREEN NOACTIVENOTICES', 'background: #222; color: #bada55')
this.props.history.push(INITIALIZE_BACKUP_PHRASE_ROUTE)
}
@@ -55,7 +50,6 @@ class NoticeScreen extends Component {
const { markNoticeRead, lastUnreadNotice, history } = this.props
markNoticeRead(lastUnreadNotice)
.then(hasActiveNotices => {
- console.log('ACCEPT TERMS, NO ACTIVE NOTICES', hasActiveNotices, 'background: #222; color: #bada55')
if (!hasActiveNotices) {
history.push(INITIALIZE_BACKUP_PHRASE_ROUTE)
} else {
diff --git a/mascara/src/app/first-time/seed-screen.js b/mascara/src/app/first-time/seed-screen.js
index 1ff4f8ab..d004be77 100644
--- a/mascara/src/app/first-time/seed-screen.js
+++ b/mascara/src/app/first-time/seed-screen.js
@@ -59,6 +59,7 @@ class BackupPhraseScreen extends Component {
componentWillMount () {
const { seedWords, history } = this.props
+
if (!seedWords) {
history.push(DEFAULT_ROUTE)
}