-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Implement [YouTube] badge #5132
Conversation
|
Example badge from the review app: @MohamedAliRashad feel free to have a play around :) |
@PyvesB One small detail i want to point also, make sure the view counts adapt to bigger numbers with K and M abbreviations for thousands and millions. |
services/youtube/youtube.service.js
Outdated
static get route() { | ||
return { | ||
base: 'youtube', | ||
pattern: ':statistic(view|like|dislike|comment)/:videoId', |
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.
Could I suggest instead of a dislikes badge, we do a query param variant on the likes badge, that shows both likes and dislikes?
votes | 2.5k up, 100 down
It's a little like the way we do failing tests.
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.
Good idea, will implement sometime this week!
Thanks for the feedback! The icons Shields uses come from simple-icons, though you can override those by specifying the icon data as Base 64 for example. 😉
Yep, that's taken care of with our standard |
Behold the new votes badge variant! https://shields-staging-pr-5132.herokuapp.com/youtube/likes/pU9Q6oiQNd0?logo=youtube&withDislikes |
@PyvesB |
It is: |
@PyvesB |
We tend to be quite careful when it comes to displaying several pieces of information in a single badge. Here I think it's fine to have likes and dislikes at the same time given that they're closely related concepts and the thumbs up/down UTF-8 characters clearly convey the information at a glance. However, I would not be inclined to allow users to add view count, comments channel subscribers or other loosely related information in the same badge, things would become bloated and less legible. |
services/youtube/youtube-base.js
Outdated
} | ||
|
||
static get defaultBadgeData() { | ||
return { label: 'youtube', color: 'red' } |
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.
Thoughts on making this a "social" styled badge, like the Twitter one?
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.
That sounds reasonable to me, especially since we're embedding the link (which AFAIK is something we only do on social badges)
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.
Done!
label: 'votes', | ||
message: `${metric(statistics.likeCount)} 👍 ${metric( | ||
statistics.dislikeCount | ||
)} 👎`, |
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.
Not as part of this PR, but perhaps as a future enhancement (should there be any interest) we could allow users to configure the up/down values like we do for the various test result badges
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.
Agreed, this can be added in the future if users ask for it!
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 haven't been tracking this one too closely, but the code LGTM. Happy to approve if needed (holding off for the moment in case you want to go ahead with changing the category/style)
Fixes #5101.
Four different statistics can be displayed in the badge: view, like, dislike and comment counts.