-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
front: select op with map when add train
-bold pr on hover (for PRs on same track) -select pr on map and choose track Signed-off-by: theocrsb <[email protected]>
- Loading branch information
Showing
9 changed files
with
229 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,35 @@ | ||
import type { PathItemLocation } from 'common/api/osrdEditoastApi'; | ||
import type { OperationalPointReference, PathItemLocation } from 'common/api/osrdEditoastApi'; | ||
import { mToMm } from 'utils/physics'; | ||
|
||
const getStepLocation = (step: PathItemLocation): PathItemLocation => { | ||
const trackReference: OperationalPointReference['track_reference'] = | ||
!('track' in step) && step.track_reference && 'track_name' in step.track_reference | ||
? { track_name: step.track_reference.track_name } | ||
: null; | ||
|
||
if ('track' in step) { | ||
// TODO: step offset should be in mm in the store /!\ | ||
// pathfinding blocks endpoint requires offsets in mm | ||
return { track: step.track, offset: mToMm(step.offset) }; | ||
} | ||
if ('operational_point' in step) { | ||
return { operational_point: step.operational_point }; | ||
return { operational_point: step.operational_point, track_reference: trackReference }; | ||
} | ||
if ('trigram' in step) { | ||
return { trigram: step.trigram, secondary_code: step.secondary_code }; | ||
return { | ||
trigram: step.trigram, | ||
secondary_code: step.secondary_code, | ||
track_reference: trackReference, | ||
}; | ||
} | ||
if (step.uic === -1) { | ||
throw new Error('Invalid UIC'); | ||
} | ||
return { uic: step.uic, secondary_code: step.secondary_code }; | ||
return { | ||
uic: step.uic, | ||
secondary_code: step.secondary_code, | ||
track_reference: trackReference, | ||
}; | ||
}; | ||
|
||
export default getStepLocation; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.