Newer
Older
// Copyright 2015-2018 Parity Technologies (UK) Ltd.
import React, { PureComponent } from 'react';
import { accountsInfo$, defaultAccount$ } from '@parity/light.js';
import { Link, Redirect } from 'react-router-dom';
@light({
accountsInfo: accountsInfo$,
defaultAccount: defaultAccount$
})
const {
accountsInfo,
defaultAccount,
location: { state }
} = 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) {
return <Redirect to='/accounts' />;
}
// The address is defaultAccount, but if we are coming from the accounts
// page, then the address is also put inside the route state, for faster
// access.
const myAddress = (state && state.address) || defaultAccount;
myAddress &&
accountsInfo[myAddress] &&
accountsInfo[myAddress].name
<Link to='/accounts' className='icon -back'>
Back
</Link>
<nav className='footer-nav'>
<div className='footer-nav_status'>
<Link to='/settings' className='icon -settings'>