1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-23 02:10:12 +01:00
metamask-extension/ui/components/app/alerts/alerts.js
2021-04-28 14:53:59 -05:00

33 lines
989 B
JavaScript

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 }) => {
const _invalidCustomNetworkAlertIsOpen = useSelector(
invalidCustomNetworkAlertIsOpen,
);
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;