gotoBridgeUpdate link

pull/108/head
Szymon Lesisz 6 years ago
parent d8f133ad84
commit 33e326a8f2

@ -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
*/ */

@ -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) => {
return ( if (props.connect.transport && props.connect.transport.outdated) {
<Notification return (
type="warning" <Notification
title="New Trezor Bridge available" type="warning"
actions={ title="New Trezor Bridge is available"
[{ actions={
label: 'Read more', [{
callback: async () => { label: 'Update',
callback: props.routerActions.gotoBridgeUpdate,
}, }]
}] }
} />
/> );
); }
return null;
}; };

@ -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);
Loading…
Cancel
Save