From c83d9919b40b445e4e4b71974d5b7dbff2e6127a Mon Sep 17 00:00:00 2001 From: Istvan Soos Date: Wed, 17 Sep 2025 09:59:53 +0200 Subject: [PATCH] Update the default label and its title on search order control widget. --- app/lib/frontend/templates/_consts.dart | 18 ++++-------------- app/lib/frontend/templates/listing.dart | 6 ++---- app/test/frontend/golden/pkg_index_page.html | 6 +++--- .../golden/publisher_packages_page.html | 6 +++--- .../publisher_unlisted_packages_page.html | 6 +++--- app/test/frontend/golden/search_page.html | 2 +- 6 files changed, 16 insertions(+), 28 deletions(-) diff --git a/app/lib/frontend/templates/_consts.dart b/app/lib/frontend/templates/_consts.dart index 1f47b0b46b..70602b20e6 100644 --- a/app/lib/frontend/templates/_consts.dart +++ b/app/lib/frontend/templates/_consts.dart @@ -84,18 +84,11 @@ class SortDict { final _sortDicts = const [ SortDict( - id: 'listing_relevance', - label: 'listing relevance', + id: 'default_ranking', + label: 'default ranking', tooltip: 'Packages are sorted by the combination of their overall score and ' - 'their specificity to the selected platform.', - ), - SortDict( - id: 'search_relevance', - label: 'search relevance', - tooltip: - 'Packages are sorted by the combination of the text match, ' - 'their overall score and their specificity to the selected platform.', + 'their relevance to matching the search query text.', ), SortDict( id: 'top', @@ -134,7 +127,4 @@ final _sortDicts = const [ ), ]; -List getSortDicts(bool isSearch) { - final removeId = isSearch ? 'listing_relevance' : 'search_relevance'; - return _sortDicts.where((d) => d.id != removeId).toList(); -} +List getSortDicts() => _sortDicts; diff --git a/app/lib/frontend/templates/listing.dart b/app/lib/frontend/templates/listing.dart index e1ee330628..c5390c1839 100644 --- a/app/lib/frontend/templates/listing.dart +++ b/app/lib/frontend/templates/listing.dart @@ -90,10 +90,8 @@ d.Node listingInfo({ } d.Node _renderSortControl(SearchForm form) { - final isSearch = form.hasQuery; - final options = getSortDicts(isSearch); - final sortValue = - form.order?.name ?? (isSearch ? 'search_relevance' : 'listing_relevance'); + final options = getSortDicts(); + final sortValue = form.order?.name ?? 'default_ranking'; final selected = options.firstWhere( (o) => o.id == sortValue, orElse: () => options.first, diff --git a/app/test/frontend/golden/pkg_index_page.html b/app/test/frontend/golden/pkg_index_page.html index d07692a691..ef0621df28 100644 --- a/app/test/frontend/golden/pkg_index_page.html +++ b/app/test/frontend/golden/pkg_index_page.html @@ -415,12 +415,12 @@

packages
-
+
Sort by - +
- + diff --git a/app/test/frontend/golden/publisher_packages_page.html b/app/test/frontend/golden/publisher_packages_page.html index 685fd53605..cdfb8cd143 100644 --- a/app/test/frontend/golden/publisher_packages_page.html +++ b/app/test/frontend/golden/publisher_packages_page.html @@ -169,12 +169,12 @@

example.com

example.com
-
+
Sort by - +
- + diff --git a/app/test/frontend/golden/publisher_unlisted_packages_page.html b/app/test/frontend/golden/publisher_unlisted_packages_page.html index a603f5e3fc..95750c340e 100644 --- a/app/test/frontend/golden/publisher_unlisted_packages_page.html +++ b/app/test/frontend/golden/publisher_unlisted_packages_page.html @@ -169,12 +169,12 @@

example.com

example.com
-
+
Sort by - +
- + diff --git a/app/test/frontend/golden/search_page.html b/app/test/frontend/golden/search_page.html index 42dc584eec..609127d291 100644 --- a/app/test/frontend/golden/search_page.html +++ b/app/test/frontend/golden/search_page.html @@ -421,7 +421,7 @@

- +