From ba7cf4d1d490e56303b16331394dc01995f834a4 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Tue, 2 Oct 2018 14:00:48 +0200 Subject: [PATCH] added app notifications --- src/components/notifications/App/Container.js | 0 .../App/components/OnlineStatus/index.js | 11 +++++ .../App/components/UpdateBridge/index.js | 22 +++++++++ .../App/components/UpdateFirmware/index.js | 22 +++++++++ src/components/notifications/App/index.js | 46 +++++++++++++++++++ src/views/Wallet/index.js | 2 + 6 files changed, 103 insertions(+) delete mode 100644 src/components/notifications/App/Container.js create mode 100644 src/components/notifications/App/components/OnlineStatus/index.js create mode 100644 src/components/notifications/App/components/UpdateBridge/index.js create mode 100644 src/components/notifications/App/components/UpdateFirmware/index.js diff --git a/src/components/notifications/App/Container.js b/src/components/notifications/App/Container.js deleted file mode 100644 index e69de29b..00000000 diff --git a/src/components/notifications/App/components/OnlineStatus/index.js b/src/components/notifications/App/components/OnlineStatus/index.js new file mode 100644 index 00000000..1c81c0ca --- /dev/null +++ b/src/components/notifications/App/components/OnlineStatus/index.js @@ -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 (); +}; \ No newline at end of file diff --git a/src/components/notifications/App/components/UpdateBridge/index.js b/src/components/notifications/App/components/UpdateBridge/index.js new file mode 100644 index 00000000..45aec38d --- /dev/null +++ b/src/components/notifications/App/components/UpdateBridge/index.js @@ -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 ( + { + + }, + }] + } + /> + ); +}; \ No newline at end of file diff --git a/src/components/notifications/App/components/UpdateFirmware/index.js b/src/components/notifications/App/components/UpdateFirmware/index.js new file mode 100644 index 00000000..726bafe0 --- /dev/null +++ b/src/components/notifications/App/components/UpdateFirmware/index.js @@ -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 ( + { + + }, + }] + } + /> + ); +}; \ No newline at end of file diff --git a/src/components/notifications/App/index.js b/src/components/notifications/App/index.js index e69de29b..ffce183b 100644 --- a/src/components/notifications/App/index.js +++ b/src/components/notifications/App/index.js @@ -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; + wallet: $ElementType; + children?: React.Node; +} + +export type DispatchProps = { + close: typeof NotificationActions.close; +} + +export type Props = StateProps & DispatchProps; + +type OwnProps = {}; + +const Notifications = (props: Props) => ( + + + + + +); + +const mapStateToProps: MapStateToProps = (state: State): StateProps => ({ + connect: state.connect, + wallet: state.wallet, +}); + +const mapDispatchToProps: MapDispatchToProps = (dispatch: Dispatch): DispatchProps => ({ + close: bindActionCreators(NotificationActions.close, dispatch), +}); + +export default connect(mapStateToProps, mapDispatchToProps)(Notifications); \ No newline at end of file diff --git a/src/views/Wallet/index.js b/src/views/Wallet/index.js index 2003d405..48eb27aa 100644 --- a/src/views/Wallet/index.js +++ b/src/views/Wallet/index.js @@ -12,6 +12,7 @@ import type { State } from 'flowtype'; import Header from 'components/Header'; import Footer from 'components/Footer'; import ModalContainer from 'components/modals'; +import AppNotifications from 'components/notifications/App'; import ContextNotifications from 'components/notifications/Context'; import Log from 'components/Log'; @@ -84,6 +85,7 @@ const Body = styled.div` const Wallet = (props: WalletContainerProps) => (
+ {props.wallet.selectedDevice && }