import React from 'react'; import PropTypes from 'prop-types'; import { useSelector } from 'react-redux'; import Box from '../../../../components/ui/box'; import SiteIcon from '../../../../components/ui/site-icon'; import Typography from '../../../../components/ui/typography/typography'; import { COLORS, TYPOGRAPHY, FONT_WEIGHT, DISPLAY, JUSTIFY_CONTENT, BLOCK_SIZES, ALIGN_ITEMS, TEXT_ALIGN, } from '../../../../helpers/constants/design-system'; import { CHAIN_ID_TO_NETWORK_IMAGE_URL_MAP, NETWORK_TO_NAME_MAP, } from '../../../../../shared/constants/network'; export default function ConfirmationNetworkSwitch({ newNetwork }) { const currentNetwork = useSelector((state) => ({ nickname: state.metamask.provider.nickname, type: state.metamask.provider.type, chainId: state.metamask.provider.chainId, })); return ( {currentNetwork.chainId in CHAIN_ID_TO_NETWORK_IMAGE_URL_MAP ? ( ) : (
)} {currentNetwork.nickname || NETWORK_TO_NAME_MAP[currentNetwork.type]}
{newNetwork.chainId in CHAIN_ID_TO_NETWORK_IMAGE_URL_MAP ? ( ) : (
)} {newNetwork.name}
); } ConfirmationNetworkSwitch.propTypes = { newNetwork: PropTypes.shape({ chainId: PropTypes.string.isRequired, name: PropTypes.string.isRequired, }), };