aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/pages/first-time-flow/seed-phrase/seed-phrase.component.js
blob: 9eec89cddb716556a684c04dcafb03bc17ce54f3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import { Switch, Route } from 'react-router-dom'
import RevealSeedPhrase from './reveal-seed-phrase'
import ConfirmSeedPhrase from './confirm-seed-phrase'
import {
  INITIALIZE_SEED_PHRASE_ROUTE,
  INITIALIZE_CONFIRM_SEED_PHRASE_ROUTE,
  DEFAULT_ROUTE,
} from '../../../../routes'

export default class SeedPhrase extends PureComponent {
  static propTypes = {
    address: PropTypes.string,
    history: PropTypes.object,
    seedPhrase: PropTypes.string,
  }

  componentDidMount () {
    const { seedPhrase, history } = this.props

    if (!seedPhrase) {
      history.push(DEFAULT_ROUTE)
    }
  }

  render () {
    const { seedPhrase } = this.props

    return (
      <div className="first-time-flow__wrapper">
        <div className="app-header__logo-container">
          <img
            className="app-header__metafox-logo app-header__metafox-logo--horizontal"
            src="/images/logo/metamask-logo-horizontal.svg"
            height={30}
          />
          <img
            className="app-header__metafox-logo app-header__metafox-logo--icon"
            src="/images/logo/metamask-fox.svg"
            height={42}
            width={42}
          />
        </div>
        <Switch>
          <Route
            exact
            path={INITIALIZE_CONFIRM_SEED_PHRASE_ROUTE}
            render={props => (
              <ConfirmSeedPhrase
                { ...props }
                seedPhrase={seedPhrase}
              />
            )}
          />
          <Route
            exact
            path={INITIALIZE_SEED_PHRASE_ROUTE}
            render={props => (
              <RevealSeedPhrase
                { ...props }
                seedPhrase={seedPhrase}
              />
            )}
          />
        </Switch>
      </div>
    )
  }
}