Skip to content

Conversation

thortve
Copy link
Member

@thortve thortve commented Nov 5, 2026

Show country names consistently in filters and sightings

Closes #159

What changed

The country filter showed names ("Norway"), but sighting results showed codes ("NO"). Now every place that shows a country uses one shared formatter:

  • Added formatCountry in frontend/src/utils/format-sighting.ts. It uses the existing countryNameFromCode in utils/countries.ts, which the submit form already uses.
  • formatLocation now ends with the country name, for example "Oslo, OS, Norway" instead of "Oslo, OS, NO". This changes the results list, map labels, the detail page heading and the page title.
  • SearchFilters no longer has its own Intl.DisplayNames helper. The dropdown and the active-filter chips use formatCountry.

Missing and unknown countries

Country code Shown as
Known (no) Norway
Not an ISO country (xx) XX (the raw code in capitals, so we never guess a name and two unknown codes stay separate in the filter)
Missing (null or blank) Unknown country
City, state and country all missing Unknown location

Not included: countries filled in from coordinates by the backfill (#123) can't be marked as uncertain. The API has no field that says which ones were inferred, and adding one would change the database and GraphQL schema. That should be its own issue if we want it.

Tests

  • New unit tests for formatCountry with known, unknown and missing codes, plus updated formatLocation tests.
  • Updated component and e2e tests that expected the old code-based text ("San Marcos, TX, US", "Oslo, NO").
  • npm run lint, npm run format:check, npm run test and npm run test:e2e all pass.

How to check

  1. npm run dev and npm run dev:backend
  2. Pick a country in the filter. The chip and every result should show the same name.
  3. Open a sighting. The heading and the tab title should show the country name.

@thortve thortve added the enhancement New feature or request label Nov 5, 2026
@thortve thortve added this to the Partial submission 4 milestone Nov 5, 2026
@thortve thortve self-assigned this Nov 5, 2026
@thortve thortve linked an issue Nov 5, 2026 that may be closed by this pull request
@thortve thortve changed the base branch from main to 158-polish-visual-consistency-and-mobile-browsing November 5, 2026 09:36
@thortve thortve marked this pull request as ready for review November 5, 2026 09:39
@thortve thortve requested a review from a team as a code owner November 5, 2026 09:39
@thortve thortve merged commit ef2cee8 into 158-polish-visual-consistency-and-mobile-browsing Nov 5, 2026
2 checks passed
@thortve thortve deleted the 159-show-country-names-consistently-in-filters-and-sightings branch November 5, 2026 10:22
Sign in to join this conversation on GitHub.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show country names consistently in filters and sightings
1 participant