import React, { useContext } from 'react'; import classnames from 'classnames'; import { useDispatch, useSelector } from 'react-redux'; import { getSendMaxModeState, isSendFormInvalid, toggleSendMaxMode, } from '../../../../../ducks/send'; import { useI18nContext } from '../../../../../hooks/useI18nContext'; import { MetaMetricsContext } from '../../../../../contexts/metametrics'; import { EVENT } from '../../../../../../shared/constants/metametrics'; export default function AmountMaxButton() { const isDraftTransactionInvalid = useSelector(isSendFormInvalid); const maxModeOn = useSelector(getSendMaxModeState); const dispatch = useDispatch(); const trackEvent = useContext(MetaMetricsContext); const t = useI18nContext(); const onMaxClick = () => { trackEvent({ event: 'Clicked "Amount Max"', category: EVENT.CATEGORIES.TRANSACTIONS, properties: { action: 'Edit Screen', legacy_event: true, }, }); dispatch(toggleSendMaxMode()); }; const disabled = isDraftTransactionInvalid; return ( ); }