diff --git a/src/js/views/Device/components/LeftNavigation/Container.js b/src/js/views/Device/components/LeftNavigation/Container.js index c22d2b19..7a5fa81a 100644 --- a/src/js/views/Device/components/LeftNavigation/Container.js +++ b/src/js/views/Device/components/LeftNavigation/Container.js @@ -8,35 +8,14 @@ import * as TrezorConnectActions from 'actions/TrezorConnectActions'; import type { MapStateToProps, MapDispatchToProps } from 'react-redux'; import type { State, Dispatch } from 'flowtype'; +import type { StateProps, DispatchProps } from './common'; + import LeftNavigation from './index'; type OwnProps = { } -type StateProps = { - connect: $ElementType, - accounts: $ElementType, - router: $ElementType, - deviceDropdownOpened: boolean, - fiat: $ElementType, - localStorage: $ElementType, - discovery: $ElementType, - wallet: $ElementType, - devices: $ElementType, - pending: $ElementType, -} - -type DispatchProps = { - toggleDeviceDropdown: typeof toggleDeviceDropdown, - addAccount: typeof TrezorConnectActions.addAccount, - acquireDevice: typeof TrezorConnectActions.acquire, - forgetDevice: typeof TrezorConnectActions.forget, - duplicateDevice: typeof TrezorConnectActions.duplicateDevice, - gotoDeviceSettings: typeof TrezorConnectActions.gotoDeviceSettings, - onSelectDevice: typeof TrezorConnectActions.onSelectDevice, -} - const mapStateToProps: MapStateToProps = (state: State, own: OwnProps): StateProps => ({ connect: state.connect, accounts: state.accounts, @@ -63,4 +42,4 @@ const mapDispatchToProps: MapDispatchToProps export default withRouter( connect(mapStateToProps, mapDispatchToProps)(LeftNavigation), -); \ No newline at end of file +); diff --git a/src/js/views/Device/components/LeftNavigation/Row/index.js b/src/js/views/Device/components/LeftNavigation/Row/index.js index 6436531f..de5f8209 100644 --- a/src/js/views/Device/components/LeftNavigation/Row/index.js +++ b/src/js/views/Device/components/LeftNavigation/Row/index.js @@ -2,7 +2,6 @@ import styled, { css } from 'styled-components'; import React from 'react'; import PropTypes from 'prop-types'; -import colors from 'config/colors'; import { TRANSITION_TIME } from 'config/variables'; const Wrapper = styled.div` diff --git a/src/js/views/Device/components/LeftNavigation/common.js b/src/js/views/Device/components/LeftNavigation/common.js index b8d60525..4a5a8f72 100644 --- a/src/js/views/Device/components/LeftNavigation/common.js +++ b/src/js/views/Device/components/LeftNavigation/common.js @@ -1,8 +1,28 @@ -import PropTypes from 'prop-types'; +/* @flow */ +import * as TrezorConnectActions from 'actions/TrezorConnectActions'; +import { toggleDeviceDropdown } from 'actions/WalletActions'; -export const coinProp = { - coin: PropTypes.shape({ - img: PropTypes.string.isRequired, - name: PropTypes.string.isRequired, - }).isRequired, -}; +export type StateProps = { + connect: $ElementType, + accounts: $ElementType, + router: $ElementType, + deviceDropdownOpened: boolean, + fiat: $ElementType, + localStorage: $ElementType, + discovery: $ElementType, + wallet: $ElementType, + devices: $ElementType, + pending: $ElementType, +} + +export type DispatchProps = { + toggleDeviceDropdown: typeof toggleDeviceDropdown, + addAccount: typeof TrezorConnectActions.addAccount, + acquireDevice: typeof TrezorConnectActions.acquire, + forgetDevice: typeof TrezorConnectActions.forget, + duplicateDevice: typeof TrezorConnectActions.duplicateDevice, + gotoDeviceSettings: typeof TrezorConnectActions.gotoDeviceSettings, + onSelectDevice: typeof TrezorConnectActions.onSelectDevice, +} + +export type Props = StateProps & DispatchProps; \ No newline at end of file diff --git a/src/js/views/Device/components/LeftNavigation/selection/AccountSelection.js b/src/js/views/Device/components/LeftNavigation/selection/AccountSelection.js index c43ee67a..d9243213 100644 --- a/src/js/views/Device/components/LeftNavigation/selection/AccountSelection.js +++ b/src/js/views/Device/components/LeftNavigation/selection/AccountSelection.js @@ -1,26 +1,22 @@ /* @flow */ - - -import React, { PureComponent } from 'react'; -import { Link, NavLink } from 'react-router-dom'; import BigNumber from 'bignumber.js'; - -import { findDeviceAccounts } from 'reducers/AccountsReducer'; -import * as stateUtils from 'reducers/utils'; +import colors from 'config/colors'; import Loader from 'components/common/LoaderCircle'; +import PropTypes from 'prop-types'; +import React from 'react'; +import styled, { css } from 'styled-components'; +import * as stateUtils from 'reducers/utils'; import Tooltip from 'rc-tooltip'; -import colors from 'config/colors'; +import { NavLink } from 'react-router-dom'; +import { findDeviceAccounts } from 'reducers/AccountsReducer'; import { FONT_SIZE, BORDER_WIDTH } from 'config/variables'; -import styled, { css } from 'styled-components'; -import Row from '../Row'; -import PropTypes from 'prop-types'; -//import AsideRowAccount from './row/account/AsideRowAccount'; - -import type { TrezorDevice, Accounts } from 'flowtype'; +import type { Accounts } from 'flowtype'; import type { Props } from './index'; +import Row from '../Row'; + const RowAccountWrapper = styled.div` height: 64px; diff --git a/src/js/views/Device/components/LeftNavigation/selection/CoinSelection.js b/src/js/views/Device/components/LeftNavigation/selection/CoinSelection.js index c3cafddb..b86466c9 100644 --- a/src/js/views/Device/components/LeftNavigation/selection/CoinSelection.js +++ b/src/js/views/Device/components/LeftNavigation/selection/CoinSelection.js @@ -1,7 +1,6 @@ /* @flow */ import coins from 'constants/coins'; import colors from 'config/colors'; -import { FONT_SIZE } from 'config/variables'; import Icon from 'components/common/Icon'; import ICONS from 'config/icons'; import { NavLink } from 'react-router-dom'; @@ -9,15 +8,11 @@ import PropTypes from 'prop-types'; import React, { Component } from 'react'; import styled from 'styled-components'; -import { ICON_SIZE } from 'config/variables'; -import { coinProp } from '../common'; +import { FONT_SIZE, ICON_SIZE } from 'config/variables'; + import Divider from '../Divider'; import Row from '../Row'; -import type { TrezorDevice } from 'flowtype'; -import type { Props } from './index'; - - const CoinNameWrapper = styled.div` display: flex; align-items: center; @@ -43,7 +38,6 @@ const CoinName = ({

{text}

); - CoinName.propTypes = { coinImg: PropTypes.string.isRequired, text: PropTypes.string.isRequired, @@ -77,9 +71,11 @@ const RowCoin = ({ ); - RowCoin.propTypes = { - ...coinProp, + coin: PropTypes.shape({ + img: PropTypes.string.isRequired, + name: PropTypes.string.isRequired, + }).isRequired, icon: PropTypes.shape({ type: PropTypes.string.isRequired, color: PropTypes.string.isRequired, diff --git a/src/js/views/Device/components/LeftNavigation/selection/DeviceSelection.js b/src/js/views/Device/components/LeftNavigation/selection/DeviceSelection.js index 276da1bc..06c60079 100644 --- a/src/js/views/Device/components/LeftNavigation/selection/DeviceSelection.js +++ b/src/js/views/Device/components/LeftNavigation/selection/DeviceSelection.js @@ -1,14 +1,12 @@ /* @flow */ - - import React, { Component } from 'react'; -import Select from 'react-select'; import TrezorConnect from 'trezor-connect'; -import AsideDivider from '../Divider'; - import type { TrezorDevice } from 'flowtype'; -import type { Props } from './index'; + +import type { Props } from '../common'; + +import AsideDivider from '../Divider'; export const DeviceSelect = (props: Props) => { const { devices } = props;