mirror of
https://github.com/trezor/trezor-wallet
synced 2025-07-08 23:58:21 +00:00
eslint fixes
This commit is contained in:
parent
f257f98ab5
commit
9671226036
@ -4,3 +4,4 @@ build-devel
|
|||||||
coverage
|
coverage
|
||||||
node_modules
|
node_modules
|
||||||
src/flowtype/npm
|
src/flowtype/npm
|
||||||
|
**/_old/*
|
@ -1,6 +1,5 @@
|
|||||||
/* @flow */
|
/* @flow */
|
||||||
|
|
||||||
|
|
||||||
import { DEVICE } from 'trezor-connect';
|
import { DEVICE } from 'trezor-connect';
|
||||||
import type { Device } from 'trezor-connect';
|
import type { Device } from 'trezor-connect';
|
||||||
import * as CONNECT from 'actions/constants/TrezorConnect';
|
import * as CONNECT from 'actions/constants/TrezorConnect';
|
||||||
|
@ -107,7 +107,7 @@ const DiscoveryLoadingText = styled.span`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
// TODO: Refactorize deviceStatus & selectedAccounts
|
// TODO: Refactorize deviceStatus & selectedAccounts
|
||||||
const AccountMenu = (props: Props): ?React$Element<string> => {
|
const AccountMenu = (props: Props) => {
|
||||||
const selected = props.wallet.selectedDevice;
|
const selected = props.wallet.selectedDevice;
|
||||||
const { location } = props.router;
|
const { location } = props.router;
|
||||||
const urlParams = location.state;
|
const urlParams = location.state;
|
||||||
@ -117,7 +117,7 @@ const AccountMenu = (props: Props): ?React$Element<string> => {
|
|||||||
const { config } = props.localStorage;
|
const { config } = props.localStorage;
|
||||||
const selectedCoin = config.coins.find(c => c.network === location.state.network);
|
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);
|
const fiatRate = props.fiat.find(f => f.network === selectedCoin.network);
|
||||||
|
|
||||||
|
@ -1,7 +1,20 @@
|
|||||||
|
/* @flow */
|
||||||
|
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import colors from 'config/colors';
|
import colors from 'config/colors';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
pathname: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
type State = {
|
||||||
|
style: {
|
||||||
|
width: number;
|
||||||
|
left: number;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const Wrapper = styled.div`
|
const Wrapper = styled.div`
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0px;
|
bottom: 0px;
|
||||||
@ -13,8 +26,6 @@ const Wrapper = styled.div`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
class Indicator extends Component<Props, State> {
|
class Indicator extends Component<Props, State> {
|
||||||
reposition: () => void;
|
|
||||||
|
|
||||||
constructor(props: Props) {
|
constructor(props: Props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
@ -28,25 +39,19 @@ class Indicator extends Component<Props, State> {
|
|||||||
this.reposition = this.reposition.bind(this);
|
this.reposition = this.reposition.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
state: State;
|
|
||||||
|
|
||||||
handleResize() {
|
|
||||||
this.reposition();
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.reposition();
|
this.reposition();
|
||||||
window.addEventListener('resize', this.reposition, false);
|
window.addEventListener('resize', this.reposition, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
|
||||||
window.removeEventListener('resize', this.reposition, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidUpdate() {
|
componentDidUpdate() {
|
||||||
this.reposition();
|
this.reposition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
window.removeEventListener('resize', this.reposition, false);
|
||||||
|
}
|
||||||
|
|
||||||
reposition() {
|
reposition() {
|
||||||
const tabs = document.querySelector('.account-tabs');
|
const tabs = document.querySelector('.account-tabs');
|
||||||
if (!tabs) return;
|
if (!tabs) return;
|
||||||
@ -66,6 +71,12 @@ class Indicator extends Component<Props, State> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reposition: () => void;
|
||||||
|
|
||||||
|
handleResize() {
|
||||||
|
this.reposition();
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Wrapper style={this.state.style}>{ this.props.pathname }</Wrapper>
|
<Wrapper style={this.state.style}>{ this.props.pathname }</Wrapper>
|
||||||
|
@ -1,10 +1,19 @@
|
|||||||
|
/* @flow */
|
||||||
|
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { FONT_SIZE } from 'config/variables';
|
import { FONT_SIZE } from 'config/variables';
|
||||||
import { NavLink } from 'react-router-dom';
|
import { NavLink } from 'react-router-dom';
|
||||||
import colors from 'config/colors';
|
import colors from 'config/colors';
|
||||||
|
|
||||||
|
import type { Location } from 'react-router';
|
||||||
|
|
||||||
import Indicator from './components/Indicator';
|
import Indicator from './components/Indicator';
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
location: Location;
|
||||||
|
};
|
||||||
|
|
||||||
const Wrapper = styled.div`
|
const Wrapper = styled.div`
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -39,9 +48,11 @@ const StyledNavLink = styled(NavLink)`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
|
|
||||||
const TopNavigationAccount = (props) => {
|
const TopNavigationAccount = (props: Props) => {
|
||||||
const urlParams = props.match.params;
|
const { state, pathname } = props.location;
|
||||||
const basePath = `/device/${urlParams.device}/network/${urlParams.network}/account/${urlParams.account}`;
|
if (!state) return null;
|
||||||
|
|
||||||
|
const basePath = `/device/${state.device}/network/${state.network}/account/${state.account}`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Wrapper className="account-tabs">
|
<Wrapper className="account-tabs">
|
||||||
@ -49,7 +60,7 @@ const TopNavigationAccount = (props) => {
|
|||||||
<StyledNavLink to={`${basePath}/receive`}>Receive</StyledNavLink>
|
<StyledNavLink to={`${basePath}/receive`}>Receive</StyledNavLink>
|
||||||
<StyledNavLink to={`${basePath}/send`}>Send</StyledNavLink>
|
<StyledNavLink to={`${basePath}/send`}>Send</StyledNavLink>
|
||||||
{/* <StyledNavLink to={`${basePath}/signverify`}>Sign & Verify</StyledNavLink> */}
|
{/* <StyledNavLink to={`${basePath}/signverify`}>Sign & Verify</StyledNavLink> */}
|
||||||
<Indicator pathname={props.match.pathname} />
|
<Indicator pathname={pathname} />
|
||||||
</Wrapper>
|
</Wrapper>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user