Skip to content

Commit

Permalink
chore: Add tracking to Alert list actions
Browse files Browse the repository at this point in the history
  • Loading branch information
olerichter00 committed Nov 7, 2024
1 parent 72859c1 commit 63b70f9
Showing 1 changed file with 20 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { ActionType } from "@artsy/cohesion"
import { Box, Clickable, Flex, Spacer, Sup, Text } from "@artsy/palette"
import { createFragmentContainer, graphql } from "react-relay"
import { SavedSearchAlertListItem_item$data } from "__generated__/SavedSearchAlertListItem_item.graphql"
import { EditAlertEntity } from "Apps/Settings/Routes/SavedSearchAlerts/types"
import { createFragmentContainer, graphql } from "react-relay"
import { useTracking } from "react-tracking"
import { useJump } from "Utils/Hooks/useJump"

export type SavedSearchAlertListItemVariant = "active" | "inactive"
Expand All @@ -19,9 +21,10 @@ export const SavedSearchAlertListItem: React.FC<SavedSearchAlertListItemProps> =
onEditAlertClick,
onViewArtworksClick,
}) => {
const matchingArtworksCount = item.artworksConnection?.counts?.total

const { jumpTo } = useJump()
const { trackEvent } = useTracking()

const matchingArtworksCount = item.artworksConnection?.counts?.total

return (
<Box
Expand Down Expand Up @@ -82,14 +85,16 @@ export const SavedSearchAlertListItem: React.FC<SavedSearchAlertListItemProps> =
<Clickable
textDecoration="underline"
onClick={() => {
{
onEditAlertClick({
id: item.internalID,
name: item.settings?.name ?? undefined,
artistIds: item.artistIDs as string[],
})
jumpTo("Alerts")
}
trackEvent({
action_type: ActionType.clickedEditAlert,
alert_id: item.internalID,
})
onEditAlertClick({
id: item.internalID,
name: item.settings?.name ?? undefined,
artistIds: item.artistIDs as string[],
})
jumpTo("Alerts")
}}
>
Edit
Expand All @@ -105,6 +110,10 @@ export const SavedSearchAlertListItem: React.FC<SavedSearchAlertListItemProps> =
>
<Clickable
onClick={() => {
trackEvent({
action_type: ActionType.clickedViewArtworks,
alert_id: item.internalID,
})
onViewArtworksClick({
id: item.internalID,
name: item.settings?.name ?? undefined,
Expand Down

0 comments on commit 63b70f9

Please sign in to comment.