Skip to content

Commit

Permalink
front: drop TimesStopsRow.isWaypoint
Browse files Browse the repository at this point in the history
Now we have an unambiguous way to figure out whether a row is a
waypoint explicitly selected by the user: if it has a path step ID,
then it's a waypoint.

Check the path step ID instead of having to keep a separate field
synced up.

Signed-off-by: Simon Ser <[email protected]>
  • Loading branch information
emersion committed Dec 23, 2024
1 parent ada2dae commit 9268bf9
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion front/src/modules/timesStops/TimesStops.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const TimesStops = <T extends TimesStopsRow>({
headerRowHeight={headerRowHeight}
rowClassName={({ rowData, rowIndex }) =>
cx({
activeRow: rowData.isWaypoint,
activeRow: Boolean(rowData.pathStepId),
oddRow: (rowIndex + 1) % 2,
})
}
Expand Down
3 changes: 1 addition & 2 deletions front/src/modules/timesStops/helpers/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const matchPathStepAndOpWithKP = (step: PathStep, op: SuggestedOP) => {
};

export const formatSuggestedViasToRowVias = (
operationalPoints: (SuggestedOP & { isWaypoint?: boolean })[],
operationalPoints: SuggestedOP[],
pathSteps: PathStep[],
t: TFunction<'timesStops', undefined>,
startTime?: Date,
Expand Down Expand Up @@ -103,7 +103,6 @@ export const formatSuggestedViasToRowVias = (
shortSlipDistance,
stopFor,
theoreticalMargin,
isWaypoint: op.isWaypoint || pathStep !== undefined,
};
});
};
Expand Down
2 changes: 0 additions & 2 deletions front/src/modules/timesStops/hooks/useOutputTableData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ const useOutputTableData = (
pathStepId: pathStep.id,
name: t('waypoint', { id: pathStep.id }),
ch: undefined,
isWaypoint: true,

arrival,
departure,
Expand Down Expand Up @@ -144,7 +143,6 @@ const useOutputTableData = (
const calculatedArrival = new Date(startDatetime.getTime() + time);

return {
isWaypoint: false,
opId: op.id,
name: op.extensions?.identifier?.name,
ch: op.extensions?.sncf?.ch,
Expand Down
1 change: 0 additions & 1 deletion front/src/modules/timesStops/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export type TimesStopsRow = {
name?: string;
ch?: string;
trackName?: string;
isWaypoint: boolean;

arrival?: TimeExtraDays; // value asked by user
departure?: TimeExtraDays; // value asked by user
Expand Down

0 comments on commit 9268bf9

Please sign in to comment.