Skip to content

Commit e5afd67

Browse files
front: quick fix for speed label
1 parent acea273 commit e5afd67

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

front/src/modules/simulationResult/components/SimulationResultsMap/TrainHoverPosition.tsx

+14-13
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { mapValues, get } from 'lodash';
1212

1313
import { Viewport } from 'reducers/map';
1414
import { AllowancesSetting, AllowancesSettings, Train } from 'reducers/osrdsimulation/types';
15-
import { sec2time } from 'utils/timeManipulation';
1615
import { boundedValue } from 'utils/numbers';
1716
import { getCurrentBearing } from 'utils/geometry';
1817
import OrderedLayer from 'common/Map/Layers/OrderedLayer';
@@ -25,24 +24,26 @@ function getFill(isSelectedTrain: boolean, ecoBlocks: boolean) {
2524
return '#333';
2625
}
2726

28-
function getSpeedAndTimeLabel(isSelectedTrain: boolean, ecoBlocks: boolean, point: TrainPosition) {
27+
function getSpeedLabel(isSelectedTrain: boolean, ecoBlocks: boolean, point: TrainPosition) {
2928
if (isSelectedTrain) {
3029
return (
31-
<>
32-
<span
33-
className={cx('small', 'font-weight-bold', ecoBlocks ? 'text-secondary' : 'text-primary')}
34-
>
35-
{Math.round(point?.speedTime?.speed ?? 0)}
36-
km/h
37-
</span>
38-
<span className="ml-2 small">{point.speedTime && sec2time(point.speedTime.time)}</span>
39-
</>
30+
<span
31+
className={cx(
32+
'train-speed-label',
33+
'small',
34+
'font-weight-bold',
35+
ecoBlocks ? 'text-secondary' : 'text-primary'
36+
)}
37+
>
38+
{Math.round(point?.speedTime?.speed ?? 0)}
39+
km/h
40+
</span>
4041
);
4142
}
4243
return (
4344
<>
4445
{/* <small>{point.properties.name}</small> */}
45-
<span className="small ml-1 font-weight-bold text-muted">
46+
<span className="train-speed-label small ml-1 font-weight-bold text-muted">
4647
{Math.round(point?.speedTime?.speed)}
4748
km/h
4849
</span>
@@ -206,7 +207,7 @@ function TrainHoverPosition(props: TrainHoverPositionProps) {
206207
) {
207208
const { ecoBlocks } = get(allowancesSettings, train.id, {} as AllowancesSetting);
208209
const fill = getFill(isSelectedTrain as boolean, ecoBlocks);
209-
const label = getSpeedAndTimeLabel(isSelectedTrain, ecoBlocks, point);
210+
const label = getSpeedLabel(isSelectedTrain, ecoBlocks, point);
210211

211212
const zoomLengthFactor = getzoomPowerOf2LengthFactor(viewport);
212213
const [trainGeoJsonPath, headTriangle, rearTriangle] = getTrainPieces(

front/src/styles/scss/applications/operationalStudies/_simulationresults.scss

+6
Original file line numberDiff line numberDiff line change
@@ -624,4 +624,10 @@ select.sm {
624624
}
625625
}
626626
}
627+
628+
/* MAP */
629+
.train-speed-label {
630+
text-shadow : 0 0 3px #FFFFFF;
631+
padding-bottom: 1.5rem
632+
}
627633
}

0 commit comments

Comments
 (0)