Skip to content

Commit

Permalink
Add event from search
Browse files Browse the repository at this point in the history
  • Loading branch information
weberjavi committed Oct 23, 2024
1 parent d92239a commit d57e75e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions apps/fishing-map/features/search/SearchActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import { useAppDispatch } from 'features/app/app.hooks'
import VesselGroupAddButton, {
VesselGroupAddActionButton,
} from 'features/vessel-groups/VesselGroupAddButton'
import { selectActiveActivityAndDetectionsDataviews } from 'features/dataviews/selectors/dataviews.selectors'
import { setVesselGroupConfirmationMode } from 'features/vessel-groups/vessel-groups-modal.slice'
import { HOME, WORKSPACE } from 'routes/routes'
import { EMPTY_FILTERS } from 'features/search/search.config'
import { getRelatedIdentityVesselIds } from 'features/vessel/vessel.utils'
import { TimebarVisualisations } from 'types'
import { TrackCategory, trackEvent } from 'features/app/analytics.hooks'
import { NEW_VESSEL_GROUP_ID } from 'features/vessel-groups/vessel-groups.hooks'
import { cleanVesselSearchResults, selectSelectedVessels } from './search.slice'
import styles from './Search.module.css'
import { selectSearchOption } from './search.config.selectors'
Expand All @@ -30,7 +30,6 @@ function SearchActions() {
const workspaceId = useSelector(selectCurrentWorkspaceId)
const { addNewDataviewInstances } = useDataviewInstancesConnect()
const { dispatchQueryParams, dispatchLocation } = useLocationConnect()
const heatmapDataviews = useSelector(selectActiveActivityAndDetectionsDataviews)
const vesselsSelected = useSelector(selectSelectedVessels)
const activeSearchOption = useSelector(selectSearchOption)

Expand Down Expand Up @@ -70,12 +69,14 @@ function SearchActions() {
}
}

const onAddToVesselGroup = () => {
const dataviewIds = heatmapDataviews.map(({ id }) => id)
const onAddToVesselGroup = (vesselGroupId: string) => {
dispatch(setVesselGroupConfirmationMode('saveAndSeeInWorkspace'))
trackEvent({
category: TrackCategory.SearchVessel,
action: 'Click add to vessel group',
category: TrackCategory.VesselGroups,
action:
vesselGroupId === NEW_VESSEL_GROUP_ID
? 'create_new_vessel_group_from_search'
: 'add_vessels_to_vessel_group_from_search',
label: `${activeSearchOption} search`,
})
}
Expand Down

0 comments on commit d57e75e

Please sign in to comment.