Skip to content
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-1281: Link all listens from the same album #2956

Merged
merged 50 commits into from
Aug 22, 2024

Conversation

MonkeyDo
Copy link
Contributor

@MonkeyDo MonkeyDo commented Aug 7, 2024

The "Missing data" page that shows a user their unmatched listens has been somewhat useful, but linking each track from an album separately is a nightmare, especially for big various artist compilations for example.

This PR does two things to solve this:

  • Group listens by their shared release_name property, and display them in an accordion component
  • Add a new multi-track mapping modal allowing you to search or paste in a release or RG, and a fuzzy search-based automatic detection to match listens to the right recording
    image
    image
    image
    image
    image

I threw these bits of helptext together, would appreciate some feedback and/or rewriting:
multi-modal-helptext-2
For the "include artist name" tickbox:
multi-modal-helptext-1

Follow-up tasks

@MonkeyDo
Copy link
Contributor Author

MonkeyDo commented Aug 8, 2024

The failing server tests are unrelated, and already fixed by #2951

To show unmatched listens grouped by release name
based on common release_name attribute
match all listens we can based on the tracklist of a selected release, using FuseJS to do fuzzy matching .
Submission not working yet
default to closed, but add a boolean prop to default to open.
Fix arrow indicator layout
in the settings/missing-data folder, which makes more sense
Put the button first for a cleaner look, and also reduce its size to fit in the header better
Since I rebased (Class -> functional component) I need to change a few things.
+ a bit of cleanup
while writing tests, ran into a couple of issues, one with the import style for React (import React vs. import * as React).
Also improved accessibility while writing tests
Added these items for extra testing, forgot to commit in previous commit...
@MonkeyDo MonkeyDo force-pushed the rebased-multi-track-mbid-mapping branch from d5d13ba to 5bfaf77 Compare August 8, 2024 15:49
@MonkeyDo MonkeyDo requested a review from anshg1214 August 8, 2024 15:51
@Aerozol
Copy link
Contributor

Aerozol commented Aug 9, 2024

LOVE IT!!
I have nitty-gritty feedback, but overall this is already A+
I'm not married to any of these suggestions, and some may not work in practice. I hope you like mspaint pics!

1. Swap the link and "expand release" buttons
Having the dropdown next to the album name makes it a bit clearer what's being expanded, but mainly this will match up with where the link button lives for individual tracks as well (I got a bit confused)
image

2. Clicking the link button should not expand the release
It's weird to have a popup + something happening behind the popup. It stays expanded when you close the popup, and when you click the link button a second time it minimizes it behind the popup again. Probably simpler and expected to just let the expand button do the expanding.

3. Release row formatting
I like the track count in the link button, it makes sense, but I wonder if putting it next to the release title would allow you to put something like (11 tracks), which helps communicate to the user that the drop down is a release/collection of listens.
Then you could also use the orange link icon (without the square around it) that's in the track row, which is cleaner looking.
Are we using that panel-title class elsewhere? It's a little tricky to see/thin at that size, could be stronger imo.
image

4. New blurb text
I don't think the blurb at the top needs any of the new information re. "tracks are grouped by album..." - if anyone disagrees, maybe in one of those (i) rollovers? This is a case where the UI is pretty basic and the page performs a clear function (the process becomes confusing if someone has to add something to MB, but that is a whole other kettle of fish), having a bunch of text at the top makes it more confusing and complicated feeling than it actually is. Have faith in your lovely UI monkey!

5. Old blurb text/suggestion
Is "This page shows your top 200 submitted tracks..." still accurate? If so, it might get a bit confusing when a user thinks they have matched all the tracks from an album, but they have only matched the tracks that were in their top 200. But maybe that's a problem for another day.
While I'm here, this would be my suggestion for a blurb edit:

Your top 200 listens that haven't been automatically linked. Link the listens below, or to submit new data to MusicBrainz.

MusicBrainz is the open-source music encyclopedia that ListenBrainz uses to display information about your music.

If we want to keep a link like "Add missing data to MusicBrainz" I think it would better fit in the blurb in the following note 6. where the user will be facing the issue to be solved (not finding a match in the search box).

6. Link popup title
"Link these Listens with MusicBrainz" could be simplified to "Link listens" imo.
If someone non-tech doesn't know what MusicBrainz is, they don't need to worry about it until they want to/need to add data, they don't have to be told up top what's happening in the background.
Also applies to matching single listen/song

7. Link popup blurb
Again, the UI is pretty good, but the text makes it look like we expect users to struggle/implies that it is confusing. Can we move all of the text at the top underneath the 'add mapping' button, maybe all in a light grey and in small text?
"Include Artist name when matching" doesn't have to be bold imo - it's the strongest thing on the page. There is a bit of spacing issue with that text and the checkbox next to it, maybe could use some extra above as well.
image
Again, while I'm at it I would shorten the top blurb to (particularly if you want to leave it at the top):

Search by album/artist name or paste a MusicBrainz URL or MBID.

Also applies to matching single listen/song

8. Link popup: Listens to match section
Change "match" to "link"?

9. Link popup: Add mapping button
Do we use the word "mapping" anywhere else? Can we change it to "link listens" (or similar)?
Also applies to matching single listen/song

10. Mobile
Looks good.

Sorry for the long list, hope it's helpful!

Copy link
Member

@anshg1214 anshg1214 left a 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 overall. A few changes.

@lazybookwyrm
Copy link

When you click the link button, the search field autofills with "album artist". Changing that to "album - artist" is giving me better search results on some releases.

@kellnerd
Copy link
Contributor

For what it's worth, grouping the words of the artist name gives even better results:
Play artist:(Great Big Sea) for example returns less releases which match the terms "Big" and "Sea".
You may also want to look into escaping special characters.

@MonkeyDo
Copy link
Contributor Author

MonkeyDo commented Aug 13, 2024

For what it's worth, grouping the words of the artist name gives even better results: Play artist:(Great Big Sea) for example returns less releases which match the terms "Big" and "Sea". You may also want to look into escaping special characters.

Thanks for the tip! I did add the grouping.
As for escaping special lucene characters, I spent a bit of time to regexp but realized the input is most likely sanitized and escaped on the MB side, which makes sense, because I can search even using only special characters:
image
image

Copy link
Member

@anshg1214 anshg1214 left a 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. Just some final changes.

@MonkeyDo
Copy link
Contributor Author

MonkeyDo commented Aug 13, 2024

Thanks for the tip! I did add the grouping. As for escaping special lucene characters, I spent a bit of time to regexp but realized the input is most likely sanitized and escaped on the MB side, which makes sense, because I can search even using only special characters:

Meh, actually for special-punctuation-only bands, we would need to escape the characters to get a good result:
artist:(\!\!\!) correctly returns albums by the band !!! while artist:(!!!) returns zero results by itself.

I feel that we need to make a decision, but none are optimal considering the vague data we are working with (sometimes the metadata is good, sometimes trash).
Escaping special characters makes the search input a lot less readable/modifyable, and admitedly cases such as !!! are a rarity.

All right then, I guess we need another tickbox option to escape the search input!

Allow searching with and without the artist name, and also escaping special characters from the Lucene search string (allows matching special cases)
We don't need to react to the 'page' searchparam anymore, and instead we load all of the data in one go, then parse it for internal pagination.

Decoupling loader data and search params means we don't re-fetch data pueposelessly when "changing page"
pass only the function we need from the APIService rather than the whole thing.
Remove style from list of tracks, but make the toasts themselves clear
Expected a number, but it's a string representation
Base automatically changed from brainzplayer-spa to master August 13, 2024 15:15
@Aerozol
Copy link
Contributor

Aerozol commented Aug 21, 2024

Gave this another test spin today, to link up some listens and have some more minor notes:

  1. Can't link listens when the search bar is empty, even when the matches are already found
    image

  2. The search bar gives no indication when it is searching/working, meaning that when you are adjusting text or typing into the search field it can be unclear whether it is still loading results, or there are no improved results to show.

Change from form+onSubmit to button+onClick, because the search inpur has a required attribute preventing the form submission
@MonkeyDo
Copy link
Contributor Author

Freshly deployed to test.LB

OK, going to stop work here for this PR, before I continue adding more features :D

It works really well from my testing, and I have implemented all the feedback as far as I know.

Thanks everyone for your help in testing and for your suggestions !

Using the wrong variable after a copy-paste
Copy link
Member

@anshg1214 anshg1214 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR looks much better. Just two final change change and we're good to go 🚀

Comment on lines 72 to 81
const closeModal = React.useCallback(() => {
modal.hide();
document?.body?.classList?.remove("modal-open");
// Need to manually remove the modal backdrop
const backdrop = document?.body?.getElementsByClassName(
"modal-backdrop"
)?.[0];
backdrop?.parentElement?.removeChild(backdrop);
setTimeout(modal.remove, 200);
}, [modal]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now if you close the modal by clicking on the backdrop and open another one, the states are not reset. I can still see the matches from the previous album. So we probably need to reset the states here.

Copy link
Contributor Author

@MonkeyDo MonkeyDo Aug 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I can fix that issue unfortunately.
Basically, I've been putting off replacing Bootstrap4 that we have with react-bootstrap, and replace all the modals to work better with nice-modal-react.
Clicking on the backdrop does trigger the bootstrap JS code to hide the modal, but does not trigger any of the code in the modal component so i can't run code to cleanup.
Potential solutions are very hacky and ugly, and I'd rather not.

I tried listening to the 'hidden' event as described in https://getbootstrap.com/docs/4.0/components/modal/#events but to no avail.

Let's live with this failure mode until we use react-bootstrap.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Cool! We'll deploy this for now, and revisit it later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, another big refactoring job :)

But at least we'll be able to get rid of jQuery that we still load for those stupid Bootstrap modals and tooltips and whatnot

If closing modal with clicking on backdrop, modal is not currently reset and get re-opened with old data
@MonkeyDo MonkeyDo merged commit fce8bea into master Aug 22, 2024
4 checks passed
@MonkeyDo MonkeyDo deleted the rebased-multi-track-mbid-mapping branch August 22, 2024 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants