1
0
mirror of https://github.com/trezor/trezor-wallet synced 2025-01-03 21:00:55 +00:00

TopNavigation to coin specific (removed sign&verify tab from Ripple account)

This commit is contained in:
Szymon Lesisz 2019-01-02 14:33:46 +01:00
parent 0ee1e3a5d9
commit e7c4329a0c

View File

@ -4,14 +4,15 @@ import styled from 'styled-components';
import React from 'react'; import React from 'react';
import { FONT_SIZE, FONT_WEIGHT } from 'config/variables'; import { FONT_SIZE, FONT_WEIGHT } from 'config/variables';
import { NavLink } from 'react-router-dom'; import { NavLink } from 'react-router-dom';
import { connect } from 'react-redux';
import colors from 'config/colors'; import colors from 'config/colors';
import type { State } from 'flowtype';
import type { Location } from 'react-router';
import Indicator from './components/Indicator'; import Indicator from './components/Indicator';
type Props = { type Props = {
location: Location; router: $ElementType<State, 'router'>,
selectedAccount: $ElementType<State, 'selectedAccount'>,
}; };
const Wrapper = styled.div` const Wrapper = styled.div`
@ -56,20 +57,39 @@ class TopNavigationAccount extends React.PureComponent<Props> {
wrapper: ?HTMLElement; wrapper: ?HTMLElement;
render() { render() {
const { state, pathname } = this.props.location; const { state, pathname } = this.props.router.location;
if (!state) return null; if (!state) return null;
const { network } = this.props.selectedAccount;
if (!network) return null;
const basePath = `/device/${state.device}/network/${state.network}/account/${state.account}`; const basePath = `/device/${state.device}/network/${state.network}/account/${state.account}`;
return (
<Wrapper className="account-tabs" ref={this.wrapperRefCallback}> switch (network.type) {
<StyledNavLink exact to={`${basePath}`}>Summary</StyledNavLink> case 'ethereum':
<StyledNavLink to={`${basePath}/receive`}>Receive</StyledNavLink> return (
<StyledNavLink to={`${basePath}/send`}>Send</StyledNavLink> <Wrapper className="account-tabs" ref={this.wrapperRefCallback}>
<StyledNavLink to={`${basePath}/signverify`}>Sign &amp; Verify</StyledNavLink> <StyledNavLink exact to={`${basePath}`}>Summary</StyledNavLink>
<Indicator pathname={pathname} wrapper={() => this.wrapper} /> <StyledNavLink to={`${basePath}/receive`}>Receive</StyledNavLink>
</Wrapper> <StyledNavLink to={`${basePath}/send`}>Send</StyledNavLink>
); <StyledNavLink to={`${basePath}/signverify`}>Sign &amp; Verify</StyledNavLink>
<Indicator pathname={pathname} wrapper={() => this.wrapper} />
</Wrapper>
);
case 'ripple':
return (
<Wrapper className="account-tabs" ref={this.wrapperRefCallback}>
<StyledNavLink exact to={`${basePath}`}>Summary</StyledNavLink>
<StyledNavLink to={`${basePath}/receive`}>Receive</StyledNavLink>
<StyledNavLink to={`${basePath}/send`}>Send</StyledNavLink>
<Indicator pathname={pathname} wrapper={() => this.wrapper} />
</Wrapper>
);
default: return null;
}
} }
} }
export default TopNavigationAccount; export default connect((state: State): Props => ({
router: state.router,
selectedAccount: state.selectedAccount,
}), null)(TopNavigationAccount);