0
0
Fork 0
mirror of https://github.com/VueTubeApp/VueTube synced 2024-11-19 01:35:14 +00:00
VueTube/NUXT/components/Comments/commentThreadRenderer.vue

199 lines
4.9 KiB
Vue
Raw Normal View History

2022-04-19 14:03:46 +00:00
<template>
2022-05-05 03:57:37 +00:00
<div
v-if="commentRenderer"
2022-05-05 05:32:02 +00:00
v-ripple
class="comment-thread px-3"
2022-05-05 03:57:37 +00:00
@click="$emit('showReplies', comment)"
>
2022-05-21 02:01:39 +00:00
<v-btn
fab
text
to="/channel"
class="avatar-link mr-4"
2022-05-29 22:14:00 +00:00
style="height: 35px; width: 35px"
2022-05-21 02:01:39 +00:00
@click.prevent="
$store.dispatch(
'channel/fetchChannel',
$rendererUtils.getNavigationEndpoints(commentRenderer.authorEndpoint)
2022-04-19 14:03:46 +00:00
)
"
>
<v-img
class="avatar-thumbnail"
:src="
commentRenderer.authorThumbnail.thumbnails[
commentRenderer.authorThumbnail.thumbnails.length - 1
].url
"
/>
2022-05-21 02:01:39 +00:00
</v-btn>
2022-04-19 14:03:46 +00:00
<div class="comment-content">
2022-05-21 02:01:39 +00:00
<div
class="comment-content--header background--text"
:class="$vuetify.theme.dark ? 'text--lighten-5' : 'text--darken-4'"
style="font-size: 0.8rem !important"
>
2022-04-21 10:51:49 +00:00
<div
2022-05-21 02:01:39 +00:00
class="author-badge-name mr-2"
:class="
commentRenderer.authorIsChannelOwner
? $vuetify.theme.dark
2022-05-21 02:01:39 +00:00
? 'owner primary--text background lighten-2'
: 'owner primary--text background darken-2'
: ''
"
2022-04-21 10:51:49 +00:00
>
<div class="author-name--wrapper">
2022-05-21 02:01:39 +00:00
<span class="author-name mr-1" v-emoji>
{{ commentRenderer.authorText.simpleText }}
</span>
</div>
<template
v-for="(badge, index) in commentRenderer.authorCommentBadge"
>
<author-comment-badge-renderer :metadata="badge" :key="index" />
</template>
<template
v-for="(badge, index) in commentRenderer.sponsorCommentBadge"
>
<sponsor-comment-badge-renderer :metadata="badge" :key="index" />
</template>
</div>
2022-05-21 02:01:39 +00:00
&middot;
<span class="comment-timestamp ml-2">
2022-04-19 14:03:46 +00:00
{{ commentRenderer.publishedTimeText.runs[0].text }}
</span>
</div>
<collapsable-text
:lines="3"
2022-05-21 02:01:39 +00:00
:expand-text="
commentRenderer.expandButton.buttonRenderer.text.runs[0].text
"
2022-05-21 02:01:39 +00:00
:collapse-text="
commentRenderer.collapseButton.buttonRenderer.text.runs[0].text
"
>
2022-05-21 02:01:39 +00:00
<yt-text-formatter
style="font-size: 0.9rem"
:text-runs="commentRenderer.contentText.runs"
>
</yt-text-formatter>
</collapsable-text>
<div class="toolbar mt-2">
<v-btn-toggle v-model="voteStatus" group>
2022-04-23 04:18:59 +00:00
<div class="toolbar--item mr-1">
<v-icon small>mdi-thumb-up-outline</v-icon>
<span
v-if="commentRenderer.voteCount"
class="like-count caption"
2022-05-21 02:01:39 +00:00
v-text="commentRenderer.voteCount.simpleText"
></span>
<v-icon class="ml-2" small>mdi-thumb-down-outline</v-icon>
</div>
</v-btn-toggle>
2022-05-21 02:01:39 +00:00
<div class="toolbar--item ml-6" v-if="commentRenderer.replyCount">
<v-icon small>mdi-comment-outline</v-icon>
2022-04-22 04:38:21 +00:00
<span
class="like-count caption"
2022-05-21 02:01:39 +00:00
v-text="commentRenderer.replyCount"
2022-04-22 04:38:21 +00:00
></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 {
border-radius: 50%;
2022-05-29 22:14:00 +00:00
width: 35px;
height: 35px;
}
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 {
border-radius: 1em;
padding: 0 0.3em 0 0.6em;
2022-05-21 02:01:39 +00:00
font-weight: bold;
2022-04-21 10:51:49 +00:00
}
.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>