Skip to content

Chore: multi-select filter (i–x) to the heritage search form#309

Merged
zigzagdev merged 3 commits intochore/add-criteria_endangered-search-formfrom
feat/add-multi-criteria-selector
May 4, 2026
Merged

Chore: multi-select filter (i–x) to the heritage search form#309
zigzagdev merged 3 commits intochore/add-criteria_endangered-search-formfrom
feat/add-multi-criteria-selector

Conversation

@zigzagdev
Copy link
Copy Markdown
Owner

Summary

Adds the UNESCO Criteria multi-select filter (i–x) to the heritage search form. Selecting multiple chips broadens the result set per the backend's (criteria:i OR criteria:ii OR ...) Algolia filter.

URL convention

  • Comma-separated: ?criteria=i,ii,iii,iv
  • Empty selection → omitted from URL
  • Backend splits the string on comma; pairs with the controller-side fix that landed at the same time.

Semantics

  • OR (any-match) — confirmed against backend AlgoliaWorldHeritageSearchAdapter. Selecting more chips matches more sites, not fewer.

Scope

Domain & URL

  • criteria: CriteriaCode[] added to HeritageSearchParams and SearchValues (default []).
  • parseHeritageSearchParams reads comma-separated criteria=ii,iv, strips invalid codes, dedupes, and sorts in CRITERIA canonical order.
  • serializeHeritageSearchParams emits criteria=ii,iv only when non-empty.

API

  • SearchParams.criteria?: readonly CriteriaCode[] threaded through search-api.ts and use-search-heritage-query.ts. Empty array stays out of the request.

UI

  • A multi-toggle chip group of i–x sits between the Category row and the Endangered checkbox in HeritageSearchForm. The heading reuses the existing
    text.criteria key. Click adds/removes; selection stays in CRITERIA canonical order.

Round-trip

  • SearchHeritageFormContainer, SearchHeritageResultsContainer, HeritageDetailLayout, and both HeritageSubHeaders carry criteria through their
    drafts/submit handlers.

Tests

  • New parseHeritageSearchParams / serializeHeritageSearchParams cases for criteria: empty / single / multi-value / invalid-filtering / dedup-and-sort / round-trip (10 new cases).
  • Updates to search-heritage-container.test.tsx and use-search-heritage-query-test.ts to satisfy the new field.

zigzagdev and others added 3 commits May 3, 2026 22:26
… round-trip)

Add criteria: CriteriaCode[] to HeritageSearchParams and SearchValues,
default it to [], and parse/serialize the URL as a comma-separated list
(criteria=ii,iv) — invalid codes are dropped, duplicates collapsed, and
the resulting array is sorted in CRITERIA canonical order. The form /
result containers, detail layout, both HeritageSubHeaders, and the test
helpers are updated to satisfy the new field. Empty array stays out of
the URL.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Render the i–x criteria as multi-toggle chips between the Category row
and the Endangered checkbox. Clicking a chip adds or removes the code
from the selection (kept in CRITERIA canonical order); the heading
reuses the existing text.criteria key.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@zigzagdev zigzagdev self-assigned this May 4, 2026
@zigzagdev zigzagdev linked an issue May 4, 2026 that may be closed by this pull request
3 tasks
Copy link
Copy Markdown
Owner Author

@zigzagdev zigzagdev left a comment

Choose a reason for hiding this comment

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

Ok

@zigzagdev zigzagdev merged commit 2c3e2e0 into chore/add-criteria_endangered-search-form May 4, 2026
1 check passed
@zigzagdev zigzagdev deleted the feat/add-multi-criteria-selector branch May 4, 2026 00:43
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.

Add UNESCO Criteria multi-select filter to heritage search form

1 participant