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

@ -5,18 +5,19 @@ import { Notification } from 'components/Notification';
import type { Props } from '../../index';
export default (props: Props) => {
return (
<Notification
type="warning"
title="New Trezor Bridge available"
actions={
[{
label: 'Read more',
callback: async () => {
},
}]
}
/>
);
if (props.connect.transport && props.connect.transport.outdated) {
return (
<Notification
type="warning"
title="New Trezor Bridge is available"
actions={
[{
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 * 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, OwnProps, StateProps> = (state: St
const mapDispatchToProps: MapDispatchToProps<Dispatch, OwnProps, DispatchProps> = (dispatch: Dispatch): DispatchProps => ({
close: bindActionCreators(NotificationActions.close, dispatch),
routerActions: bindActionCreators(RouterActions, dispatch),
});
export default connect(mapStateToProps, mapDispatchToProps)(Notifications);
Loading…
Cancel
Save