Skip to content

Commit 2d68db4

Browse files
committed
chore: address review comments
1 parent a46cb7f commit 2d68db4

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

src/app/Scenes/Favorites/Favorites.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { ContextModule } from "@artsy/cohesion"
12
import {
23
BellIcon,
34
Flex,
@@ -24,25 +25,29 @@ import { useFavoritesTracking } from "app/Scenes/Favorites/useFavoritesTracking"
2425
import { prefetchQuery } from "app/utils/queryPrefetching"
2526
import { useEffect } from "react"
2627

27-
const Pills: {
28+
export const Pills: {
2829
Icon: React.FC<{ fill: string }>
2930
title: string
3031
key: FavoritesTab
32+
contextModule: ContextModule
3133
}[] = [
3234
{
3335
Icon: HeartIcon,
3436
title: "Saves",
3537
key: "saves",
38+
contextModule: ContextModule.favoritesSaves,
3639
},
3740
{
3841
Icon: MultiplePersonsIcon,
3942
title: "Follows",
4043
key: "follows",
44+
contextModule: ContextModule.favoritesFollows,
4145
},
4246
{
4347
Icon: BellIcon,
4448
title: "Alerts",
4549
key: "alerts",
50+
contextModule: ContextModule.favoritesAlerts,
4651
},
4752
]
4853

src/app/Scenes/Favorites/useFavoritesTracking.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
TappedOfferSettings,
1616
} from "@artsy/cohesion/dist/Schema/Events/Favorites"
1717
import { useIsFocused } from "@react-navigation/native"
18+
import { Pills } from "app/Scenes/Favorites/Favorites"
1819
import { FavoritesContextStore, FavoritesTab } from "app/Scenes/Favorites/FavoritesContextStore"
1920
import { screen } from "app/utils/track/helpers"
2021
import { useEffect } from "react"
@@ -36,23 +37,12 @@ export const useFavoritesTracking = () => {
3637
}
3738

3839
const trackTappedInfoBubble = () => {
39-
let contextModule: ContextModule
40-
switch (activeTab) {
41-
case "saves":
42-
contextModule = ContextModule.favoritesSaves
43-
break
44-
case "follows":
45-
contextModule = ContextModule.favoritesFollows
46-
break
47-
case "alerts":
48-
contextModule = ContextModule.favoritesAlerts
49-
break
50-
}
40+
const contextModule = Pills.find((pill) => pill.key === activeTab)?.contextModule
5141

5242
const payload: TappedInfoBubble = {
5343
action: ActionType.tappedInfoBubble,
5444
context_screen_owner_type: OwnerType.favorites,
55-
context_module: contextModule,
45+
context_module: contextModule as ContextModule,
5646
subject: "favoritesHeader",
5747
}
5848

0 commit comments

Comments
 (0)