ADR 0098: Standard Filter And Sort Menu Across Media Walls
Status: accepted Date: 2026-09-27 Notes: ['2026-09-28 (UI redesign, approved): On the main timeline the filter trigger moved from its own row above the wall into the sticky top bar (AppHeader) via the pageMenu header-slot pattern (pageHeaderFilterSlot store); the wall starts directly under the app bar. On person/class-instance detail pages the inline confirmation filter (All/Confirmed/Tentative pills) moved into the shared filter panel as a domain-specific "Bekræftelse" section (FilterSortMenu confirmationLabel/confirmationOptions), with counts as badges included in the trigger badge; the face-box toggle ("Vis område") stays inline as a display toggle, and the trigger badge counts badge-bearing pills only. Both extensions keep FilterSortMenu a single shared component; rolling the header-slot pattern out to the remaining media walls (albums, discovery-domain, search) is left for later.', '2026-09-28 (UI redesign, approved): the timeline scope filter (Omfang: Alle/Mit bibliotek/Familiegruppe) moved from the ⋮ PageMenu into the standard filter menu as its first single-choice section (FilterSortMenu scopeLabel/scopeOptions/scopeValue), so the ⋮ menu on the timeline keeps only true actions (Select loaded).']
Context
Media walls (timeline, person/instance galleries, discovery domain media list, album detail, search results) each evolved their own controls: the instance page has segmented pills for sort (Optagelse/Tilføjet, PR #908) plus domain-specific toggles, search has a dedicated filter form (year, from/to, person, album, favorite), and every other wall has none. There is no media-type filter anywhere, no date-range outside search, and no favorites listing. Backend reality: sort=captured|added exists only on class-instance day endpoints (assigned_at, V143); timeline/albums/discovery-domain endpoints have no sort or filter params; favorites are modeled as active metadata_overrides rows (field_name='favorite', replaced_at IS NULL) with an efficient filter predicate already proven in SearchService; mediaType lives on original_assets.media_type ('photo'|'video') and is joined in every wall query; day-bucket endpoints compute counts and items in separate queries that must stay consistent. Non-discovery walls have no assignment concept: 'added' as a sort or range basis only exists where an occurrence relation exists (instance walls; album_items.created_at as added-to-album).
Decision
Standard media-wall controls on every wall: TWO separate icon buttons with the widely-recognized standard icons, built on the existing house popover pattern (PageMenu-style trigger, segmented-pill styling inside): (1) a SORT button (arrow-up-down icon) opening a sort-only popover with the per-surface Sortering options — instance walls offer Optagelsesdato (captured) and Tilføjet (added/assigned_at); the main timeline has NO sort button, since no assignment concept exists there and capture-date is fixed; albums offer Manuel rækkefølge (default, preserved), Optagelsesdato and Tilføjet (album_items.created_at); (2) a FILTER button (funnel icon) to its right opening a filter-only popover with Medietype (Alle/Foto/Video), Favoritter (toggle), and Datointerval (from/to on the active basis: capture everywhere; assignment basis on instance walls when sorting by Tilføjet; album_items.created_at when an album is sorted by Tilføjet) plus Nulstil filtre. Each button carries its own active affordance: the sort button badges when a non-default sort is selected; the filter button shows an active-filter count badge. Buttons are hidden when their popover would be empty (no sort options on a surface). Selection state is per visit (no URL persistence for now). The buttons replace existing scattered equivalents: the instance-page sort pills disappear, and on search the year/from/to/favorite form controls migrate into the filter menu while person/album selectors remain in place; domain-specific controls (Galleri/Kort, confirmation filter, face-box toggle, scope PageMenu) are out of scope and stay. Filtering and sorting are enforced server-side with one frozen parameter contract across wall endpoints: mediaType=photo|video, favorite=true, from/to=YYYY-MM-DD (half-open UTC, validated 400-style like SearchFilters); day-bucket queries and their item queries must apply identical predicates so counts never diverge from items. Changing sort or filter must NEVER reload or navigate the page: only the wall's data refetches in place (page chrome, header, timeline axis and scroll anchoring stay stable; the wall shows its inline loading state during refetch). Legacy explore person pages keep their existing controls until retired and are explicitly out of scope. Any future media-wall filter or sort option must be added to these menus rather than as a new ad-hoc control.
Consequences
['API work: timeline, discovery-domain and album wall endpoints gain mediaType/favorite/from/to params (albums additionally sort=manual|captured|added); search gains mediaType; class-instance endpoints gain the three filter params alongside existing sort; a Flyway migration adds a partial index on metadata_overrides for favorite filtering.', 'Timeline cursor semantics must keep working under filters: filter predicates are constant per view and participate in the keyset where-clauses, not in the cursor encoding.', 'Frontend: shared filter/sort menu components behind two standard icon buttons (arrow-up-down = sort, funnel = filter), each with its own active badge; MediaGrid already understands captured/added day keys; per-surface wiring replaces removed controls; sort/filter changes refetch wall data in place only — page navigation/reload is a defect; e2e specs for the removed pills and the search form need updates.', 'Counts consistency becomes a test requirement: filtered day buckets and their item listings must agree.', 'Favorites filtering cost is bounded by the new index; unindexed ad-hoc override filtering remains discouraged.']
Memories Wiki
Using Memories
- Accounts, the Library Hub, and Data Export
- Albums and Automatic Suggestions
- Explore and Discovery Domains
- The Media Viewer
- People and Faces
- Places and Map
- Plants (In Development)
- Datenschutzerklärung (Privacy Policy)
- Fast, Progressive Image Loading
- Search
- Sharing and Households
- Timeline and Photos
- Uploading and Import
Self-Hosting
- Backup and Restore
- CLI Password Reset
- Deployment Architecture
- Known Issues and Operator Diagnostics
- Map Tiles and Place Data Privacy
- Storage Layout
- Upgrades and Versioning
- Workers
Reference