@@ -50,9 +50,15 @@ function LegendComfortSwitches(props: {
50
50
} ) {
51
51
const { curvesComfortList, comfortsStates, onComfortsStatesChange } = props ;
52
52
53
- return curvesComfortList . length > 1 ? (
53
+ // TODO: remove this condition when getRollingStock endpoint returns comfort
54
+ // with type Comfort instead of RollingStockComfortType */
55
+ const curvesComfortListV2 = curvesComfortList . map ( ( comfort ) =>
56
+ comfort === 'AC' ? 'AIR_CONDITIONING' : comfort
57
+ ) ;
58
+
59
+ return curvesComfortListV2 . length > 1 ? (
54
60
< span className = "d-flex" >
55
- { curvesComfortList . map ( ( comfort ) => (
61
+ { curvesComfortListV2 . map ( ( comfort ) => (
56
62
< span
57
63
className = { cx ( 'curves-chart-legend-comfort-button' , {
58
64
active : comfortsStates [ comfort ] ,
@@ -68,7 +74,7 @@ function LegendComfortSwitches(props: {
68
74
</ span >
69
75
) : (
70
76
< span className = "curves-chart-legend-comfort-button active" >
71
- { comfort2pictogram ( curvesComfortList [ 0 ] ) }
77
+ { comfort2pictogram ( curvesComfortListV2 [ 0 ] ) }
72
78
</ span >
73
79
) ;
74
80
}
@@ -102,9 +108,11 @@ function Legend(props: {
102
108
{ isOnEditionMode && showPowerRestriction && curve . power_restriction }
103
109
{ isOnEditionMode && ! showPowerRestriction && curve . electrical_profile_level }
104
110
{ ! isOnEditionMode && ! showPowerRestriction && curve . mode }
111
+ { /* TODO: remove this condition when getRollingStock endpoint returns comfort
112
+ with type Comfort instead of RollingStockComfortType */ }
105
113
{ curve . comfort !== STANDARD_COMFORT_LEVEL &&
106
114
! isOnEditionMode &&
107
- comfort2pictogram ( curve . comfort ) }
115
+ comfort2pictogram ( curve . comfort === 'AC' ? 'AIR_CONDITIONING' : curve . comfort ) }
108
116
</ span >
109
117
) ) }
110
118
</ span >
@@ -216,13 +224,14 @@ export default function RollingStockCurve({
216
224
const [ curvesVisibility , setCurvesVisibility ] = useState ( setupCurvesVisibility ( transformedData ) ) ;
217
225
218
226
const formatTooltip = ( tooltip : PointTooltipProps ) => {
227
+ const transformedCurve = transformedData [ tooltip . point . serieId ] ;
219
228
const editionModeTooltipLabel =
220
229
isOnEditionMode && showPowerRestriction
221
- ? geti18nKeyForNull ( transformedData [ tooltip . point . serieId ] ?. powerRestriction )
222
- : geti18nKeyForNull ( transformedData [ tooltip . point . serieId ] ?. electricalProfile ) ;
230
+ ? geti18nKeyForNull ( transformedCurve ?. powerRestriction )
231
+ : geti18nKeyForNull ( transformedCurve ?. electricalProfile ) ;
223
232
return (
224
233
< div className = "curves-chart-tooltip" style = { { borderColor : tooltip . point . color } } >
225
- { transformedData [ tooltip . point . serieId ] && (
234
+ { transformedCurve && (
226
235
< div
227
236
className = "curves-chart-tooltip-head"
228
237
style = { {
@@ -231,13 +240,15 @@ export default function RollingStockCurve({
231
240
borderColor : tooltip . point . color ,
232
241
} }
233
242
>
234
- { isOnEditionMode
235
- ? editionModeTooltipLabel
236
- : transformedData [ tooltip . point . serieId ] . mode }
243
+ { isOnEditionMode ? editionModeTooltipLabel : transformedCurve . mode }
237
244
< span className = "ml-1" />
238
- { transformedData [ tooltip . point . serieId ] . comfort !== STANDARD_COMFORT_LEVEL && (
245
+ { transformedCurve . comfort !== STANDARD_COMFORT_LEVEL && (
239
246
< span className = "curves-chart-tooltip-comfort" >
240
- { comfort2pictogram ( transformedData [ tooltip . point . serieId ] . comfort ) }
247
+ { /* TODO: remove this condition when getRollingStock endpoint returns comfort
248
+ with type Comfort instead of RollingStockComfortType */ }
249
+ { comfort2pictogram (
250
+ transformedCurve . comfort === 'AC' ? 'AIR_CONDITIONING' : transformedCurve . comfort
251
+ ) }
241
252
</ span >
242
253
) }
243
254
</ div >
0 commit comments