From 5a6dedb314e5cd811dab3e9b374a08e2a9ccc640 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Thu, 4 Oct 2018 19:47:10 +0200 Subject: [PATCH] gotoBridgeUpdate link --- src/actions/RouterActions.js | 14 +++++++++ .../App/components/UpdateBridge/index.js | 29 ++++++++++--------- src/components/notifications/App/index.js | 3 ++ 3 files changed, 32 insertions(+), 14 deletions(-) diff --git a/src/actions/RouterActions.js b/src/actions/RouterActions.js index 8bab4d55..a5ce0788 100644 --- a/src/actions/RouterActions.js +++ b/src/actions/RouterActions.js @@ -303,6 +303,20 @@ export const gotoDeviceSettings = (device: TrezorDevice): ThunkAction => (dispat } }; +/* +* Go to UpdateBridge page +*/ +export const gotoBridgeUpdate = (): ThunkAction => (dispatch: Dispatch): void => { + dispatch(goto('/bridge')); +}; + +/* +* Go to UpdateFirmware page +*/ +export const gotoFirmwareUpdate = (): ThunkAction => (dispatch: Dispatch): void => { + dispatch(goto('/firmware-update')); +}; + /* * Try to redirect to initial url */ diff --git a/src/components/notifications/App/components/UpdateBridge/index.js b/src/components/notifications/App/components/UpdateBridge/index.js index 45aec38d..e418bb37 100644 --- a/src/components/notifications/App/components/UpdateBridge/index.js +++ b/src/components/notifications/App/components/UpdateBridge/index.js @@ -5,18 +5,19 @@ import { Notification } from 'components/Notification'; import type { Props } from '../../index'; export default (props: Props) => { - return ( - { - - }, - }] - } - /> - ); + if (props.connect.transport && props.connect.transport.outdated) { + return ( + + ); + } + return null; }; \ No newline at end of file diff --git a/src/components/notifications/App/index.js b/src/components/notifications/App/index.js index ffce183b..6167cfcf 100644 --- a/src/components/notifications/App/index.js +++ b/src/components/notifications/App/index.js @@ -7,6 +7,7 @@ import type { MapStateToProps, MapDispatchToProps } from 'react-redux'; import type { State, Dispatch } from 'flowtype'; import * as NotificationActions from 'actions/NotificationActions'; +import * as RouterActions from 'actions/RouterActions'; import OnlineStatus from './components/OnlineStatus'; import UpdateBridge from './components/UpdateBridge'; @@ -20,6 +21,7 @@ export type StateProps = { export type DispatchProps = { close: typeof NotificationActions.close; + routerActions: typeof RouterActions; } export type Props = StateProps & DispatchProps; @@ -41,6 +43,7 @@ const mapStateToProps: MapStateToProps = (state: St const mapDispatchToProps: MapDispatchToProps = (dispatch: Dispatch): DispatchProps => ({ close: bindActionCreators(NotificationActions.close, dispatch), + routerActions: bindActionCreators(RouterActions, dispatch), }); export default connect(mapStateToProps, mapDispatchToProps)(Notifications); \ No newline at end of file