You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
1.9 KiB
78 lines
1.9 KiB
6 years ago
|
import React, { PureComponent } from 'react'
|
||
|
import PropTypes from 'prop-types'
|
||
6 years ago
|
import Media from 'react-media'
|
||
6 years ago
|
import { Redirect } from 'react-router-dom'
|
||
6 years ago
|
import WalletView from '../../components/app/wallet-view'
|
||
|
import TransactionView from '../../components/app/transaction-view'
|
||
6 years ago
|
import ProviderApproval from '../provider-approval'
|
||
|
|
||
6 years ago
|
import {
|
||
6 years ago
|
INITIALIZE_SEED_PHRASE_ROUTE,
|
||
6 years ago
|
RESTORE_VAULT_ROUTE,
|
||
|
CONFIRM_TRANSACTION_ROUTE,
|
||
6 years ago
|
CONFIRM_ADD_SUGGESTED_TOKEN_ROUTE,
|
||
6 years ago
|
} from '../../helpers/constants/routes'
|
||
6 years ago
|
|
||
|
export default class Home extends PureComponent {
|
||
|
static propTypes = {
|
||
|
history: PropTypes.object,
|
||
|
forgottenPassword: PropTypes.bool,
|
||
|
seedWords: PropTypes.string,
|
||
6 years ago
|
suggestedTokens: PropTypes.object,
|
||
6 years ago
|
unconfirmedTransactionsCount: PropTypes.number,
|
||
6 years ago
|
providerRequests: PropTypes.array,
|
||
6 years ago
|
}
|
||
|
|
||
|
componentDidMount () {
|
||
6 years ago
|
const {
|
||
|
history,
|
||
|
suggestedTokens = {},
|
||
|
unconfirmedTransactionsCount = 0,
|
||
|
} = this.props
|
||
|
|
||
|
// suggested new tokens
|
||
|
if (Object.keys(suggestedTokens).length > 0) {
|
||
|
history.push(CONFIRM_ADD_SUGGESTED_TOKEN_ROUTE)
|
||
|
}
|
||
6 years ago
|
|
||
6 years ago
|
if (unconfirmedTransactionsCount > 0) {
|
||
6 years ago
|
history.push(CONFIRM_TRANSACTION_ROUTE)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
render () {
|
||
|
const {
|
||
|
forgottenPassword,
|
||
|
seedWords,
|
||
6 years ago
|
providerRequests,
|
||
6 years ago
|
} = this.props
|
||
|
|
||
|
// seed words
|
||
|
if (seedWords) {
|
||
6 years ago
|
return <Redirect to={{ pathname: INITIALIZE_SEED_PHRASE_ROUTE }}/>
|
||
6 years ago
|
}
|
||
|
|
||
|
if (forgottenPassword) {
|
||
|
return <Redirect to={{ pathname: RESTORE_VAULT_ROUTE }} />
|
||
|
}
|
||
|
|
||
6 years ago
|
if (providerRequests && providerRequests.length > 0) {
|
||
6 years ago
|
return (
|
||
|
<ProviderApproval providerRequest={providerRequests[0]} />
|
||
|
)
|
||
6 years ago
|
}
|
||
|
|
||
6 years ago
|
return (
|
||
|
<div className="main-container">
|
||
|
<div className="account-and-transaction-details">
|
||
6 years ago
|
<Media
|
||
|
query="(min-width: 576px)"
|
||
|
render={() => <WalletView />}
|
||
|
/>
|
||
6 years ago
|
<TransactionView />
|
||
6 years ago
|
</div>
|
||
|
</div>
|
||
|
)
|
||
|
}
|
||
|
}
|