diff --git a/front/public/locales/en/timesStops.json b/front/public/locales/en/timesStops.json
index 92bfd94c122..ed418517576 100644
--- a/front/public/locales/en/timesStops.json
+++ b/front/public/locales/en/timesStops.json
@@ -5,5 +5,6 @@
"receptionOnClosedSignal": "Reception on Closed Signal",
"theoreticalMargin": "Theoretical Margin",
"theoreticalMarginPlaceholder": "% or min/100km",
- "waypoint": "Waypoint {{id}}"
+ "waypoint": "Waypoint {{id}}",
+ "noPathLoaded": "No path loaded"
}
diff --git a/front/public/locales/fr/timesStops.json b/front/public/locales/fr/timesStops.json
index 6117f215950..a9355945e52 100644
--- a/front/public/locales/fr/timesStops.json
+++ b/front/public/locales/fr/timesStops.json
@@ -5,5 +5,6 @@
"receptionOnClosedSignal": "Réception sur signal fermé",
"theoreticalMargin": "Marge théorique",
"theoreticalMarginPlaceholder": "% ou min/100km",
- "waypoint": "Via {{id}}"
+ "waypoint": "Via {{id}}",
+ "noPathLoaded": "Aucun chemin chargé"
}
diff --git a/front/src/applications/operationalStudies/views/v2/ManageTrainScheduleV2.tsx b/front/src/applications/operationalStudies/views/v2/ManageTrainScheduleV2.tsx
index 4fc0fed386f..2e40fa0598f 100644
--- a/front/src/applications/operationalStudies/views/v2/ManageTrainScheduleV2.tsx
+++ b/front/src/applications/operationalStudies/views/v2/ManageTrainScheduleV2.tsx
@@ -122,7 +122,7 @@ const ManageTrainScheduleV2 = () => {
),
label: t('tabs.timesStops'),
- content: pathProperties && ,
+ content: ,
};
const tabSimulationSettings = {
diff --git a/front/src/modules/timesStops/TimeColumnComponent.tsx b/front/src/modules/timesStops/TimeColumnComponent.tsx
index 85f23bc1850..332674cc4bf 100644
--- a/front/src/modules/timesStops/TimeColumnComponent.tsx
+++ b/front/src/modules/timesStops/TimeColumnComponent.tsx
@@ -1,37 +1,44 @@
-import React, { useLayoutEffect, useRef } from 'react';
+import React, { useEffect, useRef, useState } from 'react';
-import cx from 'classnames';
import type { CellComponent, CellProps, Column } from 'react-datasheet-grid/dist/types';
const TimeComponent = ({
focus,
rowData,
+ active,
setRowData,
}: CellProps) => {
const ref = useRef(null);
+ const [tempTimeValue, setTempTimeValue] = useState(rowData);
- useLayoutEffect(() => {
- if (focus) {
+ useEffect(() => {
+ if (active) {
ref.current?.select();
} else {
ref.current?.blur();
}
- }, [focus]);
+ }, [active]);
return (
{
- const time = e.target.value;
- setRowData(time);
+ setTempTimeValue(e.target.value);
+ }}
+ onBlur={() => {
+ // To prevent the operational point to be transformed into a via if we leave the cell empty after focusing it
+ if (rowData !== tempTimeValue) {
+ setRowData(tempTimeValue);
+ }
}}
/>
);
diff --git a/front/src/modules/timesStops/TimesStops.tsx b/front/src/modules/timesStops/TimesStops.tsx
index b53bd6d8c49..9df16b6dec8 100644
--- a/front/src/modules/timesStops/TimesStops.tsx
+++ b/front/src/modules/timesStops/TimesStops.tsx
@@ -22,7 +22,7 @@ import { removeElementAtIndex } from 'utils/array';
import timeColumn from './TimeColumnComponent';
type TimesStopsProps = {
- pathProperties: ManageTrainSchedulePathProperties;
+ pathProperties: ManageTrainSchedulePathProperties | undefined;
pathSteps?: (PathStep | null)[];
};
@@ -63,6 +63,15 @@ const createDeleteViaButton = ({
const TimesStops = ({ pathProperties, pathSteps = [] }: TimesStopsProps) => {
const { t } = useTranslation('timesStops');
+
+ if (!pathProperties) {
+ return (
+
+ );
+ }
+
const dispatch = useAppDispatch();
const { upsertViaFromSuggestedOP, updatePathSteps } = useOsrdConfActions();
@@ -103,6 +112,10 @@ const TimesStops = ({ pathProperties, pathSteps = [] }: TimesStopsProps) => {
})
),
title: `${t('stopTime')}`,
+
+ // We should not be able to edit the stopping time of the origin and destination
+ disabled: ({ rowIndex }) =>
+ rowIndex === 0 || rowIndex === pathProperties.allVias?.length - 1,
grow: 0.6,
},
{
@@ -111,6 +124,8 @@ const TimesStops = ({ pathProperties, pathSteps = [] }: TimesStopsProps) => {
checkboxColumn as Partial>
),
title: t('receptionOnClosedSignal'),
+
+ // We should not be able to edit the reception on close signal of the origin
grow: 0.6,
disabled: ({ rowData }) => !rowData.stopFor,
},