Skip to content

Commit 0d836ab

Browse files
Add Unlisted badge on watch page for unlisted videos (#5856)
* Add badge to watch page indicating whether video is unlisted (#1475) * minor updates to unlistedBadge CSS use pixels instead of rems for font-size remove line-height use non-fractional font-size value add vertical padding
1 parent f0c7ace commit 0d836ab

File tree

6 files changed

+26
-0
lines changed

6 files changed

+26
-0
lines changed

src/renderer/components/watch-video-info/watch-video-info.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ export default defineComponent({
106106
inUserPlaylist: {
107107
type: Boolean,
108108
required: true
109+
},
110+
isUnlisted: {
111+
type: Boolean,
112+
required: false
109113
}
110114
},
111115
emits: ['change-format', 'pause-player', 'set-info-area-sticky', 'scroll-to-info-area'],

src/renderer/components/watch-video-info/watch-video-info.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@
2222
gap: 10px;
2323
}
2424

25+
.unlistedBadge {
26+
background-color: var(--secondary-card-bg-color);
27+
border-radius: 5px;
28+
display: inline;
29+
padding-inline: 5px;
30+
padding-block: 2px;
31+
white-space: nowrap;
32+
font-size: 13px;
33+
font-weight: 500;
34+
}
35+
2536
.videoButtons {
2637
.profileRow {
2738
display: flex;

src/renderer/components/watch-video-info/watch-video-info.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
>
77
{{ title }}
88
</h1>
9+
<div
10+
v-if="isUnlisted"
11+
class="unlistedBadge"
12+
>
13+
{{ $t('Video.Unlisted') }}
14+
</div>
915
</div>
1016
<div class="videoMetrics">
1117
<div class="datePublishedAndViewCount">

src/renderer/views/Watch/Watch.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export default defineComponent({
7676
isLiveContent: false,
7777
isUpcoming: false,
7878
isPostLiveDvr: false,
79+
isUnlisted: false,
7980
upcomingTimestamp: null,
8081
upcomingTimeLeft: null,
8182
/** @type {'dash' | 'audio' | 'legacy'} */
@@ -438,6 +439,7 @@ export default defineComponent({
438439
this.isUpcoming = !!result.basic_info.is_upcoming
439440
this.isLiveContent = !!result.basic_info.is_live_content
440441
this.isPostLiveDvr = !!result.basic_info.is_post_live_dvr
442+
this.isUnlisted = !!result.basic_info.is_unlisted
441443

442444
const subCount = !result.secondary_info.owner.subscriber_count.isEmpty() ? parseLocalSubscriberCount(result.secondary_info.owner.subscriber_count.text) : NaN
443445

@@ -761,6 +763,7 @@ export default defineComponent({
761763
this.isLive = result.liveNow
762764
this.isFamilyFriendly = result.isFamilyFriendly
763765
this.isPostLiveDvr = !!result.isPostLiveDvr
766+
this.isUnlisted = !result.isListed
764767

765768
this.captions = result.captions.map(caption => {
766769
return {

src/renderer/views/Watch/Watch.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
<watch-video-info
118118
v-if="!isLoading"
119119
:id="videoId"
120+
:is-unlisted="isUnlisted"
120121
:title="videoTitle"
121122
:channel-id="channelId"
122123
:channel-name="channelName"

static/locales/en-US.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,7 @@ Video:
800800
Premieres on: Premieres on
801801
Premieres: Premieres
802802
Upcoming: Upcoming
803+
Unlisted: Unlisted
803804
Live: Live
804805
Live Now: Live Now
805806
Live Chat: Live Chat

0 commit comments

Comments
 (0)