Skip to content

feat(#979): add forest cover map improvements - #996

Merged
Abradat merged 14 commits into
mainfrom
feat/979-forest-cover-map-improvement
Aug 19, 2025
Merged

feat(#979): add forest cover map improvements#996
Abradat merged 14 commits into
mainfrom
feat/979-forest-cover-map-improvement

Conversation

@Abradat

@Abradat Abradat commented Aug 18, 2025

Copy link
Copy Markdown
Collaborator

Description

This change implements the map improvements for the forest cover tab on the opening details page.

Fixes #979

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:

Introduces selection checkboxes for forest cover polygons in OpeningForestCover, allowing users to select/deselect all or individual polygons. The selected polygons are synchronized with the map display, so only selected forest cover polygons are rendered. State management for available and selected forest cover IDs is lifted to OpeningDetails and passed through OpeningSummary and OpeningsMap for consistent behavior.
@Abradat Abradat linked an issue Aug 18, 2025 that may be closed by this pull request
3 tasks
Updated the MapProps interface to make forest cover ID-related props optional and added a conditional check before calling setAvailableForestCoverIds. This improves component flexibility and prevents potential runtime errors when these props are not provided.
Displays a message when no forest cover polygon is selected, guiding users to select from the table. Styles for the message have been added to ensure visibility and proper positioning.
Added popup rendering for forest cover inventory, reserve, and silviculture layers in OpeningsMapEntryPopup. Updated MapLayer property keys to use camelCase for consistency and to match popup component expectations.
Changed the color and removed fillColor for several map layers to use 'pink'. Updated the pink color palette in colorMap with new values and commented out the old palette.
@Abradat
Abradat marked this pull request as ready for review August 18, 2025 23:45
…h dark theme

Changed the popup text color from a CSS variable to colors.$gray-100 for consistency with the theme
@Abradat

Abradat commented Aug 19, 2025

Copy link
Copy Markdown
Collaborator Author

NOTE: We're showing the selected forest cover polygons selected from the table if they're matched with the fetched map polygons. Since the data in the test database (PR) differs from production, and we're fetching map polygons from the maps service in production separately, we will see most of the forest cover rows being disabled as they're being fetched from the database, whereas the map polygons are from the maps service.

This is an issue for testing this PR using the Frontend link above. It works fine locally, as we have migrated from production for our local development.

Clarifies the message shown when no forest cover polygon is selected and displayed on the map, improving user guidance.
@Abradat
Abradat requested a review from Copilot August 19, 2025 16:57
@Abradat Abradat self-assigned this Aug 19, 2025

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 map improvements for the forest cover tab on the opening details page, adding checkbox-based selection functionality to control which forest cover polygons are displayed on the map. The changes enable users to selectively show/hide forest cover polygons and improve the visual styling of these map layers.

Key changes include:

  • Added checkbox selection controls in the forest cover table to toggle polygon visibility on the map
  • Updated forest cover map layer styling from orange/yellow colors to pink color scheme
  • Implemented state management for tracking available and selected forest cover IDs

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
frontend/src/types/MapLayer.ts Updated forest cover layer styling and popup property keys
frontend/src/screens/Openings/OpeningDetails/index.tsx Added state management for forest cover selection
frontend/src/components/OpeningsMapEntryPopup/index.tsx Added popup support for forest cover layers
frontend/src/components/OpeningsMap/styles.scss Added styling for empty map message
frontend/src/components/OpeningsMap/index.tsx Implemented forest cover filtering and empty state message
frontend/src/components/OpeningDetails/OpeningSummary/index.tsx Passed forest cover selection props to map component
frontend/src/components/OpeningDetails/OpeningForestCover/index.tsx Added checkbox controls for polygon selection
Comments suppressed due to low confidence (1)

frontend/src/types/MapLayer.ts:162

  • The fillColor property is being removed but the comment suggests it was a vibrant pink. This creates inconsistency since the color is now set to 'pink' which will use the colorMap values. Consider removing or updating the comment to reflect the actual implementation.
    },

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

Comment thread frontend/src/types/MapLayer.ts Outdated
Deleted an unused commented line for the pink color map in MapLayer.ts to clean up the code.
Tooltip label now toggles between 'Select all' and 'Unselect all' based on selection state. Tooltip class name changed to 'forest-cover-map-tooltip' for consistency.

@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.

Looks great! I have two comments:

  1. image
    • Do we need to have the Map word next to the 'master' checkbox?
  2. There's a weird interaction bug where two polygons are showing despite only one is selected:
    chrome-capture-2025-8-19

As you can see, A1 stuck around for some reasons but it has a different shade than the selected A1 in the beginning.

Added checks for FOREST_COVER_ID and SILV_POLYGON_NUMBER in feature filtering to prevent undefined errors. Updated useEffect dependencies and provided a stable key for OpeningsMapEntry to ensure correct rendering when selectedForestCoverIds change.
Changed the key prop in the forest cover table rows to use a combination of coverId, polygonId, and idx for improved uniqueness and to prevent potential rendering issues.
Introduced a container for the select-all checkbox and added a 'Map' label next to it in the forest cover table header. Updated styles to align the checkbox and label horizontally for improved clarity.
@Abradat

Abradat commented Aug 19, 2025

Copy link
Copy Markdown
Collaborator Author

@craigyu

Rendering issue: 6afc0fc

Map header: 70fadc8

@Abradat
Abradat requested a review from craigyu August 19, 2025 22:34

@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.

image

@Abradat
Abradat merged commit b8947f0 into main Aug 19, 2025
24 of 25 checks passed
@Abradat
Abradat deleted the feat/979-forest-cover-map-improvement branch August 19, 2025 23:01
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]: Forest Cover Map Improvement

3 participants