-
-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add 'as loaded' sort ordering #976
base: master
Are you sure you want to change the base?
Conversation
src/js/locale/en.yaml
Outdated
@@ -353,6 +353,7 @@ search: | |||
more: 'All playlists (%{count})' | |||
tracks: | |||
title: Tracks | |||
asloaded: 'As loaded' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need to create a new translation entry here, duplication of fields.filters.as_loaded
src/js/views/Search.js
Outdated
@@ -75,6 +75,7 @@ const Search = () => { | |||
{ value: 'followers', label: i18n('common.popularity') }, | |||
{ value: 'artist', label: i18n('common.artist') }, | |||
{ value: 'duration', label: i18n('common.duration') }, | |||
{ value: 'asloaded', label: i18n('search.asloaded')} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have a gander at the equivalent syntax for other views, for instance src/js/views/Library/Albums.jsx
.
"As loaded" translates quite literally to "don't sort me!" ie sortOrder: null
:
{
value: null,
label: i18n('fields.filters.as_loaded'),
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that seems like a better way to do it!
src/js/components/SearchResults.js
Outdated
(type === 'tracks' && sortField === 'followers' ? 'popularity' : sortField), | ||
sortReverse, | ||
); | ||
if (sortField !== 'asloaded') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"As loaded" is null
, so we would invert the logic here to if (sortField) { ... then sort
Implemented 'as loaded' search by quite simply not sorting the results.
Resolves #933
I have only tested this with a single source of Spotify, so might be an good idea to test with multiple different sources to make sure it works before merging.