Skip to content

Commit

Permalink
Update naming
Browse files Browse the repository at this point in the history
  • Loading branch information
dzole0311 committed Nov 18, 2024
1 parent ba98c4a commit 0b13f55
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions app/scripts/components/common/blocks/block-map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 { VedauiConfigContext } from '$context/config-context';
import { EnvConfigContext } from '$context/env-config';

export const mapHeight = '32rem';
const Carto = styled.div`
Expand Down Expand Up @@ -185,7 +185,7 @@ function MapBlock(props: MapBlockProps) {

const [layers, setLayers] = useState<VizDataset[]>(layersToFetch);

const { envApiStacEndpoint } = useContext(VedauiConfigContext);
const { envApiStacEndpoint } = useContext(EnvConfigContext);

useReconcileWithStacMetadata(layers, setLayers, envApiStacEndpoint);

Expand Down
4 changes: 2 additions & 2 deletions app/scripts/components/common/blocks/scrollytelling/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ import {
formatSingleDate,
reconcileVizDataset
} from '$components/common/map/utils';
import { VedauiConfigContext } from '$context/config-context';
import { EnvConfigContext } from '$context/env-config';

type ResolvedScrollyMapLayer = {
vizDataset: VizDatasetSuccess;
Expand Down Expand Up @@ -260,7 +260,7 @@ const MAP_OPTIONS = {
function Scrollytelling(props) {
const { children } = props;

const { envApiStacEndpoint } = useContext(VedauiConfigContext);
const { envApiStacEndpoint } = useContext(EnvConfigContext);

const { isHeaderHidden, headerHeight, wrapperHeight } =
useSlidingStickyHeaderProps();
Expand Down
4 changes: 2 additions & 2 deletions app/scripts/components/common/map/map-component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,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 { VedauiConfigContext } from '$context/config-context';
import { EnvConfigContext } from '$context/env-config';

const maxMapBounds: LngLatBoundsLike = [
[-540, -90], // SW
Expand All @@ -35,7 +35,7 @@ export default function MapComponent({
onMapLoad?: () => void;
interactive?: boolean;
}) {
const { envMapboxToken } = useContext(VedauiConfigContext);
const { envMapboxToken } = useContext(EnvConfigContext);

const { initialViewState, setInitialViewState, mainId, comparedId } =
useMapsContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from '../controls/map-options/basemap';
import { ExtendedLayer } from '../types';
import useMapStyle from '../hooks/use-map-style';
import { VedauiConfigContext } from '$context/config-context';
import { EnvConfigContext } from '$context/env-config';

interface BasemapProps {
basemapStyleId?: BasemapId;
Expand All @@ -33,7 +33,7 @@ export function Basemap({
labelsOption = true,
boundariesOption = true
}: BasemapProps) {
const { envMapboxToken } = useContext(VedauiConfigContext);
const { envMapboxToken } = useContext(EnvConfigContext);
const { updateStyle } = useMapStyle();
const [baseStyle, setBaseStyle] = useState<Style | undefined>(undefined);

Expand Down
4 changes: 2 additions & 2 deletions app/scripts/components/exploration/components/map/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { usePreviousValue } from '$utils/use-effect-previous';
import { ExtendedStyle } from '$components/common/map/styles';
import DrawControl from '$components/common/map/controls/aoi';
import CustomAoIControl from '$components/common/map/controls/aoi/custom-aoi-control';
import { VedauiConfigContext } from '$context/config-context';
import { EnvConfigContext } from '$context/env-config';

interface ExplorationMapProps {
datasets: TimelineDataset[];
Expand All @@ -37,7 +37,7 @@ interface ExplorationMapProps {

export function ExplorationMap(props: ExplorationMapProps) {
const { envApiStacEndpoint, envMapboxToken } =
useContext(VedauiConfigContext);
useContext(EnvConfigContext);

const { datasets, setDatasets, selectedDay, selectedCompareDay } = props;

Expand Down
4 changes: 2 additions & 2 deletions app/scripts/components/exploration/components/map/layer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { VectorTimeseries } from '$components/common/map/style-generators/vector
import { ZarrTimeseries } from '$components/common/map/style-generators/zarr-timeseries';
import { CMRTimeseries } from '$components/common/map/style-generators/cmr-timeseries';
import { ActionStatus } from '$utils/status';
import { VedauiConfigContext } from '$context/config-context';
import { EnvConfigContext } from '$context/env-config';

interface LayerProps {
id: string;
Expand All @@ -23,7 +23,7 @@ interface LayerProps {

export function Layer(props: LayerProps) {
const { envApiStacEndpoint, envApiRasterEndpoint } =
useContext(VedauiConfigContext);
useContext(EnvConfigContext);

const { id: layerId, dataset, order, selectedDay, onStatusChange } = props;
const { isVisible, opacity, colorMap } = dataset.settings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from '../types.d.ts';
import { MAX_QUERY_NUM } from '../constants';
import useAois from '$components/common/map/controls/hooks/use-aois';
import { VedauiConfigContext } from '$context/config-context';
import { EnvConfigContext } from '$context/env-config';

export function useAnalysisController() {
const [controller, setController] = useAtom(analysisControllerAtom);
Expand Down Expand Up @@ -73,7 +73,7 @@ export function useAnalysisDataRequest({
const queryClient = useQueryClient();

const { envApiRasterEndpoint, envApiStacEndpoint } =
useContext(VedauiConfigContext);
useContext(EnvConfigContext);

const selectedInterval = useAtomValue(selectedIntervalAtom);
const { features } = useAois();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import React, { createContext } from 'react';

interface VedauiConfig {
interface EnvConfig {
envMapboxToken: string;
envApiStacEndpoint: string;
envApiRasterEndpoint: string;
}

export const VedauiConfigContext = createContext<VedauiConfig>({
export const EnvConfigContext = createContext<EnvConfig>({
envMapboxToken: '',
envApiStacEndpoint: '',
envApiRasterEndpoint: ''
});

export function VedauiConfigProvider({
export function EnvConfigProvider({
config,
children
}: {
config: VedauiConfig;
config: EnvConfig;
children: any;
}) {
return (
<VedauiConfigContext.Provider value={config}>
<EnvConfigContext.Provider value={config}>
{children}
</VedauiConfigContext.Provider>
</EnvConfigContext.Provider>
);
}
4 changes: 2 additions & 2 deletions app/scripts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import ExplorationAndAnalysis from '$components/exploration';
import useTimelineDatasetAtom from '$components/exploration/hooks/use-timeline-dataset-atom';
import { timelineDatasetsAtom } from '$components/exploration/atoms/datasets';
import { DatasetSelectorModal } from '$components/exploration/components/dataset-selector-modal';
import { VedauiConfigProvider } from '$context/config-context';
import { EnvConfigProvider } from '$context/env-config';

// Adding .last property to array
/* eslint-disable-next-line fp/no-mutating-methods */
Expand Down Expand Up @@ -61,7 +61,7 @@ export {
PageHero,
PageHeader,
ReactQueryProvider,
VedauiConfigProvider,
EnvConfigProvider,
StoriesHubContent,
LogoContainer,
ExplorationAndAnalysis,
Expand Down
6 changes: 3 additions & 3 deletions app/scripts/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,23 @@ import {
STORIES_PATH,
EXPLORATION_PATH
} from '$utils/routes';
import { VedauiConfigProvider } from '$context/config-context';
import { EnvConfigProvider } from '$context/env-config';

const composingComponents = [
// Add contexts here.
ErrorBoundary,
ReactQueryProvider,
LayoutRootContextProvider,
({ children }) => (
<VedauiConfigProvider
<EnvConfigProvider
config={{
envMapboxToken: process.env.MAPBOX_TOKEN ?? '',
envApiStacEndpoint: process.env.API_STAC_ENDPOINT ?? '',
envApiRasterEndpoint: process.env.API_RASTER_ENDPOINT ?? ''
}}
>
{children}
</VedauiConfigProvider>
</EnvConfigProvider>
)
];

Expand Down

0 comments on commit 0b13f55

Please sign in to comment.