Skip to content

Commit e6f6b75

Browse files
committed
* Show no. of items to be deleted on prompts
1 parent 74d98be commit e6f6b75

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

src/renderer/components/playlist-info/playlist-info.js

+23
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,20 @@ export default defineComponent({
166166
this.$t('Cancel')
167167
]
168168
},
169+
removeVideosOnWatchPromptLabelText() {
170+
return this.$tc(
171+
'User Playlists.Are you sure you want to remove {playlistItemCount} watched videos from this playlist? This cannot be undone',
172+
this.userPlaylistWatchedVideoCount,
173+
{ playlistItemCount: this.userPlaylistWatchedVideoCount },
174+
)
175+
},
176+
removeDuplicateVideosPromptLabelText() {
177+
return this.$tc(
178+
'User Playlists.Are you sure you want to remove {playlistItemCount} duplicate videos from this playlist? This cannot be undone',
179+
this.userPlaylistDuplicateItemCount,
180+
{ playlistItemCount: this.userPlaylistDuplicateItemCount },
181+
)
182+
},
169183

170184
firstVideoIdExists() {
171185
return this.firstVideoId !== ''
@@ -220,6 +234,15 @@ export default defineComponent({
220234
return typeof historyCacheById[video.videoId] !== 'undefined'
221235
})
222236
},
237+
// `userPlaylistAnyVideoWatched` is faster than this & this is only needed when prompt shown
238+
userPlaylistWatchedVideoCount() {
239+
if (!this.isUserPlaylist) { return false }
240+
241+
const historyCacheById = this.$store.getters.getHistoryCacheById
242+
return this.selectedUserPlaylist.videos.reduce((count, video) => {
243+
return typeof historyCacheById[video.videoId] !== 'undefined' ? count + 1 : count
244+
}, 0)
245+
},
223246

224247
userPlaylistUniqueVideoIds() {
225248
if (!this.isUserPlaylist) { return new Set() }

src/renderer/components/playlist-info/playlist-info.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -210,15 +210,15 @@
210210
/>
211211
<ft-prompt
212212
v-if="showRemoveVideosOnWatchPrompt"
213-
:label="$t('User Playlists.Are you sure you want to remove all watched videos from this playlist? This cannot be undone')"
213+
:label="removeVideosOnWatchPromptLabelText"
214214
:option-names="deletePlaylistPromptNames"
215215
:option-values="deletePlaylistPromptValues"
216216
:is-first-option-destructive="true"
217217
@click="handleRemoveVideosOnWatchPromptAnswer"
218218
/>
219219
<ft-prompt
220220
v-if="showRemoveDuplicateVideosPrompt"
221-
:label="$t('User Playlists.Are you sure you want to remove duplicate videos from this playlist? This cannot be undone')"
221+
:label="removeDuplicateVideosPromptLabelText"
222222
:option-names="deletePlaylistPromptNames"
223223
:option-values="deletePlaylistPromptValues"
224224
:is-first-option-destructive="true"

static/locales/en-US.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ User Playlists:
189189
Remove Watched Videos: Remove Watched Videos
190190
Enable Quick Bookmark With This Playlist: Enable Quick Bookmark With This Playlist
191191
Quick Bookmark Enabled: Quick Bookmark Enabled
192-
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.
193-
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.
192+
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.
193+
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.
194194
Delete Playlist: Delete Playlist
195195
Cannot delete the quick bookmark target playlist.: Cannot delete the quick bookmark target playlist.
196196
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.

0 commit comments

Comments
 (0)