mirror of
https://github.com/trezor/trezor-wallet
synced 2025-01-01 03:40:53 +00:00
added app notifications
This commit is contained in:
parent
660f8ee69a
commit
ba7cf4d1d4
@ -0,0 +1,11 @@
|
|||||||
|
/* @flow */
|
||||||
|
import * as React from 'react';
|
||||||
|
import { Notification } from 'components/Notification';
|
||||||
|
|
||||||
|
import type { Props } from '../../index';
|
||||||
|
|
||||||
|
export default (props: Props) => {
|
||||||
|
const { online } = props.wallet;
|
||||||
|
// if (online) return null;
|
||||||
|
return (<Notification type="error" title="Wallet is offline" />);
|
||||||
|
};
|
@ -0,0 +1,22 @@
|
|||||||
|
/* @flow */
|
||||||
|
import * as React from 'react';
|
||||||
|
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 () => {
|
||||||
|
|
||||||
|
},
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
@ -0,0 +1,22 @@
|
|||||||
|
/* @flow */
|
||||||
|
import * as React from 'react';
|
||||||
|
import { Notification } from 'components/Notification';
|
||||||
|
|
||||||
|
import type { Props } from '../../index';
|
||||||
|
|
||||||
|
export default (props: Props) => {
|
||||||
|
return (
|
||||||
|
<Notification
|
||||||
|
type="warning"
|
||||||
|
title="Firmware update"
|
||||||
|
actions={
|
||||||
|
[{
|
||||||
|
label: 'Read more',
|
||||||
|
callback: async () => {
|
||||||
|
|
||||||
|
},
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
@ -0,0 +1,46 @@
|
|||||||
|
/* @flow */
|
||||||
|
import * as React from 'react';
|
||||||
|
import { bindActionCreators } from 'redux';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
|
||||||
|
import type { MapStateToProps, MapDispatchToProps } from 'react-redux';
|
||||||
|
import type { State, Dispatch } from 'flowtype';
|
||||||
|
|
||||||
|
import * as NotificationActions from 'actions/NotificationActions';
|
||||||
|
|
||||||
|
import OnlineStatus from './components/OnlineStatus';
|
||||||
|
import UpdateBridge from './components/UpdateBridge';
|
||||||
|
import UpdateFirmware from './components/UpdateFirmware';
|
||||||
|
|
||||||
|
export type StateProps = {
|
||||||
|
connect: $ElementType<State, 'connect'>;
|
||||||
|
wallet: $ElementType<State, 'wallet'>;
|
||||||
|
children?: React.Node;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type DispatchProps = {
|
||||||
|
close: typeof NotificationActions.close;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Props = StateProps & DispatchProps;
|
||||||
|
|
||||||
|
type OwnProps = {};
|
||||||
|
|
||||||
|
const Notifications = (props: Props) => (
|
||||||
|
<React.Fragment>
|
||||||
|
<OnlineStatus {...props} />
|
||||||
|
<UpdateBridge {...props} />
|
||||||
|
<UpdateFirmware {...props} />
|
||||||
|
</React.Fragment>
|
||||||
|
);
|
||||||
|
|
||||||
|
const mapStateToProps: MapStateToProps<State, OwnProps, StateProps> = (state: State): StateProps => ({
|
||||||
|
connect: state.connect,
|
||||||
|
wallet: state.wallet,
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapDispatchToProps: MapDispatchToProps<Dispatch, OwnProps, DispatchProps> = (dispatch: Dispatch): DispatchProps => ({
|
||||||
|
close: bindActionCreators(NotificationActions.close, dispatch),
|
||||||
|
});
|
||||||
|
|
||||||
|
export default connect(mapStateToProps, mapDispatchToProps)(Notifications);
|
@ -12,6 +12,7 @@ import type { State } from 'flowtype';
|
|||||||
import Header from 'components/Header';
|
import Header from 'components/Header';
|
||||||
import Footer from 'components/Footer';
|
import Footer from 'components/Footer';
|
||||||
import ModalContainer from 'components/modals';
|
import ModalContainer from 'components/modals';
|
||||||
|
import AppNotifications from 'components/notifications/App';
|
||||||
import ContextNotifications from 'components/notifications/Context';
|
import ContextNotifications from 'components/notifications/Context';
|
||||||
|
|
||||||
import Log from 'components/Log';
|
import Log from 'components/Log';
|
||||||
@ -84,6 +85,7 @@ const Body = styled.div`
|
|||||||
const Wallet = (props: WalletContainerProps) => (
|
const Wallet = (props: WalletContainerProps) => (
|
||||||
<AppWrapper>
|
<AppWrapper>
|
||||||
<Header />
|
<Header />
|
||||||
|
<AppNotifications />
|
||||||
<WalletWrapper>
|
<WalletWrapper>
|
||||||
{props.wallet.selectedDevice && <LeftNavigation />}
|
{props.wallet.selectedDevice && <LeftNavigation />}
|
||||||
<MainContent>
|
<MainContent>
|
||||||
|
Loading…
Reference in New Issue
Block a user