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); const encodedTerm = encodeURIComponent(term);
let results = [...rawResults]; let results = [...rawResults];
results = sortItems( if (sortField) {
results, results = sortItems(
(type === 'tracks' && sortField === 'followers' ? 'popularity' : sortField), results,
sortReverse, (type === 'tracks' && sortField === 'followers' ? 'popularity' : sortField),
); sortReverse,
);
}
const resultsCount = results.length; const resultsCount = results.length;
if (all && type !== 'tracks' && results.length > 5) { if (all && type !== 'tracks' && results.length > 5) {

View File

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