Skip to content

Group the appellation filter by country - #25

Merged
bdevloed merged 1 commit into
mainfrom
filter-country-layer
Sep 6, 2026
Merged

bdevloed merged 1 commit into
mainfrom
filter-country-layer

Conversation

@bdevloed

@bdevloed bdevloed commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

The appellation filter listed 177 region groups from 21 countries in one flat list ordered by size, so regions interleaved (FR Bourgogne → IT Toscana → GR Ελλάδα → FR Val de Loire) with no way to scan by country. This nests them under a country level: 21 collapsed rows, each with its flag, name, and appellation + complementary-designation counts.

Cross-border appellations

Driven by the existing country_aliases field, a cross-border appellation is listed under every country it spans — today only Maasvallei Limburg (PDO-BE+NL-02172), under both 🇧🇪 and 🇳🇱. It stays one record with one polygon and one slug, so ticking it on either side toggles the same entry in filters.appellations and mirrors onto its twin row. country_aliases moves into STARTUP_AOCS_FIELDS (out of the lazy panel payload) because the tree needs it at first paint.

An ambiguity the flat list had

Regions were keyed by name alone, but Tokaj is both a Hungarian borrégió and a Slovak vinohradnícka oblasť, and the "no region" bucket spanned four countries. Both levels now key on (country, region). The omnisearch keeps its name-keyed pick — its index is the global region facet — via setRegionNameSelection, the one place Tokaj is deliberately treated as a single entry.

Also

  • A fully-selected subtree collapses to one chip (country first, else each whole region), with a flag prefix since the chip row has no nesting to disambiguate with. A one-record group stays uncollapsed so its appellation keeps its name.
  • Bulk checkboxes are named after their row ("Select all — Burgundy") rather than ~200 controls announcing a bare "select all". Composed from the existing msgid — no new translatable string.
  • Both levels render mixed case. The region rows had been uppercased by the sidebar's global summary rule, which was hiding that the FR bassin labels are INAO's own ALL-CAPS join key; the fr catalog now carries their proper names (Bourgogne, Vallée du Rhône, Vins doux naturels), as en/es/nl already did.

Verification

Ran the tree builder headless against the real corpus: 21 countries / 178 region groups / 2 914 records — 176 groups render by default, since EAUX-DE-VIE DE CIDRE and RHUM are spirit-only and hide with the spirits toggle, as before. Browser pass (Playwright) confirmed the cross-border twin-checkbox mirror, the chip collapse, the aria labels and the per-locale labels in fr and en.

eslint clean · 368 tests pass · ruff clean · full stage-04 rebuild green with asset content-hashes intact.

Note: locale/ is gitignored, so the 18 French bassin msgstr edits are not in this diff — they are msgstr-only changes on existing msgids (no pybabel fuzzy risk) and need re-applying on any other machine.

🤖 Generated with Claude Code

The filter listed 177 region groups from 21 countries in one flat list
ordered by size, so regions interleaved (FR Bourgogne, IT Toscana,
GR Ελλάδα, FR Val de Loire, …) with no way to scan by country. Nest them
under a country level: 21 collapsed rows, each with its flag, name and
appellation + complementary-designation counts.

Nesting also fixes an ambiguity the flat list had: regions were keyed by
name alone, but Tokaj is both a Hungarian borrégió and a Slovak
vinohradnícka oblasť, and the "no region" bucket spanned four countries.
Both levels now key on (country, region); the omnisearch keeps its
name-keyed pick (its index is the global region facet) via
setRegionNameSelection.

A cross-border appellation — a record carrying country_aliases, today
only Maasvallei Limburg on the BE/NL border — is listed under every
country it spans. It stays one record with one polygon and one slug, so
ticking it on either side toggles the same filter entry and mirrors onto
its twin row. country_aliases is promoted into STARTUP_AOCS_FIELDS
because the tree needs it at first paint.

Also:
  - a fully-selected subtree collapses to one chip (country first, else
    each whole region), with a flag prefix since the chip row has no
    nesting to disambiguate with; a one-record group is left uncollapsed
    so its appellation keeps its name.
  - bulk checkboxes are named after their row ("Select all — Burgundy")
    instead of ~200 controls all announcing a bare "select all".
  - both tree levels render mixed case. The region rows had been
    uppercased by the sidebar's global summary rule, which had been
    hiding that the FR bassin labels are INAO's own ALL-CAPS join key;
    the fr catalog now carries their proper names, as en/es/nl already
    did.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@bdevloed
bdevloed merged commit 50a17f2 into main Sep 6, 2026
2 checks passed
@bdevloed
bdevloed deleted the filter-country-layer branch September 6, 2026 18:18
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