Skip to content

Commit bad7724

Browse files
committed
chore: clean up
1 parent bd24e7e commit bad7724

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/app/Scenes/InfiniteDiscovery/Components/Swiper/Swiper.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type SwiperProps = {
2727
cards: ReactElement<{ key: Key }>[]
2828
isRewindRequested: SharedValue<boolean>
2929
onNewCardReached?: (key: Key) => void
30-
onRewind: (key: Key) => void
30+
onRewind: (key: Key, wasSwiped?: boolean) => void
3131
onSwipe: (swipedKey: Key, nextKey: Key) => void
3232
} & (
3333
| { onTrigger?: never; swipedIndexCallsOnTrigger?: never }
@@ -90,7 +90,7 @@ export const Swiper: React.FC<SwiperProps> = ({
9090
})
9191

9292
if (!!lastSwipedCardKey) {
93-
runOnJS(onRewind)(lastSwipedCardKey as Key)
93+
runOnJS(onRewind)(lastSwipedCardKey as Key, false)
9494
}
9595

9696
isRewindRequested.value = false

src/app/Scenes/InfiniteDiscovery/InfiniteDiscovery.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,16 @@ export const InfiniteDiscovery: React.FC<InfiniteDiscoveryProps> = ({
150150
/**
151151
* The callback for when a swiped card is brought back.
152152
* @param key The key of the card that was brought back.
153+
* @param wasSwiped True if the card was swiped back, false if it was tapped back.
153154
*/
154-
const handleRewind = (key: Key) => {
155+
const handleRewind = (key: Key, wasSwiped = true) => {
155156
const artwork = artworks.find((artwork) => artwork.internalID === key)
156157

157158
if (!artwork) {
158159
return
159160
}
160161

161-
trackEvent(tracks.tappedRewind(artwork.internalID, artwork.slug))
162+
trackEvent(tracks.tappedRewind(artwork.internalID, artwork.slug, wasSwiped ? "swipe" : "tap"))
162163

163164
setTopArtworkId(artwork.internalID)
164165
}
@@ -343,12 +344,13 @@ const tracks = {
343344
action: ActionType.tappedClose,
344345
context_module: ContextModule.infiniteDiscovery,
345346
}),
346-
tappedRewind: (artworkId: string, artworkSlug: string) => ({
347+
tappedRewind: (artworkId: string, artworkSlug: string, mode: "swipe" | "tap") => ({
347348
action: ActionType.tappedRewind,
348349
context_module: ContextModule.infiniteDiscovery,
349350
context_screen_owner_id: artworkId,
350351
context_screen_owner_slug: artworkSlug,
351352
context_screen_owner_type: OwnerType.infiniteDiscoveryArtwork,
353+
mode,
352354
}),
353355
tappedSummary: () => ({
354356
action: ActionType.tappedToast,

0 commit comments

Comments
 (0)