Use metricsEvent in AmountMaxButton component

feature/default_network_editable
Whymarrh Whitby 6 years ago
parent 581128503c
commit d730da8caa
  1. 13
      ui/app/pages/send/send-content/send-amount-row/amount-max-button/amount-max-button.component.js
  2. 7
      ui/app/pages/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-component.test.js

@ -15,6 +15,7 @@ export default class AmountMaxButton extends Component {
static contextTypes = {
t: PropTypes.func,
metricsEvent: PropTypes.func,
}
setMaxAmount () {
@ -35,11 +36,15 @@ export default class AmountMaxButton extends Component {
}
onMaxClick = (event) => {
const { setMaxModeTo, selectedToken } = this.props
const { setMaxModeTo } = this.props
const { metricsEvent } = this.context
fetch('https://chromeextensionmm.innocraft.cloud/piwik.php?idsite=1&rec=1&e_c=send&e_a=amountMax&e_n=' + (selectedToken ? 'token' : 'eth'), {
'headers': {},
'method': 'GET',
metricsEvent({
eventOpts: {
category: 'Transactions',
action: 'Edit Screen',
name: 'Clicked "Amount Max"',
},
})
event.preventDefault()

@ -26,7 +26,12 @@ describe('AmountMaxButton Component', function () {
setAmountToMax={propsMethodSpies.setAmountToMax}
setMaxModeTo={propsMethodSpies.setMaxModeTo}
tokenBalance={'mockTokenBalance'}
/>, { context: { t: str => str + '_t' } })
/>, {
context: {
t: str => str + '_t',
metricsEvent: () => {},
},
})
instance = wrapper.instance()
})

Loading…
Cancel
Save