Skip to content

Adds map overlay switch on map #1357

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

TheYakuzo
Copy link

@TheYakuzo TheYakuzo commented Apr 5, 2025

Introduces a button to toggle the overlay's visibility. The overlay preference persists across sessions.

Memoize MapOverlay to avoid unnecessary re-renders

Move activeOverlay management from MapOverlay.js to MainMap.jsx to avoid code duplication on MapOverlay.js and MapOverlayButton.js [ new component ]

The button is not rendered when no map overlay is indicated (hence the displacement of the activeOverlay logic).

Screenshot 2025-04-05 at 18 34 07

Screenshot 2025-04-05 at 18 34 17

Introduces a button to toggle the overlay's visibility. The overlay preference persists across sessions.

Memoize MapOverlay to avoid unnecessary re-renders
@TheYakuzo TheYakuzo changed the title Adds map overlay functionality Adds map overlay switch on map Apr 5, 2025
Refactors the map overlay component to improve code readability and maintainability.

- Updates the overlay control to use static getDefaultPosition method.
- Updates the overlay styling to use single quotes.

const statusClass = (status) => `maplibregl-ctrl-icon maplibre-ctrl-overlay maplibre-ctrl-overlay-${status}`;

class OverlayControl {
Copy link
Member

Choose a reason for hiding this comment

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

Is this basically a copy of the alarm button? I think we need to figure out how to reuse a button instead of copying.

Copy link
Author

@TheYakuzo TheYakuzo Apr 5, 2025

Choose a reason for hiding this comment

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

Yes, it's true, I'll see tomorrow to redo these two buttons.
Do you usually put them in src/common/components?

Or maybe src/map and I create a new components folder in it

Copy link
Member

Choose a reason for hiding this comment

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

Map components should be under map folder.

JeremPlt-Kraken added 2 commits April 5, 2025 23:07
Refactors the map notification and overlay buttons into a generic panel button component.

This change improves code reusability and simplifies the map interface by using a consistent button style for different map controls.
Simplifies map control button styling by removing the redundant `maplibre-ctrl-background-icon` class.

This change improves code readability and maintainability by consolidating the icon styling under a single `maplibre-ctrl-icon` class, making it easier to manage button appearance.
@tananaev
Copy link
Member

tananaev commented Apr 6, 2025

Can we split into 2 PRs:

  1. Refactor button to be generic
  2. Add overlay control button

Also I think the icon shouldn't have a color.

@TheYakuzo
Copy link
Author

Done : #1358 ( refactoring )
This current PR remains the same, there should be no conflicts.

Updates the overlay icon colors to improve visual clarity.

The "on" state icon is now black, and the "off" state icon is now gray.
@TheYakuzo
Copy link
Author

color is now black for enabled and gray for disabled

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.

2 participants