2021-02-04 19:15:23 +01:00
|
|
|
import React from 'react';
|
|
|
|
import { useSelector } from 'react-redux';
|
|
|
|
import PropTypes from 'prop-types';
|
2020-04-29 19:10:51 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
import { alertIsOpen as unconnectedAccountAlertIsOpen } from '../../../ducks/alerts/unconnected-account';
|
|
|
|
import { alertIsOpen as invalidCustomNetworkAlertIsOpen } from '../../../ducks/alerts/invalid-custom-network';
|
|
|
|
import InvalidCustomNetworkAlert from './invalid-custom-network-alert';
|
|
|
|
import UnconnectedAccountAlert from './unconnected-account-alert';
|
2020-04-29 19:10:51 +02:00
|
|
|
|
2020-10-06 19:57:02 +02:00
|
|
|
const Alerts = ({ history }) => {
|
2020-11-03 00:41:28 +01:00
|
|
|
const _invalidCustomNetworkAlertIsOpen = useSelector(
|
|
|
|
invalidCustomNetworkAlertIsOpen,
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2020-11-03 00:41:28 +01:00
|
|
|
const _unconnectedAccountAlertIsOpen = useSelector(
|
|
|
|
unconnectedAccountAlertIsOpen,
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2020-04-29 19:10:51 +02:00
|
|
|
|
2020-10-06 19:57:02 +02:00
|
|
|
if (_invalidCustomNetworkAlertIsOpen) {
|
2021-02-04 19:15:23 +01:00
|
|
|
return <InvalidCustomNetworkAlert history={history} />;
|
2020-10-06 19:57:02 +02:00
|
|
|
}
|
2020-04-29 19:10:51 +02:00
|
|
|
if (_unconnectedAccountAlertIsOpen) {
|
2021-02-04 19:15:23 +01:00
|
|
|
return <UnconnectedAccountAlert />;
|
2020-04-29 19:10:51 +02:00
|
|
|
}
|
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
return null;
|
|
|
|
};
|
2020-04-29 19:10:51 +02:00
|
|
|
|
2020-10-06 19:57:02 +02:00
|
|
|
Alerts.propTypes = {
|
|
|
|
history: PropTypes.object.isRequired,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2020-10-06 19:57:02 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
export default Alerts;
|