eslint fixes

pull/155/head
Szymon Lesisz 6 years ago
parent f257f98ab5
commit 9671226036

@ -3,4 +3,5 @@ build
build-devel
coverage
node_modules
src/flowtype/npm
src/flowtype/npm
**/_old/*

@ -1,6 +1,5 @@
/* @flow */
import { DEVICE } from 'trezor-connect';
import type { Device } from 'trezor-connect';
import * as CONNECT from 'actions/constants/TrezorConnect';

@ -107,7 +107,7 @@ const DiscoveryLoadingText = styled.span`
`;
// TODO: Refactorize deviceStatus & selectedAccounts
const AccountMenu = (props: Props): ?React$Element<string> => {
const AccountMenu = (props: Props) => {
const selected = props.wallet.selectedDevice;
const { location } = props.router;
const urlParams = location.state;
@ -117,7 +117,7 @@ const AccountMenu = (props: Props): ?React$Element<string> => {
const { config } = props.localStorage;
const selectedCoin = config.coins.find(c => c.network === location.state.network);
if (!selected || !selectedCoin) return;
if (!selected || !selectedCoin) return null;
const fiatRate = props.fiat.find(f => f.network === selectedCoin.network);

@ -1,7 +1,20 @@
/* @flow */
import styled from 'styled-components';
import colors from 'config/colors';
import React, { Component } from 'react';
type Props = {
pathname: string;
}
type State = {
style: {
width: number;
left: number;
}
}
const Wrapper = styled.div`
position: absolute;
bottom: 0px;
@ -13,8 +26,6 @@ const Wrapper = styled.div`
`;
class Indicator extends Component<Props, State> {
reposition: () => void;
constructor(props: Props) {
super(props);
@ -28,25 +39,19 @@ class Indicator extends Component<Props, State> {
this.reposition = this.reposition.bind(this);
}
state: State;
handleResize() {
componentDidMount() {
this.reposition();
window.addEventListener('resize', this.reposition, false);
}
componentDidMount() {
componentDidUpdate() {
this.reposition();
window.addEventListener('resize', this.reposition, false);
}
componentWillUnmount() {
window.removeEventListener('resize', this.reposition, false);
}
componentDidUpdate() {
this.reposition();
}
reposition() {
const tabs = document.querySelector('.account-tabs');
if (!tabs) return;
@ -66,6 +71,12 @@ class Indicator extends Component<Props, State> {
}
}
reposition: () => void;
handleResize() {
this.reposition();
}
render() {
return (
<Wrapper style={this.state.style}>{ this.props.pathname }</Wrapper>

@ -1,10 +1,19 @@
/* @flow */
import styled from 'styled-components';
import React from 'react';
import { FONT_SIZE } from 'config/variables';
import { NavLink } from 'react-router-dom';
import colors from 'config/colors';
import type { Location } from 'react-router';
import Indicator from './components/Indicator';
type Props = {
location: Location;
};
const Wrapper = styled.div`
position: relative;
display: flex;
@ -39,9 +48,11 @@ const StyledNavLink = styled(NavLink)`
`;
const TopNavigationAccount = (props) => {
const urlParams = props.match.params;
const basePath = `/device/${urlParams.device}/network/${urlParams.network}/account/${urlParams.account}`;
const TopNavigationAccount = (props: Props) => {
const { state, pathname } = props.location;
if (!state) return null;
const basePath = `/device/${state.device}/network/${state.network}/account/${state.account}`;
return (
<Wrapper className="account-tabs">
@ -49,7 +60,7 @@ const TopNavigationAccount = (props) => {
<StyledNavLink to={`${basePath}/receive`}>Receive</StyledNavLink>
<StyledNavLink to={`${basePath}/send`}>Send</StyledNavLink>
{/* <StyledNavLink to={`${basePath}/signverify`}>Sign & Verify</StyledNavLink> */}
<Indicator pathname={props.match.pathname} />
<Indicator pathname={pathname} />
</Wrapper>
);
};

Loading…
Cancel
Save