Move single hop toggle GA event (#1344)
* Move single hop toggle GA event Move GA event from setSingleHopOnly hook to toggle function * Fix code style issues with ESLint * refactor ternary operator out Co-authored-by: Lint Action <lint-action@samuelmeuli.com>
This commit is contained in:
parent
8ace518311
commit
fbb797fa54
@ -1,5 +1,6 @@
|
||||
import React, { useContext, useRef, useState } from 'react'
|
||||
import { Settings, X } from 'react-feather'
|
||||
import ReactGA from 'react-ga'
|
||||
import { Text } from 'rebass'
|
||||
import styled, { ThemeContext } from 'styled-components'
|
||||
import { useOnClickOutside } from '../../hooks/useOnClickOutside'
|
||||
@ -236,7 +237,13 @@ export default function SettingsTab() {
|
||||
<Toggle
|
||||
id="toggle-disable-multihop-button"
|
||||
isActive={singleHopOnly}
|
||||
toggle={() => (singleHopOnly ? setSingleHopOnly(false) : setSingleHopOnly(true))}
|
||||
toggle={() => {
|
||||
ReactGA.event({
|
||||
category: 'Routing',
|
||||
action: singleHopOnly ? 'disable single hop' : 'enable single hop'
|
||||
})
|
||||
setSingleHopOnly(!singleHopOnly)
|
||||
}}
|
||||
/>
|
||||
</RowBetween>
|
||||
</AutoColumn>
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { ChainId, Pair, Token } from '@uniswap/sdk'
|
||||
import flatMap from 'lodash.flatmap'
|
||||
import ReactGA from 'react-ga'
|
||||
import { useCallback, useMemo } from 'react'
|
||||
import { shallowEqual, useDispatch, useSelector } from 'react-redux'
|
||||
import { BASES_TO_TRACK_LIQUIDITY_FOR, PINNED_PAIRS } from '../../constants'
|
||||
@ -92,10 +91,6 @@ export function useUserSingleHopOnly(): [boolean, (newSingleHopOnly: boolean) =>
|
||||
|
||||
const setSingleHopOnly = useCallback(
|
||||
(newSingleHopOnly: boolean) => {
|
||||
ReactGA.event({
|
||||
category: 'Routing',
|
||||
action: newSingleHopOnly ? 'enable single hop' : 'disable single hop'
|
||||
})
|
||||
dispatch(updateUserSingleHopOnly({ userSingleHopOnly: newSingleHopOnly }))
|
||||
},
|
||||
[dispatch]
|
||||
|
Loading…
Reference in New Issue
Block a user