From 53ed0cfcb3a155f9d1e634303824ae57beea08c3 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 3 Jan 2025 09:45:30 +0100 Subject: [PATCH] front: rename allWaypoints to pathStepsAndSuggestedOPs This list doesn't only contain waypoints, it also contains all suggested OPs. Signed-off-by: Simon Ser --- .../hooks/useManageTrainScheduleContext.tsx | 8 +++--- .../views/ManageTrainSchedule.tsx | 5 ++-- .../components/Itinerary/Itinerary.tsx | 6 ++--- .../modules/timesStops/TimesStopsInput.tsx | 26 +++++++++++-------- 4 files changed, 25 insertions(+), 20 deletions(-) diff --git a/front/src/applications/operationalStudies/hooks/useManageTrainScheduleContext.tsx b/front/src/applications/operationalStudies/hooks/useManageTrainScheduleContext.tsx index 3a98b3694a2..b60b829c096 100644 --- a/front/src/applications/operationalStudies/hooks/useManageTrainScheduleContext.tsx +++ b/front/src/applications/operationalStudies/hooks/useManageTrainScheduleContext.tsx @@ -23,7 +23,7 @@ type ManageTrainScheduleContextType = { pathfindingState: PathfindingState; infraInfo: { infra?: InfraWithState; reloadCount: number }; /** Operational points along the path (including origin and destination) and vias added by clicking on map */ - allWaypoints?: SuggestedOP[]; + pathStepsAndSuggestedOPs?: SuggestedOP[]; } | null; const ManageTrainScheduleContext = createContext(null); @@ -45,7 +45,7 @@ export const ManageTrainScheduleContextProvider = ({ [pathProperties] ); - const allWaypoints = useMemo(() => { + const pathStepsAndSuggestedOPs = useMemo(() => { if (!pathProperties) return undefined; return upsertPathStepsInOPs(pathProperties.suggestedOperationalPoints, compact(pathSteps)); }, [pathProperties?.suggestedOperationalPoints, pathSteps]); @@ -58,7 +58,7 @@ export const ManageTrainScheduleContextProvider = ({ launchPathfinding, pathfindingState, infraInfo, - allWaypoints, + pathStepsAndSuggestedOPs, }), [ pathProperties, @@ -67,7 +67,7 @@ export const ManageTrainScheduleContextProvider = ({ launchPathfinding, pathfindingState, infraInfo, - allWaypoints, + pathStepsAndSuggestedOPs, ] ); diff --git a/front/src/applications/operationalStudies/views/ManageTrainSchedule.tsx b/front/src/applications/operationalStudies/views/ManageTrainSchedule.tsx index 1b15efe441c..3fb160ddebb 100644 --- a/front/src/applications/operationalStudies/views/ManageTrainSchedule.tsx +++ b/front/src/applications/operationalStudies/views/ManageTrainSchedule.tsx @@ -35,7 +35,8 @@ type ManageTrainScheduleProps = { const ManageTrainSchedule = ({ trainIdToEdit }: ManageTrainScheduleProps) => { const { t } = useTranslation(['operationalStudies/manageTrainSchedule']); - const { pathProperties, voltageRanges, allWaypoints } = useManageTrainScheduleContext(); + const { pathProperties, voltageRanges, pathStepsAndSuggestedOPs } = + useManageTrainScheduleContext(); const { getOrigin, getDestination, getPathSteps } = useOsrdConfSelectors(); const origin = useSelector(getOrigin); @@ -120,7 +121,7 @@ const ManageTrainSchedule = ({ trainIdToEdit }: ManageTrainScheduleProps) => { // If pathProperties is defined we know that pathSteps won't have any null values content: ( diff --git a/front/src/modules/pathfinding/components/Itinerary/Itinerary.tsx b/front/src/modules/pathfinding/components/Itinerary/Itinerary.tsx index 676a643b476..152cd7ba8bd 100644 --- a/front/src/modules/pathfinding/components/Itinerary/Itinerary.tsx +++ b/front/src/modules/pathfinding/components/Itinerary/Itinerary.tsx @@ -38,7 +38,7 @@ const Itinerary = () => { const { t } = useTranslation('operationalStudies/manageTrainSchedule'); const { openModal } = useModal(); - const { pathProperties, setPathProperties, launchPathfinding, allWaypoints } = + const { pathProperties, setPathProperties, launchPathfinding, pathStepsAndSuggestedOPs } = useManageTrainScheduleContext(); const zoomToFeaturePoint = (lngLat?: Position) => { @@ -119,7 +119,7 @@ const Itinerary = () => { > - {allWaypoints && ( + {pathStepsAndSuggestedOPs && (