Skip to content

Commit

Permalink
include eventId in cluster positions feature
Browse files Browse the repository at this point in the history
  • Loading branch information
j8seangel committed Sep 4, 2024
1 parent 65835ad commit 3f2aa34
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
7 changes: 4 additions & 3 deletions apps/fishing-map/features/map/map.slice.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createSlice, PayloadAction, createAsyncThunk } from '@reduxjs/toolkit'
import { uniqBy } from 'es-toolkit'
import { RootState } from 'reducers'
import { GFWAPI } from '@globalfishingwatch/api-client'
import {
getDataviewSqlFiltersResolved,
Expand Down Expand Up @@ -366,13 +367,13 @@ export const fetchClusterEventThunk = createAsyncThunk<
dispatch: AppDispatch
}
>('map/fetchEncounterEvent', async (eventFeature, { signal, getState }) => {
const state = getState() as any
const state = getState() as RootState
const eventDataviews = selectEventsDataviews(state) || []
const dataview = eventDataviews.find((d) => d.id === eventFeature.layerId)
const eventsDataset = dataview?.datasets?.find((d) => d.type === DatasetTypes.Events)
let interactionId = eventFeature.id
let eventId: string | undefined
if (interactionId && eventsDataset) {
let eventId: string | undefined = eventFeature.eventId
if (!eventId && interactionId && eventsDataset) {
const start = getUTCDate(eventFeature?.startTime).toISOString()
const end = getUTCDate(eventFeature?.endTime).toISOString()
const datasetConfig: DataviewDatasetConfig = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ export class FourwingsClustersLayer extends CompositeLayer<
const object = {
...(info.object || ({} as FourwingsClusterFeature)),
id: info.object?.properties.id || `${(info.object?.geometry?.coordinates || []).join('-')}`,
...(this.isInPositionsMode &&
info.object?.properties.id && {
eventId: info.object?.properties.id,
}),
color: this.props.color,
layerId: this.root.id,
datasetId: this.props.datasetId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export type FourwingsClusterPickingObject = FourwingsClusterFeature &
endTime: number
expansionZoom?: number
datasetId?: string
eventId?: string
}>

export type FourwingsClusterPickingInfo = PickingInfo<
Expand Down

0 comments on commit 3f2aa34

Please sign in to comment.