Skip to content

Commit

Permalink
front: introduce MapStyle type
Browse files Browse the repository at this point in the history
  • Loading branch information
clarani committed Feb 12, 2025
1 parent 52dc6a2 commit 0d00d5f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions front/src/applications/editor/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { removeSearchItemMarkersOnMap } from 'common/Map/utils';
import { LAYER_GROUPS_ORDER, LAYERS } from 'config/layerOrder';
import VirtualLayers from 'modules/simulationResult/components/SimulationResultsMap/VirtualLayers';
import { getEditorState } from 'reducers/editor/selectors';
import type { Viewport } from 'reducers/map';
import type { MapStyle, Viewport } from 'reducers/map';
import { getMap, getShowOSM, getTerrain3DExaggeration } from 'reducers/map/selectors';
import { useAppDispatch } from 'store';
import { getMapMouseEventNearestFeature } from 'utils/mapHelper';
Expand All @@ -37,7 +37,7 @@ interface MapProps<S extends CommonToolState = CommonToolState> {
toolState: S;
setToolState: (state: Partial<S>) => void;
activeTool: Tool<S>;
mapStyle: 'normal' | 'dark' | 'blueprint' | 'minimal';
mapStyle: MapStyle;
viewport: Viewport;
setViewport: (newViewport: Partial<Viewport>, updateRouter?: boolean) => void;
mapRef: React.RefObject<MapRef>;
Expand Down
3 changes: 2 additions & 1 deletion front/src/applications/editor/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type { SwitchType } from 'applications/editor/tools/switchEdition/types';
import type { Operation } from 'common/api/osrdEditoastApi';
import type { ModalContextType } from 'common/BootstrapSNCF/ModalSNCF/ModalProvider';
import type { EditorState } from 'reducers/editor';
import type { MapStyle } from 'reducers/map';
import type { AppDispatch } from 'store';

import type { Layer } from './consts';
Expand All @@ -20,7 +21,7 @@ export type Reducer<T> = (value: T) => T;
export type PartialOrReducer<T> = Partial<T> | Reducer<T>;

export type MapState = {
mapStyle: 'normal' | 'dark' | 'blueprint' | 'minimal';
mapStyle: MapStyle;
viewport: ViewState;
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import colors from 'common/Map/Consts/colors';
import { LAYER_GROUPS_ORDER, LAYERS } from 'config/layerOrder';
import type { MapStyle } from 'reducers/map';

import BufferStops from './BufferStops';
import Detectors from './Detectors';
Expand All @@ -15,7 +16,7 @@ import TracksGeographic from './TracksGeographic';

type InfraObjectLayersProps = {
infraId: number;
mapStyle: 'normal' | 'dark' | 'blueprint' | 'minimal';
mapStyle: MapStyle;
hoveredOperationalPointId?: string;
};

Expand Down
3 changes: 2 additions & 1 deletion front/src/common/Map/Layers/OSMLayers/OSMLayers.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import colors from 'common/Map/Consts/colors';
import { LAYER_GROUPS_ORDER, LAYERS } from 'config/layerOrder';
import type { MapStyle } from 'reducers/map';

import Background from '../Background';
import Hillshade from '../Hillshade';
Expand All @@ -9,7 +10,7 @@ import Terrain from '../Terrain';
import TracksOSM from '../TracksOSM';

type OSMLayersProps = {
mapStyle: 'normal' | 'dark' | 'blueprint' | 'minimal';
mapStyle: MapStyle;
showOSM: boolean;
hidePlatforms?: boolean;
};
Expand Down
5 changes: 4 additions & 1 deletion front/src/reducers/map/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ export interface MapSearchMarker {
subtitle?: string;
lonlat: Position;
}

export type MapStyle = 'normal' | 'dark' | 'blueprint' | 'minimal';

export interface MapState {
url: typeof MAP_URL;
mapStyle: 'normal' | 'dark' | 'blueprint' | 'minimal';
mapStyle: MapStyle;
showIGNBDORTHO: boolean;
showIGNSCAN25: boolean;
showIGNCadastre: boolean;
Expand Down

0 comments on commit 0d00d5f

Please sign in to comment.