-
-
Notifications
You must be signed in to change notification settings - Fork 290
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
MBS-12205: Add "play on ListenBrainz" button #2636
Conversation
Yes, I do agree we should reconstruct a playlist based on a collection from the database directly. I also think the tags and genres pages would be good candidates for a similar mechanism (reconstruct a playlist by fetching recordings with tag = x) |
@Aerozol: if you have some time to look into this, I'd be grateful - I'm not super convinced by the position of the button on stuff without cover art (so, the recording example above, or even just releases/RGs without any art). |
@reosarevok Hmm, the placement seems fine to me, if we really want to make it stand out (since nothing else gets such a big button, and right at the top!) Or even just go with the play button, since I don’t think where it gets played is much of a factor (until LB gets known). Just not sure about there being no signposting that it links to a new site: |
Yeah, my worry was that it seemed a bit too overpowering :) But it might be fine. |
Keep in mind this is also in recording, RG and some collection pages :) I guess whatever we pick should be consistent among those, ideally |
17f2629
to
97da20a
Compare
root/collection/CollectionIndex.js
Outdated
// $FlowIssue (both incompatible-type and prop-missing, sigh) | ||
? entities.map((entity: RecordingT) => entity.gid) |
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.
Nitpick: the incompatible-type isn't really a Flow issue, since it has no way of knowing these are recordings. I'm not sure why it's giving prop-missing there, that does seem like a Flow issue. But I was able to work around both by casting the list to $ReadOnlyArray<CoreEntityT>
first:
// $FlowIssue (both incompatible-type and prop-missing, sigh) | |
? entities.map((entity: RecordingT) => entity.gid) | |
? (entities: $ReadOnlyArray<CoreEntityT>).map(entity => entity.gid) |
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.
I don’t mind either way for now because it’s just a global issue in MBS JS code.
Just as a side-note: CoreEntityT
is overused in general. It is better than using any
but still. This is one of the main issues I encountered while working on #2732 the 4 first commits of which are just about replacing a few unneeded CoreEntityTypeT
occurrences. There are 300+ occurrences in the JS code, there are good chances that many of these are not fine-grained enough, later on generating the kind of Flow issue that you have here.
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.
But it already knows that entities: $ReadOnlyArray<T>
and T: CoreEntityT
- as such, it should know these have gids. In any case, casting to CoreEntityT
again seems like a hack. What would be ideal is for Flow to understand that if we know collectionEntityType
is 'recording'
then we also know that entities
is $ReadOnlyArray<RecordingT>
, but I'm guessing with the way we're doing this now, we can't just use the https://flow.org/en/docs/types/unions/#toc-disjoint-object-unions thing since hardcoding the collectionEntityType
directly for all, but typing it as T['entityType']
. I guess this might work better if the type was a proper union instead?
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.
Actually yeah, I missed that props
is a disjoint object union, so we could use that:
const recordingMbids = props.collectionEntityType === 'recording' && props.entities.length > 0
? props.entities.map(entity => entity.gid)
: null;
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.
I had to change the type declaration a bit, but now it's happy (we can squash on merge as needed).
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 code (typing apart) looks good 👍 but the commit message is very incomplete.
I did successfully test it locally 👍 using the production standby database and visiting some random pages as no example is given in PR’s description.
There is no request to ListenBrainz so no overhead 👍 however ListenBrainz might not be able to play it as user would expect it from the button’s label. Not a showstopper, just to be known and documented.
The placement is very nice 👍 as it clearly and very visibly promotes ListenBrainz without getting into the way.
The icon has not been changed despite @Aerozol’s comment. Probably not a showstopper either, it can be changed later on if there is some hurry about this ticket.
In reply to @Aerozol’s and @MonkeyDo’s comments on placement and community acceptance: I don’t think that there could be any community backslash about it since the link is clearly labeled and put in the sidebar where prominent external links (including CritiqueBrainz) are expected. The current placement (prominently at the top just under the cover art) is very relevant as it is a top-notch MeB project. It seems to be a good balance. Good work! However it’s always useful to communicate more about it with the community if you want this new feature to be noticed at the very least. |
Since the intent of the whole thing is, let's be honest, more promoting LB than giving a place to play music (both, but in that order), I think the logo probably makes sense? Although I'm fine with changing it to a play button if we prefer a bit later on :) |
88f8ecf
to
707bb45
Compare
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.
Thanks for having improved the commit message. 🚢
Please check with @bitmap about the Flow suggestion he made. Whether your change is enough or if it should be changed later on in master
branch. (It doesn’t make a difference for now in production
.)
In reply to @Aerozol about the icon: As mentioned in a later discussion on #metabrainz, the added button is more about promoting LB than promising that it will play anything. So using the logo makes sense. The button’s label is a trick but I don’t have any better suggestion. |
@brainzbot, please retest it. |
@yvanzo re. promoting LB, the icon doesn’t invite people to click the button - the play button does, so I think that would ‘promote’ LB more. |
@Aerozol I think I'd feel a bit bad making it a play button because I feel that would make it even more frustrating if they click and they cannot actually play anything :/ |
This mostly copies the functionality of the existing script (https://gist.github.com/MonkeyDo/6b919302e97dc979f8277b9c71ff82ab). It shows a "Play on ListenBrainz" button on the right side of releases, recordings, recording collections and release groups that sends the user to play the release or a custom grouping of recordings with BrainzPlayer. It only shows on overview pages for recording collections and RGs, but that's also true of the script so hopefully not a problem. Ideally, LB would support passing an RG or collection MBID directly. Keep in mind this doesn't hit LB and doesn't know whether LB can actually play the music (I'm not sure even hitting LB would help since LB might also not know until it tries).
b620668
to
314e3f2
Compare
@reosarevok but… it says ‘Play on ListenBrainz’? Regardless thanks for putting this in, great feature! |
I know, I know. But having the play icon and the word Play seems like it's stronger? Dunno. We can change it in January if you prefer, no worries :) (although to be fair, the play button is also new for MB itself :) ) |
@Aerozol wrote:
ListenBrainz's icon is added just like other external websites' icons have been added before. @Aerozol wrote:
As mentioned in a previous comment which links to IRC, this button is more about promoting ListenBrainz than necessarily playing something. We can come with a more accurate (but still incentive) label such as “Check it out on ListenBrainz”. ListenBrainz should also more gracefully handle when it fails at playing anything. |
@yvanzo The button format is quite different to the format of the other external links - can you explain why it’s helpful to have the LB icon there? Personally I don’t think more noise and imagery makes it easier for people to navigate/understand our already-messy sidebar. I wouldn’t change the name from ‘Play on ListenBrainz’, that’s currently the primary function even if it doesn’t always work. |
* beta: Block :// in usernames MBS-12827: Run our sanitize function on new usernames MBS-12693: Select relationship type before target (#2800) MBS-12709: Do not copy series part number with "Add another [entity]" (#2798) MBS-12820: Add default label for attribute multiselects (#2799) MBS-12809: Pass minimal existing data for Historic/RemoveDiscID (#2792) MBS-12817: Fix selector for relationship dialog warnings (#2795) MBS-12787: Editing a relationship to add instruments causes duplication (#2797) MBS-12737: Properly check backwardness with isRelationshipBackward (#2796) Fix building CSS in production Docker images (#2623) Update POT files using the production database Update translations from Transifex MBS-12205: Add "play on ListenBrainz" button MBS-12205: Add "play on ListenBrainz" button (#2636)
Implement MBS-12205
As requested, this mostly copies the functionality of the existing script (https://gist.github.com/MonkeyDo/6b919302e97dc979f8277b9c71ff82ab). It only shows on overview pages for collections and RGs, but that's also true of the script so hopefully not a problem. Ideally, LB would support passing an RG or collection MBID directly.
Examples: