diff --git a/app/scripts/components/common/blocks/block-map.tsx b/app/scripts/components/common/blocks/block-map.tsx index 35f8db89a..1b6d7a175 100644 --- a/app/scripts/components/common/blocks/block-map.tsx +++ b/app/scripts/components/common/blocks/block-map.tsx @@ -1,4 +1,4 @@ -import React, { useMemo, useState, useEffect, useContext } from 'react'; +import React, { useMemo, useState, useEffect } from 'react'; import styled from 'styled-components'; import { MapboxOptions } from 'mapbox-gl'; import * as dateFns from 'date-fns'; @@ -37,7 +37,7 @@ import { } from '$components/exploration/data-utils-no-faux-module'; import { useReconcileWithStacMetadata } from '$components/exploration/hooks/use-stac-metadata-datasets'; import { ProjectionOptions, VedaDatum, DatasetData } from '$types/veda'; -import { EnvConfigContext } from '$context/env-config'; +import { useVedaUI } from '$context/veda-ui-provider'; export const mapHeight = '32rem'; const Carto = styled.div` @@ -185,7 +185,7 @@ function MapBlock(props: MapBlockProps) { const [layers, setLayers] = useState(layersToFetch); - const { envApiStacEndpoint } = useContext(EnvConfigContext); + const { envApiStacEndpoint } = useVedaUI(); useReconcileWithStacMetadata(layers, setLayers, envApiStacEndpoint); diff --git a/app/scripts/components/common/blocks/scrollytelling/index.tsx b/app/scripts/components/common/blocks/scrollytelling/index.tsx index 111a2d13c..b36b7bda8 100644 --- a/app/scripts/components/common/blocks/scrollytelling/index.tsx +++ b/app/scripts/components/common/blocks/scrollytelling/index.tsx @@ -2,7 +2,6 @@ import React, { Children, ReactElement, useCallback, - useContext, useEffect, useMemo, useRef, @@ -52,7 +51,7 @@ import { formatSingleDate, reconcileVizDataset } from '$components/common/map/utils'; -import { EnvConfigContext } from '$context/env-config'; +import { useVedaUI } from '$context/veda-ui-provider'; type ResolvedScrollyMapLayer = { vizDataset: VizDatasetSuccess; @@ -260,7 +259,7 @@ const MAP_OPTIONS = { function Scrollytelling(props) { const { children } = props; - const { envApiStacEndpoint } = useContext(EnvConfigContext); + const { envApiStacEndpoint } = useVedaUI(); const { isHeaderHidden, headerHeight, wrapperHeight } = useSlidingStickyHeaderProps(); diff --git a/app/scripts/components/common/map/map-component.tsx b/app/scripts/components/common/map/map-component.tsx index a421e34de..c7fad3e25 100644 --- a/app/scripts/components/common/map/map-component.tsx +++ b/app/scripts/components/common/map/map-component.tsx @@ -1,10 +1,4 @@ -import React, { - useCallback, - ReactElement, - useMemo, - Ref, - useContext -} from 'react'; +import React, { useCallback, ReactElement, useMemo, Ref } from 'react'; import ReactMapGlMap, { LngLatBoundsLike, MapRef } from 'react-map-gl'; import { debounce } from 'lodash'; import useMapStyle from './hooks/use-map-style'; @@ -13,7 +7,7 @@ import { convertProjectionToMapbox } from './controls/map-options/projections'; import { ProjectionOptions } from '$types/veda'; import 'mapbox-gl/dist/mapbox-gl.css'; import 'mapbox-gl-compare/dist/mapbox-gl-compare.css'; -import { EnvConfigContext } from '$context/env-config'; +import { useVedaUI } from '$context/veda-ui-provider'; const maxMapBounds: LngLatBoundsLike = [ [-540, -90], // SW @@ -35,7 +29,7 @@ export default function MapComponent({ onMapLoad?: () => void; interactive?: boolean; }) { - const { envMapboxToken } = useContext(EnvConfigContext); + const { envMapboxToken } = useVedaUI(); const { initialViewState, setInitialViewState, mainId, comparedId } = useMapsContext(); diff --git a/app/scripts/components/common/map/style-generators/basemap.tsx b/app/scripts/components/common/map/style-generators/basemap.tsx index c3805f996..7eafc6398 100644 --- a/app/scripts/components/common/map/style-generators/basemap.tsx +++ b/app/scripts/components/common/map/style-generators/basemap.tsx @@ -1,6 +1,6 @@ import { useQuery } from '@tanstack/react-query'; import { AnySourceImpl, Layer, Style } from 'mapbox-gl'; -import { useContext, useEffect, useMemo, useState } from 'react'; +import { useEffect, useMemo, useState } from 'react'; import { BasemapId, getStyleUrl, @@ -9,7 +9,7 @@ import { } from '../controls/map-options/basemap'; import { ExtendedLayer } from '../types'; import useMapStyle from '../hooks/use-map-style'; -import { EnvConfigContext } from '$context/env-config'; +import { useVedaUI } from '$context/veda-ui-provider'; interface BasemapProps { basemapStyleId?: BasemapId; @@ -33,7 +33,7 @@ export function Basemap({ labelsOption = true, boundariesOption = true }: BasemapProps) { - const { envMapboxToken } = useContext(EnvConfigContext); + const { envMapboxToken } = useVedaUI(); const { updateStyle } = useMapStyle(); const [baseStyle, setBaseStyle] = useState