From 571522401e7063b7a7329fd741051bd5b718d014 Mon Sep 17 00:00:00 2001
From: Vasek Mlejnsky
Date: Tue, 28 Aug 2018 08:18:07 +0200
Subject: [PATCH] Fix imports & flow errors
---
.flowconfig | 14 ++++++++++++--
src/actions/ModalActions.js | 2 +-
src/actions/SendFormActions.js | 2 +-
src/components/Log/index.js | 7 ++++++-
src/views/Landing/index.js | 13 +++++++++----
.../Wallet/components/LeftNavigation/Container.js | 2 +-
.../components/LeftNavigation/components/common.js | 1 +
src/views/Wallet/views/AccountReceive/index.js | 5 ++---
.../views/AccountSend/components/AdvancedForm.js | 2 +-
.../AccountSend/components/PendingTransactions.js | 2 +-
src/views/Wallet/views/AccountSend/index.js | 2 +-
.../AccountSummary/components/Details/index.js | 2 +-
.../AccountSummary/components/Tokens/index.js | 4 ++--
src/views/Wallet/views/AccountSummary/index.js | 4 +---
14 files changed, 40 insertions(+), 22 deletions(-)
diff --git a/.flowconfig b/.flowconfig
index ea52332a..b28be239 100644
--- a/.flowconfig
+++ b/.flowconfig
@@ -1,6 +1,7 @@
[include]
[ignore]
+.*/node_modules/fbjs/.*
.*/node_modules/rc-util/.*
.*/node_modules/react-redux/.*
.*/node_modules/redux/.*
@@ -20,8 +21,6 @@
./src/flowtype/npm/web3.js
./src/flowtype/css.js
-
-
[options]
esproposal.class_static_fields=enable
esproposal.class_instance_fields=enable
@@ -31,4 +30,15 @@ esproposal.decorators=ignore
module.name_mapper='.*\(.less\)' -> 'CSSModule'
module.name_mapper='^\(~/\)' -> '/src/'
module.name_mapper='^universal' -> '/src/'
+module.name_mapper='^flowtype' -> '/src/flowtype'
+module.name_mapper='^components' -> '/src/components'
+module.name_mapper='^config' -> '/src/config'
+module.name_mapper='^constants' -> '/src/constants'
+module.name_mapper='^utils' -> '/src/utils'
+module.name_mapper='^reducers' -> '/src/reducers'
+module.name_mapper='^actions' -> '/src/actions'
+module.name_mapper='^views' -> '/src/views'
+module.name_mapper='^data' -> '/src/data'
+module.name_mapper='^services' -> '/src/services'
+module.name_mapper='^support' -> '/src/support'
module.system=haste
diff --git a/src/actions/ModalActions.js b/src/actions/ModalActions.js
index 35266e27..7cc0fc96 100644
--- a/src/actions/ModalActions.js
+++ b/src/actions/ModalActions.js
@@ -1,7 +1,7 @@
/* @flow */
-
import TrezorConnect, { UI, UI_EVENT } from 'trezor-connect';
+import type { Device } from 'trezor-connect';
import * as MODAL from 'actions/constants/modal';
import * as CONNECT from 'actions/constants/TrezorConnect';
diff --git a/src/actions/SendFormActions.js b/src/actions/SendFormActions.js
index 9034d433..8455eb38 100644
--- a/src/actions/SendFormActions.js
+++ b/src/actions/SendFormActions.js
@@ -33,7 +33,7 @@ import type { Config, Coin } from 'reducers/LocalStorageReducer';
import type { Token } from 'reducers/TokensReducer';
import type { State, FeeLevel } from 'reducers/SendFormReducer';
import type { Account } from 'reducers/AccountsReducer';
-import type { Props } from 'components/wallet/account/send';
+import type { Props } from 'views/Wallet/views/AccountSend/Container';
import * as SessionStorageActions from './SessionStorageActions';
import { estimateGas, getGasPrice, pushTx } from './Web3Actions';
diff --git a/src/components/Log/index.js b/src/components/Log/index.js
index 697caf90..63db62fa 100644
--- a/src/components/Log/index.js
+++ b/src/components/Log/index.js
@@ -10,7 +10,12 @@ import Paragraph from 'components/Paragraph';
import * as LogActions from 'actions/LogActions';
import icons from 'config/icons';
-import { State, Dispatch } from 'flowtype';
+import type { State, Dispatch } from 'flowtype';
+
+type Props = {
+ log: $ElementType,
+ toggle: typeof LogActions.toggle
+}
const Wrapper = styled.div`
position: relative;
diff --git a/src/views/Landing/index.js b/src/views/Landing/index.js
index d7c3a414..17e3aba7 100644
--- a/src/views/Landing/index.js
+++ b/src/views/Landing/index.js
@@ -12,6 +12,7 @@ import colors from 'config/colors';
import P from 'components/Paragraph';
import { H2 } from 'components/Heading';
import { isWebUSB } from 'utils/device';
+import { FONT_SIZE } from 'config/variables';
import BrowserNotSupported from './components/BrowserNotSupported';
import ConnectDevice from './components/ConnectDevice';
@@ -64,6 +65,10 @@ const LandingLoader = styled(Loader)`
margin: auto;
`;
+const StyledLink = styled(Link)`
+ font-size: ${FONT_SIZE.BASE};
+`;
+
export default (props: Props) => {
const { devices } = props;
const { browserState, transport } = props.connect;
@@ -124,24 +129,24 @@ export default (props: Props) => {
Device not recognized?
- Try installing the TREZOR Bridge.
-
+
)}
Don't have TREZOR?
- Get one
-
+
)}
diff --git a/src/views/Wallet/components/LeftNavigation/Container.js b/src/views/Wallet/components/LeftNavigation/Container.js
index 7a5fa81a..72c47c69 100644
--- a/src/views/Wallet/components/LeftNavigation/Container.js
+++ b/src/views/Wallet/components/LeftNavigation/Container.js
@@ -8,7 +8,7 @@ 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 type { StateProps, DispatchProps } from './components/common';
import LeftNavigation from './index';
diff --git a/src/views/Wallet/components/LeftNavigation/components/common.js b/src/views/Wallet/components/LeftNavigation/components/common.js
index 4a5a8f72..785107fb 100644
--- a/src/views/Wallet/components/LeftNavigation/components/common.js
+++ b/src/views/Wallet/components/LeftNavigation/components/common.js
@@ -1,6 +1,7 @@
/* @flow */
import * as TrezorConnectActions from 'actions/TrezorConnectActions';
import { toggleDeviceDropdown } from 'actions/WalletActions';
+import type { State } from 'flowtype';
export type StateProps = {
connect: $ElementType,
diff --git a/src/views/Wallet/views/AccountReceive/index.js b/src/views/Wallet/views/AccountReceive/index.js
index 44e3781d..f7476452 100644
--- a/src/views/Wallet/views/AccountReceive/index.js
+++ b/src/views/Wallet/views/AccountReceive/index.js
@@ -1,15 +1,14 @@
/* @flow */
-import React, { Component } from 'react';
+import React from 'react';
import styled from 'styled-components';
import { H2 } from 'components/Heading';
import Tooltip from 'components/Tooltip';
import { QRCode } from 'react-qr-svg';
-import { Notification } from 'components/Notification';
import SelectedAccount from 'views/Wallet/components/SelectedAccount';
-import type { Props } from './index';
+import type { Props } from './Container';
const Wrapper = styled.div``;
const StyledH2 = styled(H2)`
diff --git a/src/views/Wallet/views/AccountSend/components/AdvancedForm.js b/src/views/Wallet/views/AccountSend/components/AdvancedForm.js
index e487c526..b21b86b3 100644
--- a/src/views/Wallet/views/AccountSend/components/AdvancedForm.js
+++ b/src/views/Wallet/views/AccountSend/components/AdvancedForm.js
@@ -3,7 +3,7 @@
import React from 'react';
import Tooltip from 'components/Tooltip';
-import type { Props as BaseProps } from './index';
+import type { Props as BaseProps } from '../Container';
type Props = {
selectedAccount: $ElementType,
diff --git a/src/views/Wallet/views/AccountSend/components/PendingTransactions.js b/src/views/Wallet/views/AccountSend/components/PendingTransactions.js
index 6f23da7e..a8f8c17e 100644
--- a/src/views/Wallet/views/AccountSend/components/PendingTransactions.js
+++ b/src/views/Wallet/views/AccountSend/components/PendingTransactions.js
@@ -10,7 +10,7 @@ import { findAccountTokens } from 'reducers/TokensReducer';
import type { Coin } from 'reducers/LocalStorageReducer';
import type { Token } from 'reducers/TokensReducer';
-import type { Props as BaseProps } from './index';
+import type { Props as BaseProps } from '../Container';
type Props = {
pending: $PropertyType<$ElementType, 'pending'>,
diff --git a/src/views/Wallet/views/AccountSend/index.js b/src/views/Wallet/views/AccountSend/index.js
index 33ddc752..7d8b47d8 100644
--- a/src/views/Wallet/views/AccountSend/index.js
+++ b/src/views/Wallet/views/AccountSend/index.js
@@ -11,7 +11,7 @@ import AdvancedForm from './components/AdvancedForm';
import PendingTransactions from './components/PendingTransactions';
import { FeeSelectValue, FeeSelectOption } from './components/FeeSelect';
-import type { Props } from './index';
+import type { Props } from './Container';
export default class AccountSendContainer extends Component {
componentWillReceiveProps(newProps: Props) {
diff --git a/src/views/Wallet/views/AccountSummary/components/Details/index.js b/src/views/Wallet/views/AccountSummary/components/Details/index.js
index 77a7d9db..450b3141 100644
--- a/src/views/Wallet/views/AccountSummary/components/Details/index.js
+++ b/src/views/Wallet/views/AccountSummary/components/Details/index.js
@@ -5,7 +5,7 @@ import React from 'react';
import BigNumber from 'bignumber.js';
import type { Coin } from 'reducers/LocalStorageReducer';
-import type { Props as BaseProps } from './index';
+import type { Props as BaseProps } from '../../Container';
type Props = {
// coin: $PropertyType<$ElementType, 'coin'>,
diff --git a/src/views/Wallet/views/AccountSummary/components/Tokens/index.js b/src/views/Wallet/views/AccountSummary/components/Tokens/index.js
index e0f99b52..f33ba766 100644
--- a/src/views/Wallet/views/AccountSummary/components/Tokens/index.js
+++ b/src/views/Wallet/views/AccountSummary/components/Tokens/index.js
@@ -7,7 +7,7 @@ import ScaleText from 'react-scale-text';
import * as stateUtils from 'reducers/utils';
import BigNumber from 'bignumber.js';
-import type { Props as BaseProps } from './index';
+import type { Props as BaseProps } from '../../Container';
type Props = {
pending: $PropertyType<$ElementType, 'pending'>,
@@ -18,7 +18,7 @@ type Props = {
const SummaryTokens = (props: Props) => {
if (!props.tokens || props.tokens.length < 1) return null;
- const bgColor = new ColorHash({ lightness: 0.16 } );
+ const bgColor = new ColorHash({ lightness: 0.16 });
const textColor = new ColorHash();
const tokens = props.tokens.map((token, index) => {
diff --git a/src/views/Wallet/views/AccountSummary/index.js b/src/views/Wallet/views/AccountSummary/index.js
index e5836c54..f386176a 100644
--- a/src/views/Wallet/views/AccountSummary/index.js
+++ b/src/views/Wallet/views/AccountSummary/index.js
@@ -6,8 +6,6 @@ import BigNumber from 'bignumber.js';
import { Async as AsyncSelect } from 'react-select';
import Tooltip from 'components/Tooltip';
-import { resolveAfter } from 'utils/promiseUtils';
-import { Notification } from 'components/Notification';
import CoinLogo from 'components/CoinLogo';
import * as stateUtils from 'reducers/utils';
import type { NetworkToken } from 'reducers/LocalStorageReducer';
@@ -16,7 +14,7 @@ import Link from 'components/Link';
import SummaryDetails from './components/Details';
import SummaryTokens from './components/Tokens';
-import type { Props } from './index';
+import type { Props } from './Container';
const AccountHeading = styled.div`
padding: 20px 48px 20px 45px;