Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions app/lib/frontend/templates/_consts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,11 @@ class SortDict {

final _sortDicts = const <SortDict>[
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',
Expand Down Expand Up @@ -134,7 +127,4 @@ final _sortDicts = const <SortDict>[
),
];

List<SortDict> getSortDicts(bool isSearch) {
final removeId = isSearch ? 'listing_relevance' : 'search_relevance';
return _sortDicts.where((d) => d.id != removeId).toList();
}
List<SortDict> getSortDicts() => _sortDicts;
6 changes: 2 additions & 4 deletions app/lib/frontend/templates/listing.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions app/test/frontend/golden/pkg_index_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -415,12 +415,12 @@ <h3 class="search-form-section-header foldable-button">
packages
</div>
<div class="sort-control hoverable">
<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.">
<div class="info-identifier" title="Packages are sorted by the combination of their overall score and their relevance to matching the search query text.">
Sort by
<button class="sort-control-selected">search relevance</button>
<button class="sort-control-selected">default ranking</button>
</div>
<div class="sort-control-popup">
<button class="sort-control-option selected" data-value="search_relevance">search relevance</button>
<button class="sort-control-option selected" data-value="default_ranking">default ranking</button>
<button class="sort-control-option" data-value="top">overall score</button>
<button class="sort-control-option" data-value="updated">recently updated</button>
<button class="sort-control-option" data-value="created">newest package</button>
Expand Down
6 changes: 3 additions & 3 deletions app/test/frontend/golden/publisher_packages_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,12 @@ <h1 class="title pub-monochrome-icon-hoverable">example.com</h1>
<code>example.com</code>
</div>
<div class="sort-control hoverable">
<div class="info-identifier" title="Packages are sorted by the combination of their overall score and their specificity to the selected platform.">
<div class="info-identifier" title="Packages are sorted by the combination of their overall score and their relevance to matching the search query text.">
Sort by
<button class="sort-control-selected">listing relevance</button>
<button class="sort-control-selected">default ranking</button>
</div>
<div class="sort-control-popup">
<button class="sort-control-option selected" data-value="listing_relevance">listing relevance</button>
<button class="sort-control-option selected" data-value="default_ranking">default ranking</button>
<button class="sort-control-option" data-value="top">overall score</button>
<button class="sort-control-option" data-value="updated">recently updated</button>
<button class="sort-control-option" data-value="created">newest package</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,12 @@ <h1 class="title pub-monochrome-icon-hoverable">example.com</h1>
<code>example.com</code>
</div>
<div class="sort-control hoverable">
<div class="info-identifier" title="Packages are sorted by the combination of their overall score and their specificity to the selected platform.">
<div class="info-identifier" title="Packages are sorted by the combination of their overall score and their relevance to matching the search query text.">
Sort by
<button class="sort-control-selected">listing relevance</button>
<button class="sort-control-selected">default ranking</button>
</div>
<div class="sort-control-popup">
<button class="sort-control-option selected" data-value="listing_relevance">listing relevance</button>
<button class="sort-control-option selected" data-value="default_ranking">default ranking</button>
<button class="sort-control-option" data-value="top">overall score</button>
<button class="sort-control-option" data-value="updated">recently updated</button>
<button class="sort-control-option" data-value="created">newest package</button>
Expand Down
2 changes: 1 addition & 1 deletion app/test/frontend/golden/search_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ <h3 class="search-form-section-header foldable-button">
<button class="sort-control-selected">overall score</button>
</div>
<div class="sort-control-popup">
<button class="sort-control-option" data-value="search_relevance">search relevance</button>
<button class="sort-control-option" data-value="default_ranking">default ranking</button>
<button class="sort-control-option selected" data-value="top">overall score</button>
<button class="sort-control-option" data-value="updated">recently updated</button>
<button class="sort-control-option" data-value="created">newest package</button>
Expand Down