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 <pikachuexe@gmail.com>

* fix replacing channelName

Co-authored-by: PikachuEXE <pikachuexe@gmail.com>
This commit is contained in:
ChunkyProgrammer 2021-11-05 22:11:21 -04:00 committed by GitHub
parent 9bf4742cf9
commit e61c11a7ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 42 additions and 2 deletions

View File

@ -46,6 +46,11 @@
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.commentOwner {
background-color: var(--scrollbar-color);
border-radius: 10px;
padding: 0 10px;
}
.commentAuthor { .commentAuthor {
cursor: pointer; cursor: pointer;
@ -58,6 +63,14 @@
margin-left: 70px; margin-left: 70px;
word-wrap: break-word; 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 { .commentDate {
font-weight: normal; font-weight: normal;

View File

@ -20,6 +20,10 @@ export default Vue.extend({
type: String, type: String,
required: true required: true
}, },
channelName: {
type: String,
required: true
},
channelThumbnail: { channelThumbnail: {
type: String, type: String,
required: true required: true
@ -298,6 +302,7 @@ export default Vue.extend({
} }
comment.text = autolinker.link(comment.content.replace(/(<(?!br>)([^>]+)>)/ig, '')) comment.text = autolinker.link(comment.content.replace(/(<(?!br>)([^>]+)>)/ig, ''))
comment.dataType = 'invidious' comment.dataType = 'invidious'
comment.isOwner = comment.authorIsChannelOwner
if (typeof (comment.replies) !== 'undefined' && typeof (comment.replies.replyCount) !== 'undefined') { if (typeof (comment.replies) !== 'undefined' && typeof (comment.replies.replyCount) !== 'undefined') {
comment.numReplies = comment.replies.replyCount comment.numReplies = comment.replies.replyCount

View File

@ -47,11 +47,23 @@
class="commentThumbnail" class="commentThumbnail"
@click="goToChannel(comment.authorLink)" @click="goToChannel(comment.authorLink)"
> >
<p
v-if="comment.isPinned"
class="commentPinned"
>
<font-awesome-icon
icon="thumbtack"
/>
{{ $t("Comments.Pinned by") }} {{ channelName }}
</p>
<p <p
class="commentAuthorWrapper" class="commentAuthorWrapper"
> >
<span <span
class="commentAuthor" class="commentAuthor"
:class="{
commentOwner: comment.isOwner
}"
@click="goToChannel(comment.authorLink)" @click="goToChannel(comment.authorLink)"
> >
{{ comment.author }} {{ comment.author }}
@ -97,6 +109,8 @@
{{ comment.numReplies }} {{ comment.numReplies }}
<span v-if="comment.numReplies === 1">{{ $t("Comments.Reply").toLowerCase() }}</span> <span v-if="comment.numReplies === 1">{{ $t("Comments.Reply").toLowerCase() }}</span>
<span v-else>{{ $t("Comments.Replies").toLowerCase() }}</span> <span v-else>{{ $t("Comments.Replies").toLowerCase() }}</span>
<span v-if="comment.hasOwnerReplied && !comment.showReplies"> {{ $t("Comments.From $channelName").replace("$channelName", channelName) }}</span>
<span v-if="comment.numReplies > 1 && comment.hasOwnerReplied && !comment.showReplies">{{ $t("Comments.And others") }}</span>
</span> </span>
</p> </p>
<div <div
@ -115,6 +129,9 @@
<p class="commentAuthorWrapper"> <p class="commentAuthorWrapper">
<span <span
class="commentAuthor" class="commentAuthor"
:class="{
commentOwner: reply.isOwner
}"
@click="goToChannel(reply.authorLink)" @click="goToChannel(reply.authorLink)"
> >
{{ reply.author }} {{ reply.author }}

View File

@ -50,7 +50,7 @@
v-if="upcomingTimestamp !== null" v-if="upcomingTimestamp !== null"
class="premiereText" class="premiereText"
> >
Premieres on: {{ $t("Video.Premieres on") }}:
<br> <br>
{{ upcomingTimestamp }} {{ upcomingTimestamp }}
</p> </p>
@ -110,6 +110,7 @@
class="watchVideo" class="watchVideo"
:class="{ theatreWatchVideo: useTheatreMode }" :class="{ theatreWatchVideo: useTheatreMode }"
:channel-thumbnail="channelThumbnail" :channel-thumbnail="channelThumbnail"
:channel-name="channelName"
@timestamp-event="changeTimestamp" @timestamp-event="changeTimestamp"
/> />
</div> </div>

View File

@ -459,6 +459,7 @@ Video:
Starting soon, please refresh the page to check again: Starting soon, please refresh Starting soon, please refresh the page to check again: Starting soon, please refresh
the page to check again the page to check again
# As in a Live Video # As in a Live Video
Premieres on: Premieres on
Live: Live Live: Live
Live Now: Live Now Live Now: Live Now
Live Chat: Live Chat Live Chat: Live Chat
@ -602,16 +603,19 @@ Comments:
Sort by: Sort by Sort by: Sort by
Top comments: Top comments Top comments: Top comments
Newest first: Newest First 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 View: View
Hide: Hide Hide: Hide
Replies: Replies Replies: Replies
Show More Replies: Show More Replies Show More Replies: Show More Replies
Reply: Reply Reply: Reply
From $channelName: from $channelName
And others: and others
There are no comments available for this video: There are no comments available There are no comments available for this video: There are no comments available
for this video for this video
Load More Comments: Load More Comments Load More Comments: Load More Comments
No more comments available: No more comments available No more comments available: No more comments available
Pinned by: Pinned by
Up Next: Up Next Up Next: Up Next
#Tooltips #Tooltips