1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Use metricsEvent in AmountMaxButton component

This commit is contained in:
Whymarrh Whitby 2019-05-07 13:42:14 -02:30
parent 581128503c
commit d730da8caa
2 changed files with 15 additions and 5 deletions

View File

@ -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()

View File

@ -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()
})