-
-
Notifications
You must be signed in to change notification settings - Fork 225
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
LB-1727: Filters for link listens page #3145
Conversation
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.
The PR Looks good. However you can perform cleanup by using bootstrap classes.
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.
One final change, and we're good to go.
Co-authored-by: Ansh Goyal <[email protected]>
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.
Nice work so far, it's working quite nicely!
I think searching by entity type was the right choice, otherwise it would get quite confusing I think.
Currently missing:
- a button to clear the search (currently emptying the search bar you can't click on the search button)
- another state variable to hold the original unlinkedListensProps, which is what we should use as the searchable list. If you link a track, it is removed from the list of options (see for example in the
openMultiTrackMappingModal
function). We should be able to hold state of the modified list while also beign able to filter it. - a "no results" message to show users
if (!searchQuery) { | ||
setUnlinkedListens(unlinkedListensProps); | ||
return; | ||
} |
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.
Currently I think this code path will never be hit, because the submit button will be disasbled if there are less that X characters.
However that also means we probably need a "clear search" button or a system that will detect char length in the textarea onChange callback, and set the unfiltered list.
Not sure what is the best way to handle this, what are your thoughts? clear search button, or always-enabled submit button?
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.
The last commit didn't have the below code segment
if (!searchQuery) { setUnlinkedListens(unlinkedListensProps); return; }
So that has been catered to already, a clear search button leading to the unfiltered Link Listens is a must so will make the changes.
I’m a bit confused about the second point you mentioned. From my perspective, if a user filters and then links a track, the next search should display only unlinked listens that are still unlinked. Why should the original list be used as the searchable list, considering it might include tracks that have already been linked? Please let me know if I’m misunderstanding something. |
Ah, well precisely! You understand the issue we would encounter, but that is how the current code behaves. This line in To resolve that issue, I think we need to store a modifiable list separately, originally equal to EDIT: Another issue is that currently, if you filter results, you can't change the search query and do another search, because the initial filtered list is used as the base for filtering the second time. |
Deployed to https://test.listenbrainz.org/settings/link-listens/ for further testing |
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.
LGTM
Problem
LB1727: Filters for link listens page
Solution
FIlter.webm
Filtering functionality added
Action