File tree 2 files changed +9
-14
lines changed
2 files changed +9
-14
lines changed Original file line number Diff line number Diff line change
1
+ import { ContextModule } from "@artsy/cohesion"
1
2
import {
2
3
BellIcon ,
3
4
Flex ,
@@ -24,25 +25,29 @@ import { useFavoritesTracking } from "app/Scenes/Favorites/useFavoritesTracking"
24
25
import { prefetchQuery } from "app/utils/queryPrefetching"
25
26
import { useEffect } from "react"
26
27
27
- const Pills : {
28
+ export const Pills : {
28
29
Icon : React . FC < { fill : string } >
29
30
title : string
30
31
key : FavoritesTab
32
+ contextModule : ContextModule
31
33
} [ ] = [
32
34
{
33
35
Icon : HeartIcon ,
34
36
title : "Saves" ,
35
37
key : "saves" ,
38
+ contextModule : ContextModule . favoritesSaves ,
36
39
} ,
37
40
{
38
41
Icon : MultiplePersonsIcon ,
39
42
title : "Follows" ,
40
43
key : "follows" ,
44
+ contextModule : ContextModule . favoritesFollows ,
41
45
} ,
42
46
{
43
47
Icon : BellIcon ,
44
48
title : "Alerts" ,
45
49
key : "alerts" ,
50
+ contextModule : ContextModule . favoritesAlerts ,
46
51
} ,
47
52
]
48
53
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import {
15
15
TappedOfferSettings ,
16
16
} from "@artsy/cohesion/dist/Schema/Events/Favorites"
17
17
import { useIsFocused } from "@react-navigation/native"
18
+ import { Pills } from "app/Scenes/Favorites/Favorites"
18
19
import { FavoritesContextStore , FavoritesTab } from "app/Scenes/Favorites/FavoritesContextStore"
19
20
import { screen } from "app/utils/track/helpers"
20
21
import { useEffect } from "react"
@@ -36,23 +37,12 @@ export const useFavoritesTracking = () => {
36
37
}
37
38
38
39
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
51
41
52
42
const payload : TappedInfoBubble = {
53
43
action : ActionType . tappedInfoBubble ,
54
44
context_screen_owner_type : OwnerType . favorites ,
55
- context_module : contextModule ,
45
+ context_module : contextModule as ContextModule ,
56
46
subject : "favoritesHeader" ,
57
47
}
58
48
You can’t perform that action at this time.
0 commit comments