Skip to content

Commit

Permalink
merge deck-migration/base-branch
Browse files Browse the repository at this point in the history
  • Loading branch information
weberjavi committed Apr 15, 2024
2 parents 0be21a5 + d2bc7d2 commit 472a8db
Show file tree
Hide file tree
Showing 105 changed files with 2,418 additions and 2,052 deletions.
10 changes: 5 additions & 5 deletions apps/fishing-map/data/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ export const THINNING_CONFIG: { user: ThinningConfig; guest: ThinningConfig } =
export const REPLACE_URL_PARAMS = ['latitude', 'longitude', 'zoom']

export const POPUP_CATEGORY_ORDER = [
DataviewCategory.Activity,
DataviewCategory.Detections,
DataviewCategory.Events,
DataviewCategory.Environment,
DataviewCategory.Context,
`${DataviewCategory.Activity}`,
`${DataviewCategory.Detections}`,
`${DataviewCategory.Events}`,
`${DataviewCategory.Environment}`,
`${DataviewCategory.Context}`,
]

export const FIT_BOUNDS_REPORT_PADDING = 30
2 changes: 1 addition & 1 deletion apps/fishing-map/data/workspaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const TEMPLATE_CLUSTERS_DATAVIEW_SLUG = 'template-for-bigquery-cluster-ev

export const TEMPLATE_DATAVIEW_SLUGS = [
TEMPLATE_USER_TRACK_SLUG,
// TEMPLATE_VESSEL_DATAVIEW_SLUG,
TEMPLATE_VESSEL_DATAVIEW_SLUG,
TEMPLATE_CONTEXT_DATAVIEW_SLUG,
TEMPLATE_ENVIRONMENT_DATAVIEW_SLUG,
TEMPLATE_GFW_ENVIRONMENT_DATAVIEW_SLUG,
Expand Down
50 changes: 7 additions & 43 deletions apps/fishing-map/features/map/Map.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,11 @@
import {
Fragment,
ReactEventHandler,
ReactNode,
SyntheticEvent,
useCallback,
useEffect,
useMemo,
useRef,
useState,
} from 'react'
import { useCallback, useEffect, useRef } from 'react'
import { useSelector } from 'react-redux'
import { DeckGL, DeckGLRef } from '@deck.gl/react'
import { DeckProps, LayersList, PickingInfo, Position } from '@deck.gl/core'
import { LayersList } from '@deck.gl/core'
import dynamic from 'next/dynamic'
// import { atom, useAtom } from 'jotai'
import { ViewState } from 'react-map-gl'
import { GFWAPI } from '@globalfishingwatch/api-client'
import {
useMapLegend,
useFeatureState,
useLayerComposer,
defaultStyleTransformations,
useDebounce,
useMemoCompare,
} from '@globalfishingwatch/react-hooks'
import { LayerComposer } from '@globalfishingwatch/layer-composer'
import type { RequestParameters } from '@globalfishingwatch/maplibre-gl'
import { RulersLayer, DrawLayer } from '@globalfishingwatch/deck-layers'
Expand All @@ -32,23 +14,11 @@ import {
useSetDeckLayerComposer,
useSetDeckLayerLoadedState,
} from '@globalfishingwatch/deck-layer-composer'
import useMapInstance, { useSetMapInstance } from 'features/map/map-context.hooks'
import { useSetMapInstance } from 'features/map/map-context.hooks'
// import { useClickedEventConnect, useGeneratorsConnect } from 'features/map/map.hooks'
import MapInfo from 'features/map/controls/MapInfo'
import MapControls from 'features/map/controls/MapControls'
import { selectDebugOptions } from 'features/debug/debug.slice'
import { selectShowTimeComparison } from 'features/reports/reports.selectors'
import {
selectIsAnyReportLocation,
selectIsMapDrawing,
selectIsWorkspaceLocation,
} from 'routes/routes.selectors'
import { useMapLoaded, useSetMapIdleAtom } from 'features/map/map-state.hooks'
import { useEnvironmentalBreaksUpdate } from 'features/workspace/environmental/environmental.hooks'
import { mapReadyAtom } from 'features/map/map-state.atom'
import { useMapDrawConnect } from 'features/map/map-draw.hooks'
import { selectHighlightedTime } from 'features/timebar/timebar.slice'
import { hasMapTimeseriesAtom } from 'features/reports/reports-timeseries.hooks'
import { selectIsAnyReportLocation, selectIsWorkspaceLocation } from 'routes/routes.selectors'
import { useSetMapIdleAtom } from 'features/map/map-state.hooks'
import {
useMapCursor,
useMapDrag,
Expand All @@ -57,10 +27,7 @@ import {
} from 'features/map/map-interactions.hooks'
import { useMapRulersDrag } from 'features/map/overlays/rulers/rulers-drag.hooks'
import ErrorNotification from 'features/map/overlays/error-notification/ErrorNotification'
import { selectCurrentDataviewInstancesResolved } from 'features/dataviews/selectors/dataviews.instances.selectors'
import { useMapDeckLayers, useMapLayersLoaded } from 'features/map/map-layers.hooks'
import { MapCoordinates } from 'types'
import { DEFAULT_VIEWPORT } from 'data/config'
import { useMapDeckLayers } from 'features/map/map-layers.hooks'
import MapPopups from 'features/map/popups/MapPopups'
import {
MAP_VIEW,
Expand All @@ -69,8 +36,6 @@ import {
useDisablePositionsOnZoomChanges,
} from './map-viewport.hooks'
import styles from './Map.module.css'
import { useAllMapSourceTilesLoaded, useMapSourceTilesLoadedAtom } from './map-sources.hooks'
import MapLegends from './MapLegends'
import MapAnnotations from './overlays/annotations/Annotations'
import MapAnnotationsDialog from './overlays/annotations/AnnotationsDialog'
import useRulers from './overlays/rulers/rulers.hooks'
Expand Down Expand Up @@ -133,15 +98,14 @@ const MapWrapper = () => {
)
useUpdateViewStateUrlParams()
useDisablePositionsOnZoomChanges()
const { onMapClick } = useMapMouseClick()
const onMapClick = useMapMouseClick()
const { onMouseMove } = useMapMouseHover()
const { getCursor } = useMapCursor()
const { onMapDrag, onMapDragStart, onMapDragEnd } = useMapDrag()
////////////////////////////////////////
// Used it only once here to attach the listener only once
useSetMapIdleAtom()
// useMapSourceTilesLoadedAtom()
useEnvironmentalBreaksUpdate()
useMapRulersDrag()
const { rulers, editingRuler, rulersVisible } = useRulers()
// const map = useMapInstance()
Expand Down
7 changes: 4 additions & 3 deletions apps/fishing-map/features/map/map-interaction.utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { PickingInfo } from '@deck.gl/core'
import { DeckLayerPickingObject } from '@globalfishingwatch/deck-layers'
import { RulerPickingObject } from '@globalfishingwatch/deck-layers'

export const isRulerLayerPoint = (info: PickingInfo) =>
info.sourceLayer?.id === 'RulersLayer-ruler-layer' && info.object.geometry.type === 'Point'
export const isRulerLayerPoint = (feature: DeckLayerPickingObject) =>
feature.category === 'rulers' && (feature as RulerPickingObject).geometry?.type === 'Point'
Loading

0 comments on commit 472a8db

Please sign in to comment.