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