From 7f2ce33d339ba33cd7394bd3010f247fd72708c2 Mon Sep 17 00:00:00 2001 From: slowbackspace Date: Fri, 15 Mar 2019 10:46:54 +0100 Subject: [PATCH] fix flow --- src/actions/LocalStorageActions.js | 2 +- src/actions/WalletActions.js | 1 + .../components/LeftNavigation/components/common.js | 6 ++++-- .../Account/Summary/components/Balance/index.js | 2 +- .../Summary/ripple/components/Balance/index.js | 2 +- src/views/Wallet/views/WalletSettings/index.js | 12 ++++++++++-- 6 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/actions/LocalStorageActions.js b/src/actions/LocalStorageActions.js index ce6d4f9f..9c42dc69 100644 --- a/src/actions/LocalStorageActions.js +++ b/src/actions/LocalStorageActions.js @@ -286,7 +286,7 @@ const loadStorageData = (): ThunkAction => (dispatch: Dispatch): void => { const hideBalance: ?boolean = storageUtils.get(TYPE, KEY_HIDE_BALANCE); if (hideBalance) { - dispatch(WalletActions.setHideBalance(JSON.parse(hideBalance))); + dispatch(WalletActions.setHideBalance(hideBalance)); } }; diff --git a/src/actions/WalletActions.js b/src/actions/WalletActions.js index ff72e87b..f8d8765f 100644 --- a/src/actions/WalletActions.js +++ b/src/actions/WalletActions.js @@ -65,6 +65,7 @@ export type WalletAction = } | { type: typeof WALLET.SET_HIDE_BALANCE, + toggled: boolean, }; export const init = (): ThunkAction => (dispatch: Dispatch): void => { diff --git a/src/views/Wallet/components/LeftNavigation/components/common.js b/src/views/Wallet/components/LeftNavigation/components/common.js index 6da7ba88..f492cc62 100644 --- a/src/views/Wallet/components/LeftNavigation/components/common.js +++ b/src/views/Wallet/components/LeftNavigation/components/common.js @@ -3,7 +3,7 @@ import * as TrezorConnectActions from 'actions/TrezorConnectActions'; import * as DiscoveryActions from 'actions/DiscoveryActions'; import * as RouterActions from 'actions/RouterActions'; import * as ModalActions from 'actions/ModalActions'; -import { toggleDeviceDropdown } from 'actions/WalletActions'; +import * as WalletActions from 'actions/WalletActions'; import type { State } from 'flowtype'; export type StateProps = { @@ -19,7 +19,9 @@ export type StateProps = { }; export type DispatchProps = { - toggleDeviceDropdown: typeof toggleDeviceDropdown, + toggleDeviceDropdown: typeof WalletActions.toggleDeviceDropdown, + toggleSidebar: typeof WalletActions.toggleSidebar, + setHideBalance: typeof WalletActions.setHideBalance, addAccount: typeof DiscoveryActions.addAccount, acquireDevice: typeof TrezorConnectActions.acquire, forgetDevice: typeof TrezorConnectActions.forget, diff --git a/src/views/Wallet/views/Account/Summary/components/Balance/index.js b/src/views/Wallet/views/Account/Summary/components/Balance/index.js index 2dc821ca..1be08bd8 100644 --- a/src/views/Wallet/views/Account/Summary/components/Balance/index.js +++ b/src/views/Wallet/views/Account/Summary/components/Balance/index.js @@ -111,7 +111,7 @@ class AccountBalance extends PureComponent { }; } - componentDidUpdate(prevProps) { + componentDidUpdate(prevProps: Props) { if (prevProps.isHidden !== this.props.isHidden) { this.setState({ isHidden: this.props.isHidden, diff --git a/src/views/Wallet/views/Account/Summary/ripple/components/Balance/index.js b/src/views/Wallet/views/Account/Summary/ripple/components/Balance/index.js index fcbd25ba..f9b37546 100644 --- a/src/views/Wallet/views/Account/Summary/ripple/components/Balance/index.js +++ b/src/views/Wallet/views/Account/Summary/ripple/components/Balance/index.js @@ -109,7 +109,7 @@ class AccountBalance extends PureComponent { }; } - componentDidUpdate(prevProps) { + componentDidUpdate(prevProps: Props) { console.log(this.props.isHidden); if (prevProps.isHidden !== this.props.isHidden) { this.setState({ diff --git a/src/views/Wallet/views/WalletSettings/index.js b/src/views/Wallet/views/WalletSettings/index.js index 1c3e8276..532a44e8 100644 --- a/src/views/Wallet/views/WalletSettings/index.js +++ b/src/views/Wallet/views/WalletSettings/index.js @@ -4,8 +4,16 @@ import React from 'react'; import { FormattedMessage } from 'react-intl'; import Content from 'views/Wallet/components/Content'; -import { Switch, Select, Link, Button, Tooltip, Icon, icons as ICONS } from 'trezor-ui-components'; -import colors from 'config/colors'; +import { + Switch, + Select, + Link, + Button, + Tooltip, + Icon, + icons as ICONS, + colors, +} from 'trezor-ui-components'; import { FIAT_CURRENCIES } from 'config/app'; import { FONT_SIZE } from 'config/variables'; import l10nCommonMessages from 'views/common.messages';