Add placeholder for comments sort

This commit is contained in:
Preston 2020-10-04 18:15:06 -04:00
parent e47b59750d
commit 2770818668
4 changed files with 41 additions and 2 deletions

View File

@ -12,6 +12,10 @@
text-align: center; text-align: center;
} }
.commentSort {
float: right;
}
.comment { .comment {
padding: 15px; padding: 15px;
position: relative; position: relative;

View File

@ -2,14 +2,17 @@ import Vue from 'vue'
import { mapActions } from 'vuex' import { mapActions } from 'vuex'
import FtCard from '../ft-card/ft-card.vue' import FtCard from '../ft-card/ft-card.vue'
import FtLoader from '../../components/ft-loader/ft-loader.vue' import FtLoader from '../../components/ft-loader/ft-loader.vue'
import CommentScraper from 'yt-comment-scraper' import FtSelect from '../../components/ft-select/ft-select.vue'
import FtTimestampCatcher from '../../components/ft-timestamp-catcher/ft-timestamp-catcher.vue' import FtTimestampCatcher from '../../components/ft-timestamp-catcher/ft-timestamp-catcher.vue'
import CommentScraper from 'yt-comment-scraper'
export default Vue.extend({ export default Vue.extend({
name: 'WatchVideoComments', name: 'WatchVideoComments',
components: { components: {
'ft-card': FtCard, 'ft-card': FtCard,
'ft-loader': FtLoader, 'ft-loader': FtLoader,
'ft-select': FtSelect,
'ft-timestamp-catcher': FtTimestampCatcher 'ft-timestamp-catcher': FtTimestampCatcher
}, },
props: { props: {
@ -38,13 +41,34 @@ export default Vue.extend({
invidiousInstance: function () { invidiousInstance: function () {
return this.$store.getters.getInvidiousInstance return this.$store.getters.getInvidiousInstance
},
sortNames: function () {
return [
this.$t('Comments.Top comments'),
this.$t('Comments.Newest first')
]
},
sortValues: function () {
return [
'top',
'newest'
]
} }
}, },
methods: { methods: {
onTimestamp: function(timestamp) { onTimestamp: function (timestamp) {
this.$emit('timestamp-event', timestamp) this.$emit('timestamp-event', timestamp)
}, },
handleSortChange: function (sortType) {
console.log(sortType)
this.showToast({
message: 'Not currently implemented'
})
},
getCommentData: function () { getCommentData: function () {
this.isLoading = true this.isLoading = true
switch (this.backendPreference) { switch (this.backendPreference) {

View File

@ -17,6 +17,15 @@
> >
{{ $t("Comments.Click to View Comments") }} {{ $t("Comments.Click to View Comments") }}
</h4> </h4>
<ft-select
v-if="commentData.length > 0 && !isLoading && showComments"
class="commentSort"
placeholder="Sort by"
:value="sortValues[0]"
:select-names="sortNames"
:select-values="sortValues"
@change="handleSortChange"
/>
<h3 <h3
v-if="commentData.length > 0 && !isLoading && showComments" v-if="commentData.length > 0 && !isLoading && showComments"
> >

View File

@ -478,6 +478,8 @@ Comments:
There are no more comments for this video: There are no more comments for this video There are no more comments for this video: There are no more comments for this video
Show Comments: Show Comments Show Comments: Show Comments
Hide Comments: Hide Comments Hide Comments: Hide Comments
Top comments: Top comments
Newest first: Newest First
# Context: View 10 Replies, View 1 Reply # Context: View 10 Replies, View 1 Reply
View: View View: View
Hide: Hide Hide: Hide