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

feat(tupaiaWeb): RN-1111: Disable map overlays for levels higher than current entity #5888

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

Conversation

alexd-bes
Copy link
Contributor

Issue RN-1111: Disable map overlays for levels higher than current entity

Changes:

  • Disable map overlays if selected entity is lower than map overlay measure level
  • Added tooltip for disabled map overlay
  • Added text to show what currently selected entity type is
  • Redirect to the default overlay OR the first available map overlay if entity changes and currently selected map overlay is disabled

Screenshots:

Screenshot 2024-09-10 at 2 13 17 PM

Screenshot 2024-09-10 at 2 13 09 PM

Screenshot 2024-09-10 at 2 12 32 PM

* Copyright (c) 2017 - 2024 Beyond Essential Systems Pty Ltd
*/

export const getFriendlyEntityType = entityType => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please add a comment here as it's hard to tell exactly why this needs to be done 🙏

@@ -219,6 +236,7 @@ export const MapOverlayList = ({ toggleOverlayLibrary }: { toggleOverlayLibrary?

if (isLoadingMapOverlays) return null;

const friendlyEntityType = getFriendlyEntityType(entity?.type);
Copy link
Contributor

@tcaiger tcaiger Sep 11, 2024

Choose a reason for hiding this comment

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

Might be nice to just add this to useEntity?!

@@ -141,6 +156,11 @@ export class MapOverlaysRoute extends Route<MapOverlaysRequest> {
(relation: MapOverlayGroupRelation) => {
if (relation.child_type === MAP_OVERLAY_CHILD_TYPE) {
const overlay = overlaysById[relation.child_id];

// If the measure level is found in the ancestor types, that means the currently selected entity is a descendant of the measure level entity, so there will be no data to display. In this case, the overlay should be disabled.
const isDisabled = overlay.config.measureLevel
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice - I think this is a great solution in the end. It took 2 years but we finally figured it out 😆

Copy link
Contributor

@tcaiger tcaiger left a comment

Choose a reason for hiding this comment

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

Love it!

merge: update branch with latest dev
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