Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

front: redesign map in result page #9481

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';

import DestinationIcon from 'assets/pictures/stdcm/destination.svg';
import DestinationIcon from 'assets/pictures/mapMarkers/destination.svg';
import { useOsrdConfActions, useOsrdConfSelectors } from 'common/osrdContext';
import type { StdcmConfSliceActions } from 'reducers/osrdconf/stdcmConf';
import type { StdcmConfSelectors } from 'reducers/osrdconf/stdcmConf/selectors';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';

import OriginIcon from 'assets/pictures/stdcm/start.svg';
import OriginIcon from 'assets/pictures/mapMarkers/start.svg';
import { useOsrdConfActions, useOsrdConfSelectors } from 'common/osrdContext';
import type { StdcmConfSliceActions } from 'reducers/osrdconf/stdcmConf';
import type { StdcmConfSelectors } from 'reducers/osrdconf/stdcmConf/selectors';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Location } from '@osrd-project/ui-icons';
import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';

import IntermediatePointIcon from 'assets/pictures/stdcm/intermediate-point.svg';
import IntermediatePointIcon from 'assets/pictures/mapMarkers/intermediate-point.svg';
import { useOsrdConfSelectors, useOsrdConfActions } from 'common/osrdContext';
import type { StdcmConfSliceActions } from 'reducers/osrdconf/stdcmConf';
import type { StdcmConfSelectors } from 'reducers/osrdconf/stdcmConf/selectors';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import type { Feature, LineString } from 'geojson';
import { Source } from 'react-map-gl/maplibre';
import { Marker, Source } from 'react-map-gl/maplibre';

import destinationIcon from 'assets/pictures/mapMarkers/destination.svg';
import originIcon from 'assets/pictures/mapMarkers/start.svg';
import OrderedLayer from 'common/Map/Layers/OrderedLayer';

interface RenderItineraryProps {
Expand All @@ -11,14 +13,36 @@ interface RenderItineraryProps {
export default function RenderItinerary(props: RenderItineraryProps) {
const { geojsonPath, layerOrder } = props;

const paint = {
'line-width': 3,
'line-color': '#82be00',
const paintBackgroundLine = {
'line-width': 4,
'line-color': '#EDF9FF',
};

const paintLine = {
'line-width': 1,
'line-color': '#158DCF',
};

// We know we have a geometry so we have at least 2 coordinates
const [startLongitude, startLatitude] = geojsonPath.geometry.coordinates.at(0)!;
const [endLongitude, endLatitude] = geojsonPath.geometry.coordinates.at(-1)!;

return (
<Source type="geojson" data={geojsonPath}>
<OrderedLayer id="geojsonPath" type="line" paint={paint} layerOrder={layerOrder} />
<Marker longitude={startLongitude} latitude={startLatitude} anchor="bottom">
<img src={originIcon} alt="origin" />
</Marker>
<OrderedLayer
id="geojsonPathBackgroundLine"
type="line"
paint={paintBackgroundLine}
beforeId="geojsonPathLine"
layerOrder={layerOrder}
/>
<OrderedLayer id="geojsonPathLine" type="line" paint={paintLine} layerOrder={layerOrder} />
<Marker longitude={endLongitude} latitude={endLatitude} anchor="bottom">
<img src={destinationIcon} alt="destination" />
</Marker>
</Source>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import { Marker } from 'react-map-gl/maplibre';
import { useSelector } from 'react-redux';

import destinationSVG from 'assets/pictures/destination.svg';
import stdcmDestination from 'assets/pictures/mapMarkers/destination.svg';
import stdcmVia from 'assets/pictures/mapMarkers/intermediate-point.svg';
import stdcmOrigin from 'assets/pictures/mapMarkers/start.svg';
import originSVG from 'assets/pictures/origin.svg';
import stdcmDestination from 'assets/pictures/stdcm/destination.svg';
import stdcmVia from 'assets/pictures/stdcm/intermediate-point.svg';
import stdcmOrigin from 'assets/pictures/stdcm/start.svg';
import viaSVG from 'assets/pictures/via.svg';
import { useOsrdConfSelectors } from 'common/osrdContext';
import type { PathStep } from 'reducers/osrdconf/types';
Expand Down
Loading