1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
metamask-extension/ui/components/app/alerts/alerts.js

33 lines
989 B
JavaScript
Raw Normal View History

import React from 'react';
import { useSelector } from 'react-redux';
import PropTypes from 'prop-types';
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';
const Alerts = ({ history }) => {
2020-11-03 00:41:28 +01:00
const _invalidCustomNetworkAlertIsOpen = useSelector(
invalidCustomNetworkAlertIsOpen,
);
2020-11-03 00:41:28 +01:00
const _unconnectedAccountAlertIsOpen = useSelector(
unconnectedAccountAlertIsOpen,
);
if (_invalidCustomNetworkAlertIsOpen) {
return <InvalidCustomNetworkAlert history={history} />;
}
if (_unconnectedAccountAlertIsOpen) {
return <UnconnectedAccountAlert />;
}
return null;
};
Alerts.propTypes = {
history: PropTypes.object.isRequired,
};
export default Alerts;