0
0
Fork 0
mirror of https://github.com/VueTubeApp/VueTube synced 2024-11-09 04:55:07 +00:00
VueTube/NUXT/components/Comments/commentThreadRenderer.vue

202 lines
5 KiB
Vue
Raw Normal View History

2022-04-19 14:03:46 +00:00
<template>
<div class="comment-thread" v-if="commentRenderer">
<a
:href="
this.$rendererUtils.getNavigationEndpoints(
commentRenderer.authorEndpoint
)
"
class="avatar-link"
>
<v-img
class="avatar-thumbnail"
:src="
commentRenderer.authorThumbnail.thumbnails[
commentRenderer.authorThumbnail.thumbnails.length - 1
].url
"
/>
</a>
<div class="comment-content">
<div class="comment-content--header subtitle-2">
2022-04-21 10:51:49 +00:00
<div
class="author-badge-name mr-1"
:class="{ owner: commentRenderer.authorIsChannelOwner }"
>
<div class="author-name--wrapper">
<span class="font-weight-bold author-name" v-emoji>
{{ commentRenderer.authorText.simpleText }}
</span>
</div>
<template
v-for="(badge, index) in commentRenderer.authorCommentBadge"
>
<author-comment-badge-renderer
:metadata="badge"
:key="index"
class="ml-1"
/>
</template>
<template
v-for="(badge, index) in commentRenderer.sponsorCommentBadge"
>
<sponsor-comment-badge-renderer
:metadata="badge"
:key="index"
class="ml-1"
/>
</template>
</div>
2022-04-19 14:03:46 +00:00
<span
:class="$vuetify.theme.dark ? 'text--lighten-4' : 'text--darken-4'"
class="background--text comment-timestamp"
2022-04-19 14:03:46 +00:00
>
{{ commentRenderer.publishedTimeText.runs[0].text }}
</span>
</div>
<collapsable-text
:lines="4"
:expandText="
commentRenderer.expandButton.buttonRenderer.text.runs[0].text
"
:collapseText="
commentRenderer.collapseButton.buttonRenderer.text.runs[0].text
"
>
<yt-text-formatter :textRuns="commentRenderer.contentText.runs">
</yt-text-formatter>
</collapsable-text>
2022-04-22 04:38:21 +00:00
<div class="toolbar">
<v-btn-toggle v-model="voteStatus" group>
<div class="toolbar--item">
<v-btn class="toolbar--button like" disabled icon x-small plain>
<v-icon small>mdi-thumb-up</v-icon>
</v-btn>
<span
v-if="commentRenderer.voteCount"
v-text="commentRenderer.voteCount.simpleText"
class="like-count mr-1 subtitle-2"
></span>
</div>
<div class="toolbar--item">
<v-btn class="toolbar--button dislike" disabled icon x-small plain>
<v-icon small>mdi-thumb-down</v-icon>
</v-btn>
</div>
</v-btn-toggle>
2022-04-22 04:38:21 +00:00
<div class="toolbar--item">
<v-btn class="toolbar--button reply ml-2" disabled icon x-small plain>
<v-icon small>mdi-comment</v-icon>
2022-04-22 04:38:21 +00:00
</v-btn>
</div>
<div class="toolbar--item" v-if="commentRenderer.replyCount">
2022-04-22 04:38:21 +00:00
<span
v-text="commentRenderer.replyCount"
2022-04-22 04:38:21 +00:00
class="like-count mr-1 subtitle-2"
></span>
</div>
</div>
2022-04-19 14:03:46 +00:00
</div>
</div>
</template>
<style scoped lang="scss">
2022-04-19 14:03:46 +00:00
.entry {
width: 100%; /* Prevent Loading Weirdness */
}
.comment-thread {
display: flex;
flex-direction: row;
flex-basis: auto;
width: 100%;
padding: 10px 0;
2022-04-19 14:03:46 +00:00
.avatar-thumbnail {
margin-right: 0.5rem;
border-radius: 50%;
width: 48px;
height: 48px;
}
2022-04-19 14:03:46 +00:00
.comment-content {
min-width: 0;
display: flex;
flex-direction: column;
flex-basis: auto;
flex-grow: 1;
.comment-content--header {
display: flex;
align-items: baseline;
.comment-timestamp {
white-space: nowrap;
}
}
}
2022-04-19 14:03:46 +00:00
}
2022-04-22 04:38:21 +00:00
.toolbar {
display: flex;
flex-direction: row;
align-items: center;
}
.author-badge-name {
display: flex;
flex-direction: row;
2022-04-21 10:51:49 +00:00
min-width: 0;
.author-name--wrapper {
min-width: 0;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
}
2022-04-21 10:51:49 +00:00
.owner {
padding: 0 0.6em;
background-color: #888888;
color: #fff;
border-radius: 1em;
&::v-deep .author-badge {
color: #fff;
}
}
.toolbar--button::v-deep.v-btn--active .v-btn__content {
color: var(--v-primary-base);
}
2022-04-19 14:03:46 +00:00
</style>
<script>
import collapsableText from "~/components/UtilRenderers/collapsableText.vue";
import YtTextFormatter from "~/components/UtilRenderers/YtTextFormatter.vue";
import AuthorCommentBadgeRenderer from "~/components/Comments/authorCommentBadgeRenderer.vue";
import SponsorCommentBadgeRenderer from "~/components/Comments/sponsorCommentBadgeRenderer.vue";
2022-04-19 14:03:46 +00:00
export default {
components: {
collapsableText,
YtTextFormatter,
AuthorCommentBadgeRenderer,
SponsorCommentBadgeRenderer,
},
2022-04-19 14:03:46 +00:00
props: ["comment"],
data() {
return {
commentRenderer: null,
voteStatus: null,
2022-04-19 14:03:46 +00:00
};
},
mounted() {
this.commentRenderer = this.comment?.comment?.commentRenderer;
},
};
</script>