Newer
Older
// Copyright 2015-2018 Parity Technologies (UK) Ltd.
Axel Chalon
committed
import React, { PureComponent } from 'react';
import { AccountHeader } from 'fether-ui';
import { accountsInfo$ } from '@parity/light.js';
import light from '@parity/light.js-react';
Axel Chalon
committed
import { Link, Redirect, Route, Switch, withRouter } from 'react-router-dom';
Axel Chalon
committed
import Health from '../Health';
import Send from '../Send';
import TokensList from './TokensList';
import Whitelist from '../Whitelist';
Axel Chalon
committed
import { provideTokens } from '../contexts/TokensContext.js';
import { consumeAccount } from '../contexts/AccountContext.js';
Axel Chalon
committed
@withRouter
this.props.history.push(`/tokens/${this.props.accountAddress}/whitelist`);
renderTokensList = () => {
const { accountsInfo, accountAddress } = this.props;
// If the accountsInfo object is empty (i.e. no accounts), then we redirect
// to the accounts page to create an account
if (accountsInfo && !Object.keys(accountsInfo).length) {
Axel Chalon
committed
return <Redirect to='/accounts/new' />;
Axel Chalon
committed
<Link to='/accounts' className='icon -back'>
Axel Chalon
committed
<nav className='footer-nav'>
<div className='footer-nav_status'>
Axel Chalon
committed
<div className='footer-nav_icons'>
<button className='button -tiny' onClick={this.handleGoToWhitelist}>
Axel Chalon
committed
render () {
const {
match: { url }
} = this.props;
return (
<Switch>
<Route path={`${url}/send`} component={Send} />
<Route path={url}>{this.renderTokensList}</Route>
</Switch>
);