FreeTube/src/renderer/components/watch-video-comments/watch-video-comments.vue

137 lines
3.7 KiB
Vue
Raw Normal View History

2020-02-16 19:30:00 +01:00
<template>
<ft-card>
<ft-loader
v-if="isLoading"
/>
<h4
v-if="commentData.length === 0 && !isLoading"
class="getCommentsTitle"
@click="getCommentData"
>
{{ $t("Comments.Click to View Comments") }}
2020-02-16 19:30:00 +01:00
</h4>
<h4
v-if="commentData.length > 0 && !isLoading && !showComments"
class="getCommentsTitle"
@click="showComments = true"
>
{{ $t("Comments.Click to View Comments") }}
</h4>
2020-10-05 00:15:06 +02:00
<ft-select
v-if="commentData.length > 0 && !isLoading && showComments"
class="commentSort"
2020-10-05 00:17:21 +02:00
:placeholder="$t('Comments.Sort by')"
:value="currentSortValue"
2020-10-05 00:15:06 +02:00
:select-names="sortNames"
:select-values="sortValues"
@change="handleSortChange"
/>
2020-02-16 19:30:00 +01:00
<h3
v-if="commentData.length > 0 && !isLoading && showComments"
2020-02-16 19:30:00 +01:00
>
{{ $t("Comments.Comments") }}
<span
class="hideComments"
@click="showComments = false"
>
{{ $t("Comments.Hide Comments") }}
</span>
2020-02-16 19:30:00 +01:00
</h3>
<div
v-if="commentData.length > 0 && showComments"
2020-02-16 19:30:00 +01:00
>
<div
v-for="(comment, index) in commentData"
:key="index"
class="comment"
>
<img
:src="comment.authorThumb"
class="commentThumbnail"
>
<p class="commentAuthor">
{{ comment.author }}
<span class="commentDate">
{{ comment.time }}
</span>
</p>
<ft-timestamp-catcher
class="commentText"
:input-html="comment.text"
@timestamp-event="onTimestamp"
/>
2020-02-16 19:30:00 +01:00
<p class="commentLikeCount">
<font-awesome-icon
icon="thumbs-up"
/>
{{ comment.likes }}
2020-09-26 17:43:01 +02:00
<span
v-if="comment.numReplies > 0"
class="commentMoreReplies"
@click="getCommentReplies(index)"
>
<span v-if="!comment.showReplies">{{ $t("Comments.View") }}</span>
<span v-else>{{ $t("Comments.Hide") }}</span>
{{ comment.numReplies }}
<span v-if="comment.numReplies === 1">{{ $t("Comments.Reply").toLowerCase() }}</span>
<span v-else>{{ $t("Comments.Replies").toLowerCase() }}</span>
</span>
2020-02-16 19:30:00 +01:00
</p>
<div
v-if="comment.showReplies"
class="commentReplies"
>
<div
v-for="(reply, replyIndex) in comment.replies"
:key="replyIndex"
class="comment"
>
<img
:src="reply.authorThumb"
class="commentThumbnail"
>
<p class="commentAuthor">
{{ reply.author }}
<span class="commentDate">
{{ reply.time }}
</span>
</p>
<p class="commentText">
{{ reply.text }}
</p>
<p class="commentLikeCount">
<font-awesome-icon
icon="thumbs-up"
/>
{{ reply.likes }}
</p>
<p
v-if="reply.numReplies > 0"
class="commentMoreReplies"
>
View {{ reply.numReplies }} replies
</p>
</div>
</div>
</div>
</div>
<div
v-else-if="showComments && !isLoading"
>
<h3 class="center">
{{ $t("There are no comments available for this video") }}
</h3>
</div>
2020-02-16 19:30:00 +01:00
<h4
v-if="commentData.length > 0 && !isLoading && showComments"
2020-02-16 19:30:00 +01:00
class="getMoreComments"
@click="getMoreComments"
2020-02-16 19:30:00 +01:00
>
{{ $t("Comments.Load More Comments") }}
2020-02-16 19:30:00 +01:00
</h4>
</ft-card>
</template>
<script src="./watch-video-comments.js" />
<style scoped src="./watch-video-comments.css" />