Skip to content

Commit 15886cd

Browse files
authored
Update the default label and its title on search order control widget. (#8959)
1 parent afcbc43 commit 15886cd

File tree

6 files changed

+16
-28
lines changed

6 files changed

+16
-28
lines changed

app/lib/frontend/templates/_consts.dart

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,11 @@ class SortDict {
8484

8585
final _sortDicts = const <SortDict>[
8686
SortDict(
87-
id: 'listing_relevance',
88-
label: 'listing relevance',
87+
id: 'default_ranking',
88+
label: 'default ranking',
8989
tooltip:
9090
'Packages are sorted by the combination of their overall score and '
91-
'their specificity to the selected platform.',
92-
),
93-
SortDict(
94-
id: 'search_relevance',
95-
label: 'search relevance',
96-
tooltip:
97-
'Packages are sorted by the combination of the text match, '
98-
'their overall score and their specificity to the selected platform.',
91+
'their relevance to matching the search query text.',
9992
),
10093
SortDict(
10194
id: 'top',
@@ -134,7 +127,4 @@ final _sortDicts = const <SortDict>[
134127
),
135128
];
136129

137-
List<SortDict> getSortDicts(bool isSearch) {
138-
final removeId = isSearch ? 'listing_relevance' : 'search_relevance';
139-
return _sortDicts.where((d) => d.id != removeId).toList();
140-
}
130+
List<SortDict> getSortDicts() => _sortDicts;

app/lib/frontend/templates/listing.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,8 @@ d.Node listingInfo({
9090
}
9191

9292
d.Node _renderSortControl(SearchForm form) {
93-
final isSearch = form.hasQuery;
94-
final options = getSortDicts(isSearch);
95-
final sortValue =
96-
form.order?.name ?? (isSearch ? 'search_relevance' : 'listing_relevance');
93+
final options = getSortDicts();
94+
final sortValue = form.order?.name ?? 'default_ranking';
9795
final selected = options.firstWhere(
9896
(o) => o.id == sortValue,
9997
orElse: () => options.first,

app/test/frontend/golden/pkg_index_page.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,12 +415,12 @@ <h3 class="search-form-section-header foldable-button">
415415
packages
416416
</div>
417417
<div class="sort-control hoverable">
418-
<div class="info-identifier" title="Packages are sorted by the combination of the text match, their overall score and their specificity to the selected platform.">
418+
<div class="info-identifier" title="Packages are sorted by the combination of their overall score and their relevance to matching the search query text.">
419419
Sort by
420-
<button class="sort-control-selected">search relevance</button>
420+
<button class="sort-control-selected">default ranking</button>
421421
</div>
422422
<div class="sort-control-popup">
423-
<button class="sort-control-option selected" data-value="search_relevance">search relevance</button>
423+
<button class="sort-control-option selected" data-value="default_ranking">default ranking</button>
424424
<button class="sort-control-option" data-value="top">overall score</button>
425425
<button class="sort-control-option" data-value="updated">recently updated</button>
426426
<button class="sort-control-option" data-value="created">newest package</button>

app/test/frontend/golden/publisher_packages_page.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,12 @@ <h1 class="title pub-monochrome-icon-hoverable">example.com</h1>
169169
<code>example.com</code>
170170
</div>
171171
<div class="sort-control hoverable">
172-
<div class="info-identifier" title="Packages are sorted by the combination of their overall score and their specificity to the selected platform.">
172+
<div class="info-identifier" title="Packages are sorted by the combination of their overall score and their relevance to matching the search query text.">
173173
Sort by
174-
<button class="sort-control-selected">listing relevance</button>
174+
<button class="sort-control-selected">default ranking</button>
175175
</div>
176176
<div class="sort-control-popup">
177-
<button class="sort-control-option selected" data-value="listing_relevance">listing relevance</button>
177+
<button class="sort-control-option selected" data-value="default_ranking">default ranking</button>
178178
<button class="sort-control-option" data-value="top">overall score</button>
179179
<button class="sort-control-option" data-value="updated">recently updated</button>
180180
<button class="sort-control-option" data-value="created">newest package</button>

app/test/frontend/golden/publisher_unlisted_packages_page.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,12 @@ <h1 class="title pub-monochrome-icon-hoverable">example.com</h1>
169169
<code>example.com</code>
170170
</div>
171171
<div class="sort-control hoverable">
172-
<div class="info-identifier" title="Packages are sorted by the combination of their overall score and their specificity to the selected platform.">
172+
<div class="info-identifier" title="Packages are sorted by the combination of their overall score and their relevance to matching the search query text.">
173173
Sort by
174-
<button class="sort-control-selected">listing relevance</button>
174+
<button class="sort-control-selected">default ranking</button>
175175
</div>
176176
<div class="sort-control-popup">
177-
<button class="sort-control-option selected" data-value="listing_relevance">listing relevance</button>
177+
<button class="sort-control-option selected" data-value="default_ranking">default ranking</button>
178178
<button class="sort-control-option" data-value="top">overall score</button>
179179
<button class="sort-control-option" data-value="updated">recently updated</button>
180180
<button class="sort-control-option" data-value="created">newest package</button>

app/test/frontend/golden/search_page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ <h3 class="search-form-section-header foldable-button">
421421
<button class="sort-control-selected">overall score</button>
422422
</div>
423423
<div class="sort-control-popup">
424-
<button class="sort-control-option" data-value="search_relevance">search relevance</button>
424+
<button class="sort-control-option" data-value="default_ranking">default ranking</button>
425425
<button class="sort-control-option selected" data-value="top">overall score</button>
426426
<button class="sort-control-option" data-value="updated">recently updated</button>
427427
<button class="sort-control-option" data-value="created">newest package</button>

0 commit comments

Comments
 (0)