Add islands filtering controls and show/hide markers#77
Merged
fityannugroho merged 2 commits intomainfrom Aug 26, 2025
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds UI controls and a small context provider to filter island markers on the Map Dashboard. The main goal is to allow users to toggle filters for "Populated" and "Outermost-small" islands and to show/hide island markers entirely. When both filters are active the logic uses OR semantics (show islands that are populated OR outermost-small).
What I changed
Added a small provider to manage island filter state and derived values:
modules/MapDashboard/IslandsFilterProvider.tsx— newfilter({ populated, outermostSmall }),setFilter,filteredIslands,counts,isLoading,showMarkers, andsetShowMarkers.useIslands()hook to fetch island data and compute derived values.Wired the provider into the dashboard root so both the sidebar and map can access the state:
modules/MapDashboard/Dashboard.tsx— now wrapsDashboardLayoutwithIslandsFilterProvider.UI updates to control filters and show counts:
modules/MapDashboard/IslandsInfo.tsx— updated to consumeuseIslandsFilter()and render three controls:shown / total islands shownand retained the loading state.Map marker rendering respects the new show toggle and filter:
modules/MapDashboard/IslandMarkers.tsx— now readsfilteredIslandsandshowMarkersfrom provider; returnsnullwhenshowMarkersis false.Design decisions / rationale
Provider vs. lifting state: I added a small React context provider (
IslandsFilterProvider) that usesuseIslands()internally. This avoids duplicating fetch logic and keeps a single source of truth for both the sidebar and map.OR semantics for both toggles: When both
PopulatedandOutermost-smallare toggled on, the filter shows islands that match either attribute. This is more intuitive for users who want to see both categories at once. If AND semantics are preferred later, the provider centralizes the change.Show/Hide markers: Adding
showMarkerskeeps the marker rendering decision local to the provider and prevents unnecessary map marker rendering when users want a cleaner view.Files changed
modules/MapDashboard/IslandsFilterProvider.tsx— provider + hookmodules/MapDashboard/Dashboard.tsx— provider wrappermodules/MapDashboard/IslandsInfo.tsx— toggles UI + countsmodules/MapDashboard/IslandMarkers.tsx— use filteredIslands + showMarkersRequirements coverage
populatedandoutermost-smallinIslandsInfo: Donecounts.shown / counts.totalshown)IslandMarkersso markers rendered match filter: Done (IslandMarkersconsumesfilteredIslandsfrom the provider)showMarkerstoggle)