diff --git a/src/renderer/components/FtCommunityPost/FtCommunityPost.vue b/src/renderer/components/FtCommunityPost/FtCommunityPost.vue index 5d879e954eb7d..69cb119a31065 100644 --- a/src/renderer/components/FtCommunityPost/FtCommunityPost.vue +++ b/src/renderer/components/FtCommunityPost/FtCommunityPost.vue @@ -166,7 +166,7 @@ import { A11y, Navigation, Pagination } from 'swiper/modules' import { computed, onMounted, ref } from 'vue' import FtListVideo from '../ft-list-video/ft-list-video.vue' -import FtListPlaylist from '../ft-list-playlist/ft-list-playlist.vue' +import FtListPlaylist from '../FtListPlaylist/FtListPlaylist.vue' import FtCommunityPoll from '../FtCommunityPoll/FtCommunityPoll.vue' import store from '../../store/index' diff --git a/src/renderer/components/FtListLazyWrapper/FtListLazyWrapper.vue b/src/renderer/components/FtListLazyWrapper/FtListLazyWrapper.vue index 5b96947909f00..fbd87924cf093 100644 --- a/src/renderer/components/FtListLazyWrapper/FtListLazyWrapper.vue +++ b/src/renderer/components/FtListLazyWrapper/FtListLazyWrapper.vue @@ -60,7 +60,7 @@ import { computed, ref } from 'vue' import FtListVideo from '../ft-list-video/ft-list-video.vue' import FtListChannel from '../FtListChannel/FtListChannel.vue' -import FtListPlaylist from '../ft-list-playlist/ft-list-playlist.vue' +import FtListPlaylist from '../FtListPlaylist/FtListPlaylist.vue' import FtCommunityPost from '../FtCommunityPost/FtCommunityPost.vue' import FtListHashtag from '../FtListHashtag/FtListHashtag.vue' diff --git a/src/renderer/components/ft-list-playlist/ft-list-playlist.scss b/src/renderer/components/FtListPlaylist/FtListPlaylist.scss similarity index 55% rename from src/renderer/components/ft-list-playlist/ft-list-playlist.scss rename to src/renderer/components/FtListPlaylist/FtListPlaylist.scss index 0b80f3851c5ae..3fae7a4aecdb1 100644 --- a/src/renderer/components/ft-list-playlist/ft-list-playlist.scss +++ b/src/renderer/components/FtListPlaylist/FtListPlaylist.scss @@ -1 +1,5 @@ @use '../../scss-partials/ft-list-item'; + +.blur { + filter: blur(20px); +} diff --git a/src/renderer/components/FtListPlaylist/FtListPlaylist.vue b/src/renderer/components/FtListPlaylist/FtListPlaylist.vue new file mode 100644 index 0000000000000..c2a5030b85862 --- /dev/null +++ b/src/renderer/components/FtListPlaylist/FtListPlaylist.vue @@ -0,0 +1,281 @@ + + + + + + + + + + {{ videoCount }} + + + + + + + + {{ titleForDisplay }} + + + + + {{ channelName }} + + + {{ channelName }} + + + + + + + + + + + + + diff --git a/src/renderer/components/ft-list-playlist/ft-list-playlist.js b/src/renderer/components/ft-list-playlist/ft-list-playlist.js deleted file mode 100644 index e36d6e63ff993..0000000000000 --- a/src/renderer/components/ft-list-playlist/ft-list-playlist.js +++ /dev/null @@ -1,204 +0,0 @@ -import { defineComponent } from 'vue' -import FtIconButton from '../ft-icon-button/ft-icon-button.vue' -import { mapActions } from 'vuex' -import { showToast } from '../../helpers/utils' -import thumbnailPlaceholder from '../../assets/img/thumbnail_placeholder.svg' - -export default defineComponent({ - name: 'FtListPlaylist', - components: { - 'ft-icon-button': FtIconButton - }, - props: { - data: { - type: Object, - required: true - }, - appearance: { - type: String, - required: true - }, - searchQueryText: { - type: String, - required: false, - default: '', - }, - }, - data: function () { - return { - playlistId: '', - channelId: '', - title: 'Pop Music Playlist - Timeless Pop Songs (Updated Weekly 2020)', - thumbnail: thumbnailPlaceholder, - channelName: '#RedMusic: Just Hits', - videoCount: 200, - } - }, - computed: { - backendPreference: function () { - return this.$store.getters.getBackendPreference - }, - currentInvidiousInstanceUrl: function () { - return this.$store.getters.getCurrentInvidiousInstanceUrl - }, - - quickBookmarkPlaylistId() { - return this.$store.getters.getQuickBookmarkTargetPlaylistId - }, - markedAsQuickBookmarkTarget() { - // Only user playlists can be target - if (this.playlistId == null) { return false } - if (this.quickBookmarkPlaylistId == null) { return false } - - return this.quickBookmarkPlaylistId === this.playlistId - }, - - listType: function () { - return this.$store.getters.getListType - }, - - externalPlayer: function () { - return this.$store.getters.getExternalPlayer - }, - - defaultPlayback: function () { - return this.$store.getters.getDefaultPlayback - }, - - titleForDisplay: function () { - if (typeof this.title !== 'string') { return '' } - if (this.title.length <= 255) { return this.title } - - return `${this.title.substring(0, 255)}...` - }, - - blurThumbnails: function () { - return this.$store.getters.getBlurThumbnails - }, - - blurThumbnailsStyle: function () { - return this.blurThumbnails ? 'blur(20px)' : null - }, - - thumbnailPreference: function () { - return this.$store.getters.getThumbnailPreference - }, - thumbnailCanBeShown() { - return this.thumbnailPreference !== 'hidden' - }, - - isUserPlaylist() { - return this.data._id != null - }, - - playlistPageLinkTo() { - // For `router-link` attribute `to` - return { - path: `/playlist/${this.playlistId}`, - query: { - playlistType: this.isUserPlaylist ? 'user' : '', - searchQueryText: this.searchQueryText, - }, - } - }, - }, - created: function () { - if (this.isUserPlaylist) { - this.parseUserData() - } else if (this.data.dataSource === 'local') { - this.parseLocalData() - } else { - this.parseInvidiousData() - } - }, - methods: { - handleExternalPlayer: function () { - this.openInExternalPlayer({ - watchProgress: 0, - playbackRate: this.defaultPlayback, - videoId: null, - playlistId: this.playlistId, - playlistIndex: null, - playlistReverse: null, - playlistShuffle: null, - playlistLoop: null - }) - }, - - handleQuickBookmarkEnabledDisabledClick: function () { - showToast(this.$t('User Playlists.SinglePlaylistView.Toast["This playlist is already being used for quick bookmark."]')) - }, - - parseInvidiousData: function () { - this.title = this.data.title - if (this.thumbnailCanBeShown) { - this.thumbnail = this.data.playlistThumbnail.replace('https://i.ytimg.com', this.currentInvidiousInstanceUrl).replace('hqdefault', 'mqdefault') - } - this.channelName = this.data.author - this.channelId = this.data.authorId - this.playlistId = this.data.playlistId - this.videoCount = this.data.videoCount - - if (this.data.proxyThumbnail === false) { - this.thumbnail = this.data.playlistThumbnail - } - }, - - parseLocalData: function () { - this.title = this.data.title - if (this.thumbnailCanBeShown) { - this.thumbnail = this.data.thumbnail - } - this.channelName = this.data.channelName - this.channelId = this.data.channelId - this.playlistId = this.data.playlistId - this.videoCount = this.data.videoCount - }, - - parseUserData: function () { - this.title = this.data.playlistName - if (this.thumbnailCanBeShown && this.data.videos.length > 0) { - const thumbnailURL = `https://i.ytimg.com/vi/${this.data.videos[0].videoId}/mqdefault.jpg` - if (this.backendPreference === 'invidious') { - this.thumbnail = thumbnailURL.replace('https://i.ytimg.com', this.currentInvidiousInstanceUrl) - } else { - this.thumbnail = thumbnailURL - } - } - this.channelName = '' - this.channelId = '' - this.playlistId = this.data._id - this.videoCount = this.data.videos.length - }, - - enableQuickBookmarkForThisPlaylist: function () { - const currentQuickBookmarkTargetPlaylist = this.$store.getters.getQuickBookmarkPlaylist - - this.updateQuickBookmarkTargetPlaylistId(this.playlistId) - if (currentQuickBookmarkTargetPlaylist != null) { - showToast( - this.$t('User Playlists.SinglePlaylistView.Toast["This playlist is now used for quick bookmark instead of {oldPlaylistName}. Click here to undo"]', { - oldPlaylistName: currentQuickBookmarkTargetPlaylist.playlistName, - }), - 5000, - () => { - this.updateQuickBookmarkTargetPlaylistId(currentQuickBookmarkTargetPlaylist._id) - showToast( - this.$t('User Playlists.SinglePlaylistView.Toast["Reverted to use {oldPlaylistName} for quick bookmark"]', { - oldPlaylistName: currentQuickBookmarkTargetPlaylist.playlistName, - }), - 5000, - ) - }, - ) - } else { - showToast(this.$t('User Playlists.SinglePlaylistView.Toast.This playlist is now used for quick bookmark')) - } - }, - - ...mapActions([ - 'openInExternalPlayer', - 'updateQuickBookmarkTargetPlaylistId' - ]) - } -}) diff --git a/src/renderer/components/ft-list-playlist/ft-list-playlist.vue b/src/renderer/components/ft-list-playlist/ft-list-playlist.vue deleted file mode 100644 index 0f5bed27762b3..0000000000000 --- a/src/renderer/components/ft-list-playlist/ft-list-playlist.vue +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - {{ videoCount }} - - - - - - - - {{ titleForDisplay }} - - - - - {{ channelName }} - - - {{ channelName }} - - - - - - - - - - - -