1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-24 09:18:09 +00:00

gotoBridgeUpdate link

This commit is contained in:
Szymon Lesisz 2018-10-04 19:47:10 +02:00
parent d8f133ad84
commit 33e326a8f2
3 changed files with 32 additions and 14 deletions

View File

@ -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 * Try to redirect to initial url
*/ */

View File

@ -5,18 +5,19 @@ import { Notification } from 'components/Notification';
import type { Props } from '../../index'; import type { Props } from '../../index';
export default (props: Props) => { export default (props: Props) => {
if (props.connect.transport && props.connect.transport.outdated) {
return ( return (
<Notification <Notification
type="warning" type="warning"
title="New Trezor Bridge available" title="New Trezor Bridge is available"
actions={ actions={
[{ [{
label: 'Read more', label: 'Update',
callback: async () => { callback: props.routerActions.gotoBridgeUpdate,
},
}] }]
} }
/> />
); );
}
return null;
}; };

View File

@ -7,6 +7,7 @@ import type { MapStateToProps, MapDispatchToProps } from 'react-redux';
import type { State, Dispatch } from 'flowtype'; import type { State, Dispatch } from 'flowtype';
import * as NotificationActions from 'actions/NotificationActions'; import * as NotificationActions from 'actions/NotificationActions';
import * as RouterActions from 'actions/RouterActions';
import OnlineStatus from './components/OnlineStatus'; import OnlineStatus from './components/OnlineStatus';
import UpdateBridge from './components/UpdateBridge'; import UpdateBridge from './components/UpdateBridge';
@ -20,6 +21,7 @@ export type StateProps = {
export type DispatchProps = { export type DispatchProps = {
close: typeof NotificationActions.close; close: typeof NotificationActions.close;
routerActions: typeof RouterActions;
} }
export type Props = StateProps & DispatchProps; export type Props = StateProps & DispatchProps;
@ -41,6 +43,7 @@ const mapStateToProps: MapStateToProps<State, OwnProps, StateProps> = (state: St
const mapDispatchToProps: MapDispatchToProps<Dispatch, OwnProps, DispatchProps> = (dispatch: Dispatch): DispatchProps => ({ const mapDispatchToProps: MapDispatchToProps<Dispatch, OwnProps, DispatchProps> = (dispatch: Dispatch): DispatchProps => ({
close: bindActionCreators(NotificationActions.close, dispatch), close: bindActionCreators(NotificationActions.close, dispatch),
routerActions: bindActionCreators(RouterActions, dispatch),
}); });
export default connect(mapStateToProps, mapDispatchToProps)(Notifications); export default connect(mapStateToProps, mapDispatchToProps)(Notifications);