Skip to content

Filter dashboard by country when clicking the world map - #467

Open
smehmood wants to merge 2 commits into
masterfrom
smehmood/map-country-click-filter-hos79h
Open

Filter dashboard by country when clicking the world map#467
smehmood wants to merge 2 commits into
masterfrom
smehmood/map-country-click-filter-hos79h

Conversation

@smehmood

@smehmood smehmood commented Aug 10, 2026

Copy link
Copy Markdown

What

Clicking a country on the world map now filters the dashboard to that country's data.

  • Clicking a country that has traffic applies the same country=eq.<code> filter the countries table uses, so the existing filter chip, all panels, and the chart update together.
  • Clicking the already-selected country clears the filter.
  • Countries with data get a pointer cursor; countries without data (and Antarctica) stay inert.
  • While a country filter is active, the selected country is highlighted in the primary color and the rest of the map is dimmed.
  • The realtime map opts out via 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:

  • Clicking the US set ?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).
  • Clicking the US again cleared the filter and returned to the unfiltered dashboard.
  • Clicking Greenland (no data) did nothing.
  • On /realtime, no country is clickable and clicking leaves the URL unchanged.
  • No console errors.

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


Open in Devin Review

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>

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 2 additional findings in Devin Review.

Open in Devin Review

Comment thread src/components/metrics/WorldMap.tsx
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>
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.

1 participant