Skip to content

Commit

Permalink
fix(trade): analytics event
Browse files Browse the repository at this point in the history
  • Loading branch information
adderpositive authored and tomasklim committed Oct 21, 2024
1 parent 324ba30 commit 560dd75
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
3 changes: 2 additions & 1 deletion packages/suite-analytics/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export enum EventType {

AppUriHandler = 'app/uri-handler',

DashboardActions = 'dashboard/actions',

DeviceConnect = 'device-connect',
DeviceDisconnect = 'device-disconnect',
DeviceUpdateFirmware = 'device-update-firmware',
Expand Down Expand Up @@ -48,7 +50,6 @@ export enum EventType {
MenuGuide = 'menu/guide',
MenuNotificationsToggle = 'menu/notifications/toggle',
MenuToggleDiscreet = 'menu/toggle-discreet',
MenuActions = 'menu/actions',

GuideHeaderNavigation = 'guide/header/navigation',
GuideNodeNavigation = 'guide/node/navigation',
Expand Down
12 changes: 6 additions & 6 deletions packages/suite-analytics/src/types/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ export type SuiteAnalyticsEvent =
isAmountPresent: boolean;
};
}
| {
type: EventType.DashboardActions;
payload: {
type: string;
};
}
| {
type: EventType.DeviceConnect;
payload: {
Expand Down Expand Up @@ -224,12 +230,6 @@ export type SuiteAnalyticsEvent =
| {
type: EventType.MenuGuide;
}
| {
type: EventType.MenuActions;
payload: {
type: string;
};
}
| {
type: EventType.GuideHeaderNavigation;
payload: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { HeaderActionButton } from 'src/components/suite/layouts/SuiteLayout/Pag
import { selectDevice } from '@suite-common/wallet-core';
import { spacings } from '@trezor/theme';
import { SelectedAccountStatus } from '@suite-common/wallet-types';
import { selectIsAccountTabPage } from 'src/reducers/suite/routerReducer';
import { selectIsAccountTabPage, selectRouteName } from 'src/reducers/suite/routerReducer';

// instant without computing the layout
const ShowOnLargeDesktopWrapper = styled.div<{ $isActive?: boolean }>`
Expand All @@ -35,11 +35,12 @@ export const TradeActions = ({
const account = selectedAccount?.account;
const device = useSelector(selectDevice);
const isAccountTabPage = useSelector(selectIsAccountTabPage);
const currentRouteName = useSelector(selectRouteName);

const goToWithAnalytics = (...[routeName, options]: Parameters<typeof goto>) => {
if (routeName === 'suite-index') {
if (currentRouteName === 'suite-index') {
analytics.report({
type: EventType.MenuActions,
type: EventType.DashboardActions,
payload: { type: routeName },
});
}
Expand Down

0 comments on commit 560dd75

Please sign in to comment.