Filter dashboard by country when clicking the world map - #467
Open
smehmood wants to merge 2 commits into
Open
Conversation
Clicking a country with traffic on the WorldMap applies the same
`country=eq.<code>` filter used by the countries table, and clicking the
already-selected country clears it. Countries with data get a pointer
cursor, and while a country filter is active the selected country is
highlighted in the primary color while the rest of the map is dimmed.
Realtime ignores query filters, so its map opts out with allowFilter={false}.
Run-on: Niteshift
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
react-simple-maps selects one of the default/hover/pressed style objects instead of merging them, so the cursor set only on `default` was dropped the moment the pointer entered a country — exactly when it matters. Repeat the cursor in all three states. Run-on: Niteshift Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
What
Clicking a country on the world map now filters the dashboard to that country's data.
country=eq.<code>filter the countries table uses, so the existing filter chip, all panels, and the chart update together.allowFilter={false}— realtime data ignores query filters, so a click there would have looked like a no-op.Verification
Verified in the browser on the Hulu demo website:
?country=eq.US, the "Country is United States" chip appeared, and metrics dropped to 1.69k visitors (matching the 1,680 US visitors in the countries table). Requests confirmed the filter reached the API (.../stats?...&country=eq.US)./realtime, no country is clickable and clicking leaves the URL unchanged.Screenshots
Filter applied after clicking the US on the map:
Selected country highlighted on the map:
Note
An earlier open PR (#459) implements the same feature. This branch is a separate implementation — close whichever one you don't want.
🤖 Generated with Claude Code
🌒 Run on Niteshift: View Task