Skip to content

Commit

Permalink
* Show no. of items to be deleted on prompts
Browse files Browse the repository at this point in the history
  • Loading branch information
PikachuEXE committed Jun 11, 2024
1 parent 74d98be commit e6f6b75
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
23 changes: 23 additions & 0 deletions src/renderer/components/playlist-info/playlist-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,20 @@ export default defineComponent({
this.$t('Cancel')
]
},
removeVideosOnWatchPromptLabelText() {
return this.$tc(
'User Playlists.Are you sure you want to remove {playlistItemCount} watched videos from this playlist? This cannot be undone',
this.userPlaylistWatchedVideoCount,
{ playlistItemCount: this.userPlaylistWatchedVideoCount },
)
},
removeDuplicateVideosPromptLabelText() {
return this.$tc(
'User Playlists.Are you sure you want to remove {playlistItemCount} duplicate videos from this playlist? This cannot be undone',
this.userPlaylistDuplicateItemCount,
{ playlistItemCount: this.userPlaylistDuplicateItemCount },
)
},

firstVideoIdExists() {
return this.firstVideoId !== ''
Expand Down Expand Up @@ -220,6 +234,15 @@ export default defineComponent({
return typeof historyCacheById[video.videoId] !== 'undefined'
})
},
// `userPlaylistAnyVideoWatched` is faster than this & this is only needed when prompt shown
userPlaylistWatchedVideoCount() {
if (!this.isUserPlaylist) { return false }

const historyCacheById = this.$store.getters.getHistoryCacheById
return this.selectedUserPlaylist.videos.reduce((count, video) => {
return typeof historyCacheById[video.videoId] !== 'undefined' ? count + 1 : count
}, 0)
},

userPlaylistUniqueVideoIds() {
if (!this.isUserPlaylist) { return new Set() }
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/components/playlist-info/playlist-info.vue
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,15 @@
/>
<ft-prompt
v-if="showRemoveVideosOnWatchPrompt"
:label="$t('User Playlists.Are you sure you want to remove all watched videos from this playlist? This cannot be undone')"
:label="removeVideosOnWatchPromptLabelText"
:option-names="deletePlaylistPromptNames"
:option-values="deletePlaylistPromptValues"
:is-first-option-destructive="true"
@click="handleRemoveVideosOnWatchPromptAnswer"
/>
<ft-prompt
v-if="showRemoveDuplicateVideosPrompt"
:label="$t('User Playlists.Are you sure you want to remove duplicate videos from this playlist? This cannot be undone')"
:label="removeDuplicateVideosPromptLabelText"
:option-names="deletePlaylistPromptNames"
:option-values="deletePlaylistPromptValues"
:is-first-option-destructive="true"
Expand Down
4 changes: 2 additions & 2 deletions static/locales/en-US.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ User Playlists:
Remove Watched Videos: Remove Watched Videos
Enable Quick Bookmark With This Playlist: Enable Quick Bookmark With This Playlist
Quick Bookmark Enabled: Quick Bookmark Enabled
Are you sure you want to remove duplicate videos from this playlist? This cannot be undone: Are you sure you want to remove duplicate videos from this playlist? This cannot be undone.
Are you sure you want to remove all watched videos from this playlist? This cannot be undone: Are you sure you want to remove all watched videos from this playlist? This cannot be undone.
Are you sure you want to remove {playlistItemCount} duplicate videos from this playlist? This cannot be undone: Are you sure you want to remove 1 duplicate video from this playlist? This cannot be undone. | Are you sure you want to remove {playlistItemCount} duplicate videos from this playlist? This cannot be undone.
Are you sure you want to remove {playlistItemCount} watched videos from this playlist? This cannot be undone: Are you sure you want to remove 1 watched video from this playlist? This cannot be undone. | Are you sure you want to remove {playlistItemCount} watched videos from this playlist? This cannot be undone.
Delete Playlist: Delete Playlist
Cannot delete the quick bookmark target playlist.: Cannot delete the quick bookmark target playlist.
Are you sure you want to delete this playlist? This cannot be undone: Are you sure you want to delete this playlist? This cannot be undone.
Expand Down

0 comments on commit e6f6b75

Please sign in to comment.