Skip to content

feat(#978): add activities map improvements - #1008

Merged
Abradat merged 32 commits into
mainfrom
feat/978-activities-map-improvement
Sep 3, 2025
Merged

feat(#978): add activities map improvements#1008
Abradat merged 32 commits into
mainfrom
feat/978-activities-map-improvement

Conversation

@Abradat

@Abradat Abradat commented Aug 25, 2025

Copy link
Copy Markdown
Collaborator

Description

This change implements the activities tab map improvements.

Fixes #978

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Documentation update

How Has This Been Tested?

  • New unit tests
  • New integrated tests
  • New component tests
  • New end-to-end tests
  • New user flow tests
  • No new tests are required
  • Manual tests (description below)
  • Updated existing tests

Checklist

  • I have read the CONTRIBUTING doc
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have already been accepted and merged

Further comments


Thanks for the PR!

Deployments, as required, will be available below:

Please create PRs in draft mode. Mark as ready to enable:

After merge, new images are deployed in:

Refactored getPropertyName to handle cases where 'kind' contains multiple comma-separated values. Now supports returning ACTUAL_TREATMENT_AREA for specific combinations and improves extensibility.
@Abradat Abradat linked an issue Aug 25, 2025 that may be closed by this pull request
8 tasks
@Abradat Abradat self-assigned this Aug 25, 2025
Abradat added 17 commits August 25, 2025 14:51
Added a check in getPropertyName to return default property names when the kind parameter is null or empty, preventing potential errors from invalid input.
Introduces checkbox controls to select silviculture activities and disturbances for map display. Updates components and props to manage available and selected IDs, and refines map rendering logic to filter polygons based on user selection.
Added a data-testid attribute to the select all checkbox in OpeningForestCover for improved testability.
Changed the button label to 'Hide from map' when the polygon is already shown, and 'Show on map' otherwise, in both ActivityAccordion and DisturbanceAccordion components for improved user feedback.
Changed 'Activity Treatment Units' and 'Planting' layers to use orange color scheme. Updated popup field names and values for clarity. Modified colorMap to use a single orange shade and added grey color.
Introduces specific styling for features with activity treatment properties, distinguishing 'DN' (Disturbance) and non-'DN' activities with unique colors and weights. Also refactors hover and selection logic for consistent highlighting.
Includes ATU_COMPLETION_DATE in the returned properties when querying WHSE_FOREST_VEGETATION.RSLT_ACTIVITY_TREATMENT_SVW, allowing access to treatment completion dates.
Introduced silvicultureStatusCodes and disturbanceStatusCodes constants to provide mappings from status codes to human-readable descriptions for silviculture activities and disturbance types.
Updated formatLocalDate to strip trailing 'Z' from the localDate string before parsing. This ensures correct local time formatting when the input date string includes a 'Z' (UTC indicator).
Enhanced OpeningsMapEntryPopup to display details for WHSE_FOREST_VEGETATION.RSLT_ACTIVITY_TREATMENT_SVW, including silviculture status, area, and end date. Updated MapLayer types to provide relevant properties and adjusted feature styling logic for selected and hovered states.
Adds a message to the map UI when forest cover polygons are selected, improving user feedback for the forest cover map view.
Display contextual messages on the map when activities or disturbances are selected or not selected. Updated styles to support new message types for improved user feedback.
Replaces hardcoded 'DN' with dynamic base code for silviculture activity ID checks in tooltip label and alignment logic, ensuring correct tooltip behavior based on available and selected activities.
…ccordions

Tooltip labels for select-all checkboxes now display 'No polygon is available' when no polygons are present, improving user feedback in ActivityAccordion and DisturbanceAccordion components.
…der checkbox

Tooltip now displays 'No polygon is available' when there are no available forest cover IDs, improving user feedback for disabled selection state.
@Abradat
Abradat marked this pull request as ready for review August 27, 2025 17:38
@Abradat

Abradat commented Aug 27, 2025

Copy link
Copy Markdown
Collaborator Author

#1010 changes will also be included in this PR.

Updated the weights for several MapKindType entries in kindWeightMap from 2 to 3 to ensure consistent prioritization with other layers. This change may affect rendering order or importance in map visualizations.
Eliminates the conditional 'pinned' class and its associated border styling from the map popup. This simplifies the popup appearance and logic.
Replaced regular spaces with non-breaking spaces ( ) between popup labels and their values to improve layout consistency and prevent unwanted line breaks in the OpeningsMapEntryPopup component.
If user selects a polygon and hovers over another polygon, only the hovered polygon would have outline border. By hovering out, the selected polygon will have the outline border.
Test assertions in OpeningsMapEntryPopup.test.tsx now separately check for label and value elements, reflecting changes in the component's rendering of region, district, and year created fields.
Added unit tests to verify rendering of OpeningsMapEntryPopup for various mapKindType values, including forest cover INV, RESERVE, SILV, cut block, and activity treatment. Ensures correct headers and content are displayed for each supported type.
Refines the key prop for OpeningsMapEntry to handle different map modes, ensuring correct rendering when switching between forest cover and activities maps.
@Abradat
Abradat requested a review from Copilot August 28, 2025 19:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements improvements to the activities map feature, adding map visualization capabilities for activities and disturbances on the activities tab of opening details. The changes include filtering and selection functionality for activities/disturbances on the map, visual styling improvements, and enhanced popup information.

  • Added map integration with checkbox selection for activities and disturbances
  • Implemented visual styling for different polygon types (activities vs disturbances)
  • Enhanced map popup information with status code mappings and date formatting

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
frontend/src/types/MapLayer.ts Updated map styling, popup properties, and feature styling logic for activities
frontend/src/components/OpeningsMap/index.tsx Added activities map functionality with selection state management
frontend/src/components/OpeningDetails/OpeningActivities/*.tsx Added map checkbox selection for activities and disturbances
frontend/src/constants/statucCodes.ts Added status code mappings for silviculture and disturbance codes
frontend/src/utils/DateUtils.ts Fixed date formatting to handle timezone suffixes
backend/src/main/java/.../OpenMapsService.java Added property mapping for activity treatment data
Comments suppressed due to low confidence (1)

frontend/src/components/OpeningsMapEntry/index.tsx:1

  • The useEffect dependency was changed from selectedFeature to hoveredFeature, but the logic inside still references both selectedFeature and hoveredFeature. This could cause the effect to run unnecessarily or miss important updates.
import React, { useEffect, useState, useRef } from "react";

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread frontend/src/constants/statucCodes.ts
Comment thread frontend/src/components/OpeningsMapEntryPopup/index.tsx Outdated
Comment thread frontend/src/types/MapLayer.ts
Comment thread frontend/src/components/OpeningsMapEntry/index.tsx
Comment thread frontend/src/components/OpeningsMap/index.tsx
Renamed 'statucCodes.ts' to 'statusCodes.ts' and updated the import in OpeningsMapEntryPopup to use the correct file name.

@craigyu craigyu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM! Approved with 1 small question

Comment thread frontend/src/types/MapLayer.ts
@Abradat
Abradat merged commit 99f939b into main Sep 3, 2025
25 of 26 checks passed
@Abradat
Abradat deleted the feat/978-activities-map-improvement branch September 3, 2025 17:06
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.

[DEV TASK]: Activities Map Improvement

3 participants