mirror of https://github.com/FreeTubeApp/FreeTube
65 lines
1.7 KiB
JavaScript
65 lines
1.7 KiB
JavaScript
import Vue from 'vue'
|
|
import FtCard from '../../components/ft-card/ft-card.vue'
|
|
import FtFlexBox from '../../components/ft-flex-box/ft-flex-box.vue'
|
|
import FtTooltip from '../../components/ft-tooltip/ft-tooltip.vue'
|
|
import FtLoader from '../../components/ft-loader/ft-loader.vue'
|
|
import FtButton from '../../components/ft-button/ft-button.vue'
|
|
import FtElementList from '../../components/ft-element-list/ft-element-list.vue'
|
|
|
|
export default Vue.extend({
|
|
name: 'UserPlaylists',
|
|
components: {
|
|
'ft-card': FtCard,
|
|
'ft-flex-box': FtFlexBox,
|
|
'ft-tooltip': FtTooltip,
|
|
'ft-loader': FtLoader,
|
|
'ft-button': FtButton,
|
|
'ft-element-list': FtElementList
|
|
},
|
|
data: function () {
|
|
return {
|
|
isLoading: false,
|
|
dataLimit: 100
|
|
}
|
|
},
|
|
computed: {
|
|
favoritesPlaylist: function () {
|
|
return this.$store.getters.getFavorites
|
|
},
|
|
|
|
activeData: function () {
|
|
const data = [].concat(this.favoritesPlaylist.videos).reverse()
|
|
if (this.favoritesPlaylist.videos.length < this.dataLimit) {
|
|
return data
|
|
} else {
|
|
return data.slice(0, this.dataLimit)
|
|
}
|
|
}
|
|
},
|
|
watch: {
|
|
// This implementation of loading effect
|
|
// causes "scroll to top" side effect which is reported as a bug
|
|
// https://github.com/FreeTubeApp/FreeTube/issues/1507
|
|
//
|
|
// activeData() {
|
|
// this.isLoading = true
|
|
// setTimeout(() => {
|
|
// this.isLoading = false
|
|
// }, 100)
|
|
// }
|
|
},
|
|
mounted: function () {
|
|
const limit = sessionStorage.getItem('favoritesLimit')
|
|
|
|
if (limit !== null) {
|
|
this.dataLimit = limit
|
|
}
|
|
},
|
|
methods: {
|
|
increaseLimit: function () {
|
|
this.dataLimit += 100
|
|
sessionStorage.setItem('favoritesLimit', this.dataLimit)
|
|
}
|
|
}
|
|
})
|