@@ -28,6 +28,10 @@ export default defineComponent({
28
28
type : Boolean ,
29
29
required : true ,
30
30
} ,
31
+ addingDuplicateVideosEnabled : {
32
+ type : Boolean ,
33
+ required : true ,
34
+ } ,
31
35
} ,
32
36
emits : [ 'selected' ] ,
33
37
data : function ( ) {
@@ -80,10 +84,40 @@ export default defineComponent({
80
84
count : this . loneVideoPresenceCountInPlaylist ,
81
85
} )
82
86
} ,
87
+ multiVideoPresenceCountInPlaylist ( ) {
88
+ if ( this . toBeAddedToPlaylistVideoList . length < 2 ) { return null }
89
+
90
+ // Count of to be added videos already present in this playlist
91
+ const v = this . toBeAddedToPlaylistVideoList . reduce ( ( accumulator , toBeAddedToVideo ) => {
92
+ return this . playlist . videos . some ( ( pv ) => pv . videoId === toBeAddedToVideo . videoId )
93
+ ? accumulator + 1
94
+ : accumulator
95
+ } , 0 )
96
+ // Don't display zero value
97
+ return v === 0 ? null : v
98
+ } ,
99
+ multiVideoPresenceCountInPlaylistText ( ) {
100
+ if ( this . multiVideoPresenceCountInPlaylist == null ) { return null }
101
+
102
+ if ( this . addingDuplicateVideosEnabled || this . toBeAddedToPlaylistVideoList . length === this . multiVideoPresenceCountInPlaylist ) {
103
+ return this . $t ( 'User Playlists.AddVideoPrompt.{videoCount}/{totalVideoCount} Videos Already Added' , {
104
+ videoCount : this . multiVideoPresenceCountInPlaylist ,
105
+ totalVideoCount : this . toBeAddedToPlaylistVideoList . length ,
106
+ } )
107
+ }
108
+
109
+ return this . $t ( 'User Playlists.AddVideoPrompt.{videoCount}/{totalVideoCount} Videos Will Be Added' , {
110
+ videoCount : this . toBeAddedToPlaylistVideoList . length - this . multiVideoPresenceCountInPlaylist ,
111
+ totalVideoCount : this . toBeAddedToPlaylistVideoList . length ,
112
+ } )
113
+ } ,
114
+ videoPresenceCountInPlaylistText ( ) {
115
+ return this . loneVideoPresenceCountInPlaylistText ?? this . multiVideoPresenceCountInPlaylistText
116
+ } ,
83
117
videoPresenceCountInPlaylistTextVisible ( ) {
84
118
if ( ! this . videoPresenceCountInPlaylistTextShouldBeVisible ) { return false }
85
119
86
- return this . loneVideoPresenceCountInPlaylistText != null
120
+ return this . videoPresenceCountInPlaylistText != null
87
121
} ,
88
122
} ,
89
123
created : function ( ) {
0 commit comments