Skip to content

Commit 9f103ab

Browse files
nicolaswurtzalexandredamiron
authored andcommitted
front: rollingstock: adapt curves new speeds values in m/s to km/h
1 parent 6593071 commit 9f103ab

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

front/src/applications/osrd/components/RollingStock/RollingStock.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { useState, useEffect } from 'react';
22
import PropTypes from 'prop-types';
33
import Loader from 'common/Loader';
4+
import nextId from 'react-id-generator';
45
import { useSelector, useDispatch } from 'react-redux';
56
import { setFailure } from 'reducers/main';
67
import { get } from 'common/requests';
@@ -112,7 +113,7 @@ export default function RollingStock(props) {
112113
filteredRollingStockList.map((item) => (
113114
<RollingStockCard
114115
data={item}
115-
key={item.id}
116+
key={nextId()}
116117
openedRollingStockCardId={openedRollingStockCardId}
117118
setOpenedRollingStockCardId={setOpenedRollingStockCardId}
118119
ref2scroll={rollingStockID === item.id ? ref2scroll : undefined}

front/src/applications/osrd/components/RollingStock/RollingStock.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@
277277
display: flex;
278278
align-items: flex-end;
279279
justify-content: space-between;
280-
margin-left: 2.5rem;
280+
margin-left: 2.75rem;
281281
.curves-chart-legend-comfort-button {
282282
display: flex;
283283
align-items: center;

front/src/applications/osrd/components/RollingStock/RollingStockCurves.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import React, { useEffect, useState } from 'react';
12
import { ResponsiveLine } from '@nivo/line';
23
import PropTypes from 'prop-types';
3-
import { useEffect, useState } from 'react';
44
import { COLORS } from './consts/consts';
55
import { comfort2pictogram } from './RollingStockHelpers';
66

@@ -11,7 +11,7 @@ const parseData = (label, color, curve) => {
1111
// const curveFormatted = curve.map((item)
1212
// => ({ x: item.speed * 3.6, y: item.max_effort / 1000 }));
1313
const curveFormatted = curve.speeds.map((speed, index) => ({
14-
x: speed,
14+
x: speed * 3.6,
1515
y: curve.max_efforts[index] / 1000,
1616
}));
1717

@@ -160,7 +160,7 @@ export default function RollingStockCurve(props) {
160160
top: 5,
161161
right: 10,
162162
bottom: 50,
163-
left: 40,
163+
left: 45,
164164
}}
165165
xScale={{
166166
type: 'linear',
@@ -190,7 +190,7 @@ export default function RollingStockCurve(props) {
190190
tickPadding: 5,
191191
tickRotation: 0,
192192
legend: 'kN',
193-
legendOffset: -30,
193+
legendOffset: -40,
194194
legendPosition: 'middle',
195195
}}
196196
colors={{ datum: 'color' }}

0 commit comments

Comments
 (0)