Commit b8def502 authored by isstuev's avatar isstuev

add events

parent ca4603fc
...@@ -13,6 +13,7 @@ export enum EventTypes { ...@@ -13,6 +13,7 @@ export enum EventTypes {
CONTRACT_VERIFICATION = 'Contract verification', CONTRACT_VERIFICATION = 'Contract verification',
QR_CODE = 'QR code', QR_CODE = 'QR code',
PAGE_WIDGET = 'Page widget', PAGE_WIDGET = 'Page widget',
TX_INTERPRETATION_INTERACTION = 'Transaction interpratetion interaction'
} }
/* eslint-disable @typescript-eslint/indent */ /* eslint-disable @typescript-eslint/indent */
...@@ -78,5 +79,8 @@ Type extends EventTypes.QR_CODE ? { ...@@ -78,5 +79,8 @@ Type extends EventTypes.QR_CODE ? {
Type extends EventTypes.PAGE_WIDGET ? { Type extends EventTypes.PAGE_WIDGET ? {
'Type': 'Tokens dropdown' | 'Tokens show all (icon)' | 'Add to watchlist' | 'Address actions (more button)'; 'Type': 'Tokens dropdown' | 'Tokens show all (icon)' | 'Add to watchlist' | 'Address actions (more button)';
} : } :
Type extends EventTypes.TX_INTERPRETATION_INTERACTION ? {
'Type': 'Address click' | 'Token click';
} :
undefined; undefined;
/* eslint-enable @typescript-eslint/indent */ /* eslint-enable @typescript-eslint/indent */
...@@ -6,6 +6,7 @@ import type { TxInterpretationSummary, TxInterpretationVariable } from 'types/ap ...@@ -6,6 +6,7 @@ import type { TxInterpretationSummary, TxInterpretationVariable } from 'types/ap
import config from 'configs/app'; import config from 'configs/app';
import dayjs from 'lib/date/dayjs'; import dayjs from 'lib/date/dayjs';
import * as mixpanel from 'lib/mixpanel/index';
import AddressEntity from 'ui/shared/entities/address/AddressEntity'; import AddressEntity from 'ui/shared/entities/address/AddressEntity';
import TokenEntity from 'ui/shared/entities/token/TokenEntity'; import TokenEntity from 'ui/shared/entities/token/TokenEntity';
import IconSvg from 'ui/shared/IconSvg'; import IconSvg from 'ui/shared/IconSvg';
...@@ -19,14 +20,31 @@ type Props = { ...@@ -19,14 +20,31 @@ type Props = {
} }
const TxInterpretationElementByType = ({ variable }: { variable?: TxInterpretationVariable }) => { const TxInterpretationElementByType = ({ variable }: { variable?: TxInterpretationVariable }) => {
const onAddressClick = React.useCallback(() => {
mixpanel.logEvent(mixpanel.EventTypes.TX_INTERPRETATION_INTERACTION, { Type: 'Address click' });
}, []);
const onTokenClick = React.useCallback(() => {
mixpanel.logEvent(mixpanel.EventTypes.TX_INTERPRETATION_INTERACTION, { Type: 'Token click' });
}, []);
if (!variable) { if (!variable) {
return null; return null;
} }
const { type, value } = variable; const { type, value } = variable;
switch (type) { switch (type) {
case 'address': case 'address': {
return <AddressEntity address={ value } truncation="constant" sx={{ ':not(:first-child)': { marginLeft: 1 } }} whiteSpace="initial"/>; return (
<AddressEntity
address={ value }
truncation="constant"
sx={{ ':not(:first-child)': { marginLeft: 1 } }}
whiteSpace="initial"
onClick={ onAddressClick }
/>
);
}
case 'token': case 'token':
return ( return (
<TokenEntity <TokenEntity
...@@ -37,6 +55,7 @@ const TxInterpretationElementByType = ({ variable }: { variable?: TxInterpretati ...@@ -37,6 +55,7 @@ const TxInterpretationElementByType = ({ variable }: { variable?: TxInterpretati
sx={{ ':not(:first-child)': { marginLeft: 1 } }} sx={{ ':not(:first-child)': { marginLeft: 1 } }}
mr={ 2 } mr={ 2 }
whiteSpace="initial" whiteSpace="initial"
onClick={ onTokenClick }
/> />
); );
case 'currency': { case 'currency': {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment