Merge pull request #976 from antonnyst/asloaded

Add 'as loaded' sort ordering
This commit is contained in:
James Barnsley
2025-05-02 12:53:58 +12:00
committed by GitHub
2 changed files with 8 additions and 5 deletions

View File

@ -26,11 +26,13 @@ const SearchResults = ({
const encodedTerm = encodeURIComponent(term);
let results = [...rawResults];
results = sortItems(
results,
(type === 'tracks' && sortField === 'followers' ? 'popularity' : sortField),
sortReverse,
);
if (sortField) {
results = sortItems(
results,
(type === 'tracks' && sortField === 'followers' ? 'popularity' : sortField),
sortReverse,
);
}
const resultsCount = results.length;
if (all && type !== 'tracks' && results.length > 5) {

View File

@ -70,6 +70,7 @@ const Search = () => {
}
const sortOptions = [
{ value: null, label: i18n('fields.filters.as_loaded') },
{ value: 'name', label: i18n('common.name') },
{ value: 'uri', label: i18n('fields.filters.source') },
{ value: 'followers', label: i18n('common.popularity') },