From e61c11a7ef4e8e53ed1b08ff8307c61b06566406 Mon Sep 17 00:00:00 2001 From: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com> Date: Fri, 5 Nov 2021 22:11:21 -0400 Subject: [PATCH] Feature: Add pinned, owner and reply from owner indicators for comments (#1795) * Add pinned, owner and reply from owner indicators * fix locale * show owner for invidious * add margin to pinned indicator * show owner indicator for replies * don't show "from owner and others" on hide * Pass variable into translated string Co-authored-by: PikachuEXE * fix replacing channelName Co-authored-by: PikachuEXE --- .../watch-video-comments.css | 13 +++++++++++++ .../watch-video-comments.js | 5 +++++ .../watch-video-comments.vue | 17 +++++++++++++++++ src/renderer/views/Watch/Watch.vue | 3 ++- static/locales/en-US.yaml | 6 +++++- 5 files changed, 42 insertions(+), 2 deletions(-) diff --git a/src/renderer/components/watch-video-comments/watch-video-comments.css b/src/renderer/components/watch-video-comments/watch-video-comments.css index bf6f637f..2d5a8f0a 100644 --- a/src/renderer/components/watch-video-comments/watch-video-comments.css +++ b/src/renderer/components/watch-video-comments/watch-video-comments.css @@ -46,6 +46,11 @@ text-overflow: ellipsis; } +.commentOwner { + background-color: var(--scrollbar-color); + border-radius: 10px; + padding: 0 10px; +} .commentAuthor { cursor: pointer; @@ -58,6 +63,14 @@ margin-left: 70px; word-wrap: break-word; } +.commentPinned { + font-weight: normal; + font-size: 12px; + margin-block-end: 0; + margin-block-start: 0; + margin-left: 68px; + margin-bottom: 5px; +} .commentDate { font-weight: normal; diff --git a/src/renderer/components/watch-video-comments/watch-video-comments.js b/src/renderer/components/watch-video-comments/watch-video-comments.js index b1d85968..49101feb 100644 --- a/src/renderer/components/watch-video-comments/watch-video-comments.js +++ b/src/renderer/components/watch-video-comments/watch-video-comments.js @@ -20,6 +20,10 @@ export default Vue.extend({ type: String, required: true }, + channelName: { + type: String, + required: true + }, channelThumbnail: { type: String, required: true @@ -298,6 +302,7 @@ export default Vue.extend({ } comment.text = autolinker.link(comment.content.replace(/(<(?!br>)([^>]+)>)/ig, '')) comment.dataType = 'invidious' + comment.isOwner = comment.authorIsChannelOwner if (typeof (comment.replies) !== 'undefined' && typeof (comment.replies.replyCount) !== 'undefined') { comment.numReplies = comment.replies.replyCount diff --git a/src/renderer/components/watch-video-comments/watch-video-comments.vue b/src/renderer/components/watch-video-comments/watch-video-comments.vue index 358e2c9d..5a05e76f 100644 --- a/src/renderer/components/watch-video-comments/watch-video-comments.vue +++ b/src/renderer/components/watch-video-comments/watch-video-comments.vue @@ -47,11 +47,23 @@ class="commentThumbnail" @click="goToChannel(comment.authorLink)" > +

+ + {{ $t("Comments.Pinned by") }} {{ channelName }} +

{{ comment.author }} @@ -97,6 +109,8 @@ {{ comment.numReplies }} {{ $t("Comments.Reply").toLowerCase() }} {{ $t("Comments.Replies").toLowerCase() }} + {{ $t("Comments.From $channelName").replace("$channelName", channelName) }} + {{ $t("Comments.And others") }}

{{ reply.author }} diff --git a/src/renderer/views/Watch/Watch.vue b/src/renderer/views/Watch/Watch.vue index 18a37de3..91b4679b 100644 --- a/src/renderer/views/Watch/Watch.vue +++ b/src/renderer/views/Watch/Watch.vue @@ -50,7 +50,7 @@ v-if="upcomingTimestamp !== null" class="premiereText" > - Premieres on: + {{ $t("Video.Premieres on") }}:
{{ upcomingTimestamp }}

@@ -110,6 +110,7 @@ class="watchVideo" :class="{ theatreWatchVideo: useTheatreMode }" :channel-thumbnail="channelThumbnail" + :channel-name="channelName" @timestamp-event="changeTimestamp" />
diff --git a/static/locales/en-US.yaml b/static/locales/en-US.yaml index 6b8aae3e..0e9af49c 100644 --- a/static/locales/en-US.yaml +++ b/static/locales/en-US.yaml @@ -459,6 +459,7 @@ Video: Starting soon, please refresh the page to check again: Starting soon, please refresh the page to check again # As in a Live Video + Premieres on: Premieres on Live: Live Live Now: Live Now Live Chat: Live Chat @@ -602,16 +603,19 @@ Comments: Sort by: Sort by Top comments: Top comments Newest first: Newest First - # Context: View 10 Replies, View 1 Reply + # Context: View 10 Replies, View 1 Reply, View 1 Reply from Owner, View 2 Replies from Owner and others View: View Hide: Hide Replies: Replies Show More Replies: Show More Replies Reply: Reply + From $channelName: from $channelName + And others: and others There are no comments available for this video: There are no comments available for this video Load More Comments: Load More Comments No more comments available: No more comments available + Pinned by: Pinned by Up Next: Up Next #Tooltips