Skip to content

Commit 0753884

Browse files
committed
front: update style in timestop tables
Signed-off-by: Alice Khoudli <[email protected]>
1 parent 7d976b9 commit 0753884

File tree

11 files changed

+96
-187
lines changed

11 files changed

+96
-187
lines changed

front/public/locales/en/simulation.json

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
"stopStopTime": "Stop",
6868
"stopTime": "Arrival",
6969
"timetable": "Timetable",
70+
"timetableOutput": "Timetable Output",
7071
"toggleElectricalProfileLegend": "Toggle electrical profiles legend",
7172
"toggleManchetteMenu": "Toggle manchette menu",
7273
"toggleRewind": "Toggle simulation rewind",
+11-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
{
22
"arrivalTime": "requested arrival time",
33
"calculatedArrivalTime": "calculated arrival time",
4-
"calculatedDepartureTime": "calculated departure time",
4+
"calculatedDepartureTime": "calculated depart. time",
5+
"calculatedDepartureTimeFull": "calculated departure time",
56
"dayCounter": "D+{{count}}",
6-
"departureTime": "requested departure time",
7-
"diffMargins": "margins diff. (s)",
7+
"departureTime": "requested depart. time",
8+
"departureTimeFull": "requested depart. time",
9+
"diffMargins": "margins diff. (s)",
10+
"diffMarginsFull": "margins difference (s)",
811
"name": "CI",
912
"ch": "ch",
1013
"noPathLoaded": "No path loaded",
11-
"realMargin": "real margin (s)",
12-
"receptionOnClosedSignal": "reception on closed signal",
13-
"shortSlipDistance": "Short Slip Distance",
14+
"realMargin": "real margin (s)",
15+
"receptionOnClosedSignal": "r. closed signal",
16+
"receptionOnClosedSignalFull": "reception on closed signal",
17+
"shortSlipDistance": "short slip distance",
1418
"stopTime": "stopping time (s)",
1519
"theoreticalMargin": "theoretical margin",
1620
"theoreticalMarginPlaceholder": "% or min/100km",
17-
"theoreticalMarginSeconds": "linear theoretical margin (s)",
21+
"theoreticalMarginSeconds": "theoretical margin (s)",
1822
"waypoint": "Waypoint {{id}}"
1923
}

front/public/locales/fr/simulation.json

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
"stopStopTime": "Arrêt",
6868
"stopTime": "Arrivée",
6969
"timetable": "Table horaire",
70+
"timetableOutput": "Table horaire de sortie",
7071
"toggleElectricalProfileLegend": "Basculer l'affichage de la légende des tractions électriques",
7172
"toggleManchetteMenu": "Basculer l'affichage du menu de la manchette",
7273
"toggleRewind": "Basculer le rembobinage de la simulation",

front/public/locales/fr/timesStops.json

+9-5
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,22 @@
22
"arrivalTime": "arrivée demandée",
33
"calculatedArrivalTime": "arrivée calculée",
44
"calculatedDepartureTime": "départ calculé",
5+
"calculatedDepartureTimeFull": "départ calculé",
56
"dayCounter": "J+{{count}}",
67
"departureTime": "départ demandé",
7-
"diffMargins": "diff. marges (s)",
8+
"departureTimeFull": "départ demandé",
9+
"diffMargins": "diff. marges (s)",
10+
"diffMarginsFull": "différence entre les marges (s)",
811
"name": "CI",
912
"ch": "ch",
1013
"noPathLoaded": "Aucun chemin chargé",
11-
"shortSlipDistance": "Faible glissement",
12-
"realMargin": "marge réelle (s)",
13-
"receptionOnClosedSignal": "réception sur signal fermé",
14+
"realMargin": "marge réelle (s)",
15+
"receptionOnClosedSignal": "r. s. signal fermé",
16+
"receptionOnClosedSignalFull": "reception sur signal fermé",
17+
"shortSlipDistance": "faible glissement",
1418
"stopTime": "temps d'arrêt (s)",
1519
"theoreticalMargin": "marge théorique",
1620
"theoreticalMarginPlaceholder": "% ou min/100km",
17-
"theoreticalMarginSeconds": "marge théorique linéaire (s)",
21+
"theoreticalMarginSeconds": "marge théorique (s)",
1822
"waypoint": "Via {{id}}"
1923
}

front/src/applications/operationalStudies/views/SimulationResults.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ const SimulationResults = ({
198198
operationalPoints &&
199199
infraId && (
200200
<div className="osrd-simulation-container mb-2">
201+
<p className="mt-2 mb-3 ml-3 font-weight-bold">{t('timetableOutput')}</p>
201202
<TimesStopsOutput
202203
simulatedTrain={trainSimulation}
203204
pathProperties={pathProperties}

front/src/modules/timesStops/TimesStops.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ const TimesStops = <T extends TimeStopsRow>({
4949
lockRows
5050
height={600}
5151
headerRowHeight={headerRowHeight}
52-
rowClassName={({ rowData }) =>
52+
rowClassName={({ rowData, rowIndex }) =>
5353
cx({
5454
activeRow: rowData.isWaypoint,
55+
oddRow: (rowIndex + 1) % 2,
5556
})
5657
}
5758
cellClassName={cellClassName}

front/src/modules/timesStops/TimesStopsOutput.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const TimesStopsOutput = ({
5959
'warning-margin': negativeDiffMargins,
6060
});
6161
}}
62-
headerRowHeight={65}
62+
headerRowHeight={40}
6363
/>
6464
);
6565
};
Original file line numberDiff line numberDiff line change
@@ -1,155 +0,0 @@
1-
import { useMemo } from 'react';
2-
3-
import cx from 'classnames';
4-
import { keyColumn, type Column, checkboxColumn, createTextColumn } from 'react-datasheet-grid';
5-
import type { CellComponent } from 'react-datasheet-grid/dist/types';
6-
import { useTranslation } from 'react-i18next';
7-
8-
import { marginRegExValidation } from '../consts';
9-
import { disabledTextColumn } from '../helpers/utils';
10-
import ReadOnlyTime from '../ReadOnlyTime';
11-
import TimeInput from '../TimeInput';
12-
import { TableType, type TimeExtraDays, type TimeStopsRow } from '../types';
13-
14-
const timeColumn = (isOutputTable: boolean) =>
15-
({
16-
component: (isOutputTable ? ReadOnlyTime : TimeInput) as CellComponent<
17-
TimeExtraDays | undefined,
18-
string
19-
>,
20-
deleteValue: () => undefined,
21-
copyValue: ({ rowData }) => rowData?.time ?? null,
22-
pasteValue: ({ value }) => ({ time: value }),
23-
minWidth: isOutputTable ? 110 : 170,
24-
isCellEmpty: ({ rowData }) => !rowData,
25-
}) as Partial<Column<TimeExtraDays | undefined, string, string>>;
26-
27-
const fixedWidth = (width: number) => ({ minWidth: width, maxWidth: width });
28-
29-
export const useTimeStopsColumns = <T extends TimeStopsRow>(
30-
tableType: TableType,
31-
allWaypoints: T[] = []
32-
) => {
33-
const { t } = useTranslation('timesStops');
34-
35-
const columns = useMemo<Column<T>[]>(() => {
36-
const isOutputTable = tableType === TableType.Output;
37-
const extraOutputColumns = (
38-
isOutputTable
39-
? [
40-
{
41-
...disabledTextColumn('theoreticalMarginSeconds', t('theoreticalMarginSeconds'), {
42-
alignRight: true,
43-
}),
44-
...fixedWidth(110),
45-
},
46-
{
47-
...disabledTextColumn('calculatedMargin', t('realMargin'), {
48-
alignRight: true,
49-
}),
50-
...fixedWidth(120),
51-
},
52-
{
53-
...disabledTextColumn('diffMargins', t('diffMargins'), { alignRight: true }),
54-
...fixedWidth(120),
55-
},
56-
{
57-
...disabledTextColumn('calculatedArrival', t('calculatedArrivalTime')),
58-
...fixedWidth(95),
59-
},
60-
{
61-
...disabledTextColumn('calculatedDeparture', t('calculatedDepartureTime')),
62-
...fixedWidth(97),
63-
},
64-
]
65-
: []
66-
) as Column<T>[];
67-
68-
return [
69-
{
70-
...keyColumn('name', createTextColumn()),
71-
title: t('name'),
72-
disabled: true,
73-
minWidth: isOutputTable ? 180 : 300,
74-
},
75-
{
76-
...keyColumn('ch', createTextColumn()),
77-
title: t('ch'),
78-
disabled: true,
79-
maxWidth: 45,
80-
},
81-
{
82-
...keyColumn('arrival', timeColumn(isOutputTable)),
83-
alignRight: true,
84-
title: t('arrivalTime'),
85-
86-
// We should not be able to edit the arrival time of the origin
87-
disabled: ({ rowIndex }) => isOutputTable || rowIndex === 0,
88-
},
89-
{
90-
...keyColumn('departure', timeColumn(isOutputTable)),
91-
title: t('departureTime'),
92-
93-
// We should not be able to edit the departure time of the origin
94-
disabled: ({ rowIndex }) => isOutputTable || rowIndex === 0,
95-
},
96-
{
97-
...keyColumn(
98-
'stopFor',
99-
createTextColumn({
100-
continuousUpdates: false,
101-
alignRight: true,
102-
})
103-
),
104-
title: t('stopTime'),
105-
disabled: isOutputTable,
106-
maxWidth: isOutputTable ? 90 : undefined,
107-
grow: 0.6,
108-
},
109-
{
110-
...keyColumn('onStopSignal', checkboxColumn as Partial<Column<boolean | undefined>>),
111-
title: t('receptionOnClosedSignal'),
112-
113-
// We should not be able to edit the reception on close signal if stopFor is not filled
114-
// except for the destination
115-
...fixedWidth(94),
116-
disabled: ({ rowData, rowIndex }) =>
117-
isOutputTable || (rowIndex !== allWaypoints.length - 1 && !rowData.stopFor),
118-
},
119-
{
120-
...keyColumn('shortSlipDistance', checkboxColumn as Partial<Column<boolean | undefined>>),
121-
title: t('shortSlipDistance'),
122-
...fixedWidth(94),
123-
disabled: ({ rowData, rowIndex }) =>
124-
isOutputTable || (rowIndex !== allWaypoints.length - 1 && !rowData.onStopSignal),
125-
},
126-
{
127-
...keyColumn(
128-
'theoreticalMargin',
129-
createTextColumn({
130-
continuousUpdates: false,
131-
alignRight: true,
132-
placeholder: !isOutputTable ? t('theoreticalMarginPlaceholder') : '',
133-
formatBlurredInput: (value) => {
134-
if (!value || value === '0%') return '';
135-
if (!isOutputTable && !marginRegExValidation.test(value)) {
136-
return `${value}${t('theoreticalMarginPlaceholder')}`;
137-
}
138-
return value;
139-
},
140-
})
141-
),
142-
cellClassName: ({ rowData }) =>
143-
cx({ invalidCell: !isOutputTable && !rowData.isMarginValid }),
144-
title: t('theoreticalMargin'),
145-
disabled: ({ rowIndex }) => isOutputTable || rowIndex === allWaypoints.length - 1,
146-
...fixedWidth(110),
147-
},
148-
...extraOutputColumns,
149-
] as Column<T>[];
150-
}, [tableType, t, allWaypoints.length]);
151-
152-
return columns;
153-
};
154-
155-
export default timeColumn;
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
.read-only-time {
22
// using px to conform with the padding in the react-datasheet-grid library class .dsg-input
33
padding: 0 10px;
4+
text-align: right;
5+
width: 100%;
46
}
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,85 @@
11
.time-stops-datasheet {
2-
.activeRow {
3-
font-weight: bold;
4-
background-color: var(--coolgray1);
5-
--dsg-cell-background-color: var(--coolgray1);
6-
--dsg-cell-disabled-background-color: var(--coolgray1);
7-
.dsg-cell {
8-
font-weight: bold;
2+
padding-bottom: 16px;
3+
border-radius: 10px;
4+
max-width: 1407px;
5+
box-shadow:
6+
0px 1px 0px rgba(255, 255, 255, 1) inset,
7+
0px 4px 7px -3px rgba(255, 171, 88, 0.17),
8+
0px 2px 4px rgba(0, 0, 0, 0.22);
9+
background-color: var(--ambiantB15);
10+
--dsg-cell-background-color: var(--white100);
11+
--dsg-cell-disabled-background-color: var(--white100);
12+
--dsg-header-text-color: var(--grey50);
13+
--dsg-header-active-text-color: var(--black100);
14+
15+
.dsg-row {
16+
&.activeRow {
17+
font-weight: 600;
18+
color: var(--black100);
19+
.dsg-cell-gutter,
20+
.secondary-code-column {
21+
font-weight: normal;
22+
}
23+
}
24+
25+
&.oddRow {
26+
--dsg-cell-background-color: var(--ambiantB5);
27+
--dsg-cell-disabled-background-color: var(--ambiantB5);
928
}
1029
}
1130

31+
.padded-header > * {
32+
padding-inline: 8px 16px;
33+
}
34+
35+
.secondary-code-column {
36+
color: var(--grey50);
37+
}
38+
1239
.invalidCell {
1340
color: red !important;
1441
}
1542

43+
.warning-schedule {
44+
background: var(--warning30);
45+
}
46+
47+
.warning-margin {
48+
background: rgba(var(--warning30-rgb), 0.5);
49+
}
50+
51+
.dsg-cell {
52+
font-size: 0.875rem;
53+
border-top: none !important;
54+
border-bottom: none !important;
55+
}
56+
57+
.dsg-cell.dsg-cell-header {
58+
font-size: 0.75rem;
59+
}
60+
61+
.dsg-cell-gutter {
62+
--dsg-header-text-color: var(--grey30);
63+
}
64+
1665
.dsg-cell-sticky-right {
1766
button {
1867
margin: auto;
1968
}
2069
}
2170

22-
.warning-schedule {
23-
// warning-30
24-
background: #eaa72b !important;
71+
.dsg-container {
72+
border-top-left-radius: 10px;
73+
border-top-right-radius: 10px;
74+
border: none;
75+
color: var(--grey80);
2576
}
2677

27-
.warning-margin {
28-
// warning-30
29-
background: rgba(#eaa72b, 0.3) !important;
78+
.dsg-corner-indicator {
79+
visibility: hidden;
80+
}
81+
82+
.dsg-input {
83+
font-size: 14px;
3084
}
3185
}

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

+1-5
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,9 @@
3939

4040
.osrd-simulation-container {
4141
position: relative;
42-
background-color: white;
42+
background-color: var(--ambientB10);
4343
padding: 1rem;
4444
border-radius: 4px;
45-
46-
&.speedspacechart-container {
47-
background-color: rgb(247, 246, 238);
48-
}
4945
}
5046

5147
/* MAP */

0 commit comments

Comments
 (0)