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

WFNEWS-2419 route back to map page from full details #2167

Merged
merged 8 commits into from
Dec 19, 2024

Conversation

ssylver93
Copy link
Collaborator

@ssylver93 ssylver93 commented Dec 19, 2024

Add coordinates and zoom level to query params when routing to the full details page in order to return the user to where they were just at on the map.
Also updating desktop version to route back to previous zoom level on the map for bans, evacs, area restrictions, rather than use a hardcoded value.
Includes some formatting updates applied automatically in VSCode.

Copy link
Collaborator

@agordon-vivid agordon-vivid left a comment

Choose a reason for hiding this comment

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

Some of this logic seems a bit contrived. Can we simplify or clarify it a bit better?

Comment on lines 51 to 56
if (this.params?.['source']) {
// use query params to determine the layer, coordinates and zoom level for routing back to the map
if ((this.params['source'] === 'map' || this.params['source']?.[0] === 'map')
&& (this.params?.['type'] === 'area-restriction' || this.params?.['type'] === 'bans-prohibitions'
|| this.params?.['type'].includes('evac'))
) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

How would we summarize this logic into plain english?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If the user accessed the full details page from the map, and if the full details page contains one of area restrictions, fire bans, evac orders or evac alerts, use the backToMap function to route back to the map using the same layer and zoom level along with the appropriate coordinates for that type.
I updated the comments in the code with this explanation

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Logic updated to make it more readable

if ((this.params?.['source'] === 'map' || this.params?.['source']?.[0] === 'map')
&& (this.params?.['type'] === 'area-restriction' || this.params?.['type'] === 'bans-prohibitions'
|| this.params?.['type'].includes('evac'))
) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same applies here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Logic updated to make it more readable

Copy link
Collaborator

@yzlucas yzlucas left a comment

Choose a reason for hiding this comment

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

Looks good, It did not mentioned in the ticket but I assume we want to do the same thing for Danger Rating? I think back button should take user to map with zoom level too. Can you confirm with Christine?

// If the user accessed the full details page from the map, and if the full details page contains one of area restrictions,
// fire bans, evac orders or evac alerts, use the backToMap function to route back to the map using the same layer and zoom level,
// along with the appropriate coordinates for that type
if (this.navigatedfromMapPage() && this.isCurrentlyNavigatedOn()) {
Copy link
Collaborator

@agordon-vivid agordon-vivid Dec 19, 2024

Choose a reason for hiding this comment

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

Suggested change
if (this.navigatedfromMapPage() && this.isCurrentlyNavigatedOn()) {
if (this.navigatedfromMapPage() && this.isCurrentlyNavigatedOn(['area-restriction', 'bans-prohibitions', 'evac-orders', 'evac-alerts', 'danger-rating'])) {

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

Comment on lines 113 to 115
isCurrentlyNavigatedOn() {
const fullDetailPageTypes = ['area-restriction', 'bans-prohibitions', 'evac-orders', 'evac-alerts', 'danger-rating'];
if(fullDetailPageTypes.includes(this.params?.['type'])){
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
isCurrentlyNavigatedOn() {
const fullDetailPageTypes = ['area-restriction', 'bans-prohibitions', 'evac-orders', 'evac-alerts', 'danger-rating'];
if(fullDetailPageTypes.includes(this.params?.['type'])){
isCurrentlyNavigatedOn(pageList) {
if(pageList.includes(this.params?.['type'])){

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

Copy link
Collaborator

@agordon-vivid agordon-vivid left a comment

Choose a reason for hiding this comment

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

Updated to make more generic and clear what's being checked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants