Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

front: select op with map when add train #9790

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open

Conversation

theocrsb
Copy link
Contributor

@theocrsb theocrsb commented Nov 20, 2024

-bold pr on hover (for PRs on same track)
-select pr on map and choose track

depends: #9800 and #10157
closes https://github.com/osrd-project/osrd-confidential/issues/777

@theocrsb theocrsb force-pushed the tce/select-op-on-map branch 2 times, most recently from 5f47a24 to 3de78a8 Compare November 25, 2024 08:02
@github-actions github-actions bot added the area:front Work on Standard OSRD Interface modules label Nov 25, 2024
@codecov-commenter
Copy link

codecov-commenter commented Nov 25, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.50%. Comparing base (41e05a4) to head (549d3a7).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##              dev    #9790       +/-   ##
===========================================
+ Coverage   79.94%   87.50%    +7.56%     
===========================================
  Files        1057       31     -1026     
  Lines      106302     1537   -104765     
  Branches      724        0      -724     
===========================================
- Hits        84982     1345    -83637     
+ Misses      21278      192    -21086     
+ Partials       42        0       -42     
Flag Coverage Δ
editoast ?
front ?
gateway ?
osrdyne ?
railjson_generator 87.50% <ø> (ø)
tests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@theocrsb theocrsb force-pushed the tce/select-op-on-map branch 3 times, most recently from 635d7fa to b1c1b48 Compare November 29, 2024 14:59
@theocrsb theocrsb force-pushed the tce/select-op-on-map branch 8 times, most recently from c0f0025 to 8bdbaf3 Compare December 10, 2024 16:27
@theocrsb theocrsb force-pushed the tce/select-op-on-map branch 3 times, most recently from 1030168 to b4648bb Compare December 17, 2024 09:29
@theocrsb theocrsb force-pushed the tce/select-op-on-map branch 5 times, most recently from f323ca1 to 9a2eea0 Compare December 19, 2024 10:08
@theocrsb theocrsb requested a review from clarani December 19, 2024 10:08
@theocrsb theocrsb marked this pull request as ready for review December 20, 2024 08:02
@theocrsb theocrsb requested a review from a team as a code owner December 20, 2024 08:02
front/src/modules/pathfinding/helpers/getStepLocation.ts Outdated Show resolved Hide resolved
import {
osrdEditoastApi,
type OperationalPoint,
type OperationalPointReference,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OperationalPointReference is not used

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@theocrsb theocrsb force-pushed the tce/select-op-on-map branch from 9a2eea0 to 425029f Compare December 23, 2024 14:02
@@ -144,12 +145,12 @@ const Map = ({

const onFeatureClick = (e: MapLayerMouseEvent) => {
if (preventPointSelection) return;
const result = getMapMouseEventNearestFeature(e, { layersId: ['chartis/tracks-geo/main'] });
const result = getMapMouseEventNearestFeature(e);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you have removed the layers which are clickable, I can select all lines and points (signals, dectectors etc)

@@ -103,6 +103,7 @@ const Map = ({

const [mapIsLoaded, setMapIsLoaded] = useState(false);

const [operationnalPointId, setOperationnalPointId] = useState<string | undefined>(undefined);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • add hovered in the name
  • operational has only 1 n 😉
Suggested change
const [operationnalPointId, setOperationnalPointId] = useState<string | undefined>(undefined);
const [hoveredOperationalPointId, setHoveredOperationalPointId] = useState<string | undefined>(undefined);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

if (isOperationalPoint) {
const trackId = featureInfoClick.feature.properties?.track_id;

const clickedTrack = await getTrackEntity({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove getTrackEntity by getInfraObjectEntity since you use it to fetch operational points and track sections ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

body: [trackId],
}).unwrap();

const { parts } = result[0].railjson as OperationalPoint;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can reuse this const l115 and 116 (we should avoid anys ;) )

Suggested change
const { parts } = result[0].railjson as OperationalPoint;
const operationalPoint = result[0].railjson as OperationalPoint;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, it's done

tracks: trackPartCoordinates,
});
} else {
setClickedOp(undefined);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be nice to reset clickedOp and offset before calling calculateOffset in the hook.

Can you rename the function by the way ?

-bold pr on hover (for PRs on same track)
-select pr on map and choose track

Signed-off-by: theocrsb <[email protected]>
@theocrsb theocrsb force-pushed the tce/select-op-on-map branch from 48a5197 to 192380d Compare December 24, 2024 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:front Work on Standard OSRD Interface modules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants