From 69e93af654aeb222b2f3d157b0268207fbe35aa9 Mon Sep 17 00:00:00 2001
From: alexandredamiron <alexandredamiron@gmail.com>
Date: Mon, 30 Oct 2023 20:19:18 +0100
Subject: [PATCH 1/3] front: quick fix for speed label

---
 .../SimulationResultsMap/TrainHoverPosition.tsx          | 9 ++++-----
 .../operationalStudies/_simulationresults.scss           | 7 +++++++
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/front/src/modules/simulationResult/components/SimulationResultsMap/TrainHoverPosition.tsx b/front/src/modules/simulationResult/components/SimulationResultsMap/TrainHoverPosition.tsx
index 4965195c2e5..f636fee25ba 100644
--- a/front/src/modules/simulationResult/components/SimulationResultsMap/TrainHoverPosition.tsx
+++ b/front/src/modules/simulationResult/components/SimulationResultsMap/TrainHoverPosition.tsx
@@ -24,24 +24,23 @@ function getFill(isSelectedTrain: boolean, ecoBlocks: boolean) {
   return '#333';
 }
 
-function getSpeedAndTimeLabel(isSelectedTrain: boolean, ecoBlocks: boolean, point: TrainPosition) {
+function getSpeedLabel(isSelectedTrain: boolean, ecoBlocks: boolean, point: TrainPosition) {
   if (isSelectedTrain) {
     return (
       <>
         <span
-          className={cx('small', 'font-weight-bold', ecoBlocks ? 'text-secondary' : 'text-primary')}
+          className={cx('small', 'train-speed-label', 'font-weight-bold', ecoBlocks ? 'text-secondary' : 'text-primary')}
         >
           {Math.round(point?.speedTime?.speed ?? 0)}
           km/h
         </span>
-        {point.speedTime && <span className="ml-2 small">{`${point.speedTime.time}`}</span>}
       </>
     );
   }
   return (
     <>
       {/* <small>{point.properties.name}</small> */}
-      <span className="small ml-1 font-weight-bold text-muted">
+      <span className="train-speed-label small ml-1 font-weight-bold text-muted">
         {Math.round(point?.speedTime?.speed)}
         km/h
       </span>
@@ -205,7 +204,7 @@ function TrainHoverPosition(props: TrainHoverPositionProps) {
   ) {
     const { ecoBlocks } = get(allowancesSettings, train.id, {} as AllowancesSetting);
     const fill = getFill(isSelectedTrain as boolean, ecoBlocks);
-    const label = getSpeedAndTimeLabel(isSelectedTrain, ecoBlocks, point);
+    const label = getSpeedLabel(isSelectedTrain, ecoBlocks, point);
 
     const zoomLengthFactor = getzoomPowerOf2LengthFactor(viewport);
     const [trainGeoJsonPath, headTriangle, rearTriangle] = getTrainPieces(
diff --git a/front/src/styles/scss/applications/operationalStudies/_simulationresults.scss b/front/src/styles/scss/applications/operationalStudies/_simulationresults.scss
index 4c002ef48af..72dec02ef49 100644
--- a/front/src/styles/scss/applications/operationalStudies/_simulationresults.scss
+++ b/front/src/styles/scss/applications/operationalStudies/_simulationresults.scss
@@ -43,4 +43,11 @@
     padding: 1rem;
     border-radius: 4px;
   }
+
+  /* MAP */
+  .train-speed-label {
+    text-shadow : 0 0 3px #FFFFFF;
+    padding-bottom: 1.5rem
+  }
+
 }

From a8c897408f00313c4a611453fc4e0be77227bdd1 Mon Sep 17 00:00:00 2001
From: alexandredamiron <alexandredamiron@gmail.com>
Date: Thu, 23 Nov 2023 14:37:22 +0100
Subject: [PATCH 2/3] restore time display

---
 .../components/SimulationResultsMap/TrainHoverPosition.tsx  | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/front/src/modules/simulationResult/components/SimulationResultsMap/TrainHoverPosition.tsx b/front/src/modules/simulationResult/components/SimulationResultsMap/TrainHoverPosition.tsx
index f636fee25ba..b5ff1631042 100644
--- a/front/src/modules/simulationResult/components/SimulationResultsMap/TrainHoverPosition.tsx
+++ b/front/src/modules/simulationResult/components/SimulationResultsMap/TrainHoverPosition.tsx
@@ -24,8 +24,9 @@ function getFill(isSelectedTrain: boolean, ecoBlocks: boolean) {
   return '#333';
 }
 
-function getSpeedLabel(isSelectedTrain: boolean, ecoBlocks: boolean, point: TrainPosition) {
+function getSpeedTimeLabel(isSelectedTrain: boolean, ecoBlocks: boolean, point: TrainPosition) {
   if (isSelectedTrain) {
+    console.log(point.speedTime);
     return (
       <>
         <span
@@ -34,6 +35,7 @@ function getSpeedLabel(isSelectedTrain: boolean, ecoBlocks: boolean, point: Trai
           {Math.round(point?.speedTime?.speed ?? 0)}
           km/h
         </span>
+        {point.speedTime && <span className="ml-2 small">{`${point.speedTime.time}`}</span>}
       </>
     );
   }
@@ -204,7 +206,7 @@ function TrainHoverPosition(props: TrainHoverPositionProps) {
   ) {
     const { ecoBlocks } = get(allowancesSettings, train.id, {} as AllowancesSetting);
     const fill = getFill(isSelectedTrain as boolean, ecoBlocks);
-    const label = getSpeedLabel(isSelectedTrain, ecoBlocks, point);
+    const label = getSpeedTimeLabel(isSelectedTrain, ecoBlocks, point);
 
     const zoomLengthFactor = getzoomPowerOf2LengthFactor(viewport);
     const [trainGeoJsonPath, headTriangle, rearTriangle] = getTrainPieces(

From 714ad17363f28cd380a4434b64329ee035bcac91 Mon Sep 17 00:00:00 2001
From: alexandredamiron <alexandredamiron@gmail.com>
Date: Thu, 23 Nov 2023 16:44:25 +0100
Subject: [PATCH 3/3] renable Time

---
 .../SimulationResultsMap/TrainHoverPosition.tsx   | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/front/src/modules/simulationResult/components/SimulationResultsMap/TrainHoverPosition.tsx b/front/src/modules/simulationResult/components/SimulationResultsMap/TrainHoverPosition.tsx
index b5ff1631042..062641d6a04 100644
--- a/front/src/modules/simulationResult/components/SimulationResultsMap/TrainHoverPosition.tsx
+++ b/front/src/modules/simulationResult/components/SimulationResultsMap/TrainHoverPosition.tsx
@@ -15,6 +15,7 @@ import { AllowancesSetting, AllowancesSettings, Train } from 'reducers/osrdsimul
 import { boundedValue } from 'utils/numbers';
 import { getCurrentBearing } from 'utils/geometry';
 import OrderedLayer from 'common/Map/Layers/OrderedLayer';
+import { datetime2time } from 'utils/timeManipulation';
 import { TrainPosition } from './types';
 
 function getFill(isSelectedTrain: boolean, ecoBlocks: boolean) {
@@ -26,16 +27,24 @@ function getFill(isSelectedTrain: boolean, ecoBlocks: boolean) {
 
 function getSpeedTimeLabel(isSelectedTrain: boolean, ecoBlocks: boolean, point: TrainPosition) {
   if (isSelectedTrain) {
-    console.log(point.speedTime);
     return (
       <>
         <span
-          className={cx('small', 'train-speed-label', 'font-weight-bold', ecoBlocks ? 'text-secondary' : 'text-primary')}
+          className={cx(
+            'small',
+            'train-speed-label',
+            'font-weight-bold',
+            ecoBlocks ? 'text-secondary' : 'text-primary'
+          )}
         >
           {Math.round(point?.speedTime?.speed ?? 0)}
           km/h
         </span>
-        {point.speedTime && <span className="ml-2 small">{`${point.speedTime.time}`}</span>}
+        {point.speedTime?.time && (
+          <span className="ml-2 small train-speed-label">{`${datetime2time(
+            point.speedTime.time
+          )}`}</span>
+        )}
       </>
     );
   }