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 { TypographyVariant, FontWeight, Display, JustifyContent, BlockSize, AlignItems, TextAlign, TextColor, } from '../../../../helpers/constants/design-system'; import { CHAIN_ID_TO_NETWORK_IMAGE_URL_MAP, NETWORK_TO_NAME_MAP, } from '../../../../../shared/constants/network'; import { getProviderConfig } from '../../../../ducks/metamask/metamask'; export default function ConfirmationNetworkSwitch({ newNetwork }) { const { chainId, nickname, type } = useSelector(getProviderConfig); return ( {chainId in CHAIN_ID_TO_NETWORK_IMAGE_URL_MAP ? ( ) : (
)} {nickname || NETWORK_TO_NAME_MAP[type]}
{newNetwork.chainId in CHAIN_ID_TO_NETWORK_IMAGE_URL_MAP ? ( ) : (
)} {newNetwork.nickname}
); } ConfirmationNetworkSwitch.propTypes = { newNetwork: PropTypes.shape({ chainId: PropTypes.string.isRequired, nickname: PropTypes.string.isRequired, }), };