Skip to content

Commit

Permalink
Add MixPanel tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
jordankzf committed Aug 1, 2024
1 parent 3423eea commit 94e4725
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import TokenTile from '@components/tokenTile';
import type { FungibleToken, Token } from '@secretkeylabs/xverse-core';
import { AnalyticsEvents, type FungibleToken, type Token } from '@secretkeylabs/xverse-core';
import { StyledP } from '@ui-library/common.styled';
import Sheet from '@ui-library/sheet';
import { trackMixPanel } from '@utils/mixpanel';
import { useTranslation } from 'react-i18next';
import styled from 'styled-components';
import useFromTokens from './useFromTokens';
Expand Down Expand Up @@ -43,6 +44,9 @@ export default function TokenFromBottomSheet({ visible, title, onSelectCoin, onC
currency="BTC"
onPress={() => {
onSelectCoin(token);
trackMixPanel(AnalyticsEvents.SelectTokenToSwapFrom, {
token: 'Bitcoin',
});
onClose();
}}
/>
Expand All @@ -56,6 +60,9 @@ export default function TokenFromBottomSheet({ visible, title, onSelectCoin, onC
currency="FT"
onPress={() => {
onSelectCoin(token);
trackMixPanel(AnalyticsEvents.SelectTokenToSwapFrom, {
token: token.name,
});
onClose();
}}
fungibleToken={token}
Expand Down
15 changes: 14 additions & 1 deletion src/app/screens/swap/components/tokenToBottomSheet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@ import TokenTile from '@components/tokenTile';
import useDebounce from '@hooks/useDebounce';
import { MagnifyingGlass } from '@phosphor-icons/react';
import { mapFTProtocolToSwapProtocol, mapSwapTokenToFT } from '@screens/swap/utils';
import type { FungibleToken, Protocol, Token, TokenBasic } from '@secretkeylabs/xverse-core';
import {
AnalyticsEvents,
type FungibleToken,
type Protocol,
type Token,
type TokenBasic,
} from '@secretkeylabs/xverse-core';
import { StyledP } from '@ui-library/common.styled';
import Input from '@ui-library/input';
import Sheet from '@ui-library/sheet';
import Spinner from '@ui-library/spinner';
import { trackMixPanel } from '@utils/mixpanel';
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
import styled from 'styled-components';
Expand Down Expand Up @@ -152,6 +159,9 @@ export default function TokenToBottomSheet({
currency="BTC"
onPress={() => {
onSelectCoin(token);
trackMixPanel(AnalyticsEvents.SelectTokenToSwapTo, {
token: 'Bitcoin',
});
handleClose();
}}
hideBalance
Expand All @@ -166,6 +176,9 @@ export default function TokenToBottomSheet({
currency="FT"
onPress={() => {
onSelectCoin(token);
trackMixPanel(AnalyticsEvents.SelectTokenToSwapTo, {
token: token.name ?? token.ticker,
});
handleClose();
}}
fungibleToken={mapSwapTokenToFT(token)}
Expand Down

0 comments on commit 94e4725

Please sign in to comment.