import React, { useContext } from 'react'; import PropTypes from 'prop-types'; import { useDispatch, useSelector } from 'react-redux'; import classnames from 'classnames'; import { useHistory } from 'react-router-dom'; import Identicon from '../../ui/identicon'; import { I18nContext } from '../../../contexts/i18n'; import { SEND_ROUTE } from '../../../helpers/constants/routes'; import Tooltip from '../../ui/tooltip'; import UserPreferencedCurrencyDisplay from '../user-preferenced-currency-display'; import { PRIMARY, SECONDARY } from '../../../helpers/constants/common'; import { isBalanceCached, getShouldShowFiat, getNativeCurrencyImage, getSelectedAccountCachedBalance, } from '../../../selectors'; import IconButton from '../../ui/icon-button'; import { MetaMetricsContext } from '../../../contexts/metametrics'; import { EVENT, EVENT_NAMES, // CONTEXT_PROPS, } from '../../../../shared/constants/metametrics'; import Spinner from '../../ui/spinner'; import { startNewDraftTransaction } from '../../../ducks/send'; import { AssetType } from '../../../../shared/constants/transaction'; import WalletOverview from './wallet-overview'; const EthOverview = ({ className }) => { const dispatch = useDispatch(); const t = useContext(I18nContext); const trackEvent = useContext(MetaMetricsContext); const history = useHistory(); const balanceIsCached = useSelector(isBalanceCached); const showFiat = useSelector(getShouldShowFiat); const balance = useSelector(getSelectedAccountCachedBalance); const primaryTokenImage = useSelector(getNativeCurrencyImage); return (
{balance ? ( ) : ( )} {balanceIsCached ? ( * ) : null}
{showFiat && balance && ( )}
} buttons={ <> { trackEvent({ event: EVENT_NAMES.NAV_SEND_BUTTON_CLICKED, category: EVENT.CATEGORIES.NAVIGATION, properties: { token_symbol: 'ETH', location: 'Home', text: 'Send', }, }); dispatch( startNewDraftTransaction({ type: AssetType.native }), ).then(() => { history.push(SEND_ROUTE); }); }} /> } className={className} icon={} /> ); }; EthOverview.propTypes = { className: PropTypes.string, }; EthOverview.defaultProps = { className: undefined, }; export default EthOverview;