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

Fix AssetList metric events (#8639)

The metric events in the `AssetList` component were using the
`useMetricEvent` hook incorrectly.
This commit is contained in:
Mark Stacey 2020-05-21 13:06:06 -03:00 committed by GitHub
parent f9ea9b541a
commit 57531ad100
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,7 +18,20 @@ const AssetList = () => {
const selectedAccountBalance = useSelector((state) => getCurrentAccountWithSendEtherInfo(state).balance)
const selectedTokenAddress = useSelector((state) => state.metamask.selectedTokenAddress)
const showFiat = useSelector(getShouldShowFiat)
const metricsEvent = useMetricEvent()
const selectTokenEvent = useMetricEvent({
eventOpts: {
category: 'Navigation',
action: 'Token Menu',
name: 'Clicked Token',
},
})
const addTokenEvent = useMetricEvent({
eventOpts: {
category: 'Navigation',
action: 'Token Menu',
name: 'Clicked "Add Token"',
},
})
const {
currency: primaryCurrency,
@ -56,25 +69,13 @@ const AssetList = () => {
<TokenList
onTokenClick={(tokenAddress) => {
dispatch(setSelectedToken(tokenAddress))
metricsEvent({
eventOpts: {
category: 'Navigation',
action: 'Token Menu',
name: 'Clicked Token',
},
})
selectTokenEvent()
}}
/>
<AddTokenButton
onClick={() => {
history.push(ADD_TOKEN_ROUTE)
metricsEvent({
eventOpts: {
category: 'Navigation',
action: 'Token Menu',
name: 'Clicked "Add Token"',
},
})
addTokenEvent()
}}
/>
</>