provide specific engine boundaries for nodejs and yarn
[oweals/peertube.git] / client / src / app / shared / video / video-thumbnail.component.ts
index fe65ade9442a1b5da0beedaab65b269fa699d0fd..111b4c8bbe57e3fde7f028bda6867a971e5f6322 100644 (file)
@@ -1,6 +1,7 @@
-import { Component, Input } from '@angular/core'
+import { Component, EventEmitter, Input, Output } from '@angular/core'
 import { Video } from './video.model'
 import { ScreenService } from '@app/shared/misc/screen.service'
+import { I18n } from '@ngx-translate/i18n-polyfill'
 
 @Component({
   selector: 'my-video-thumbnail',
@@ -11,9 +12,22 @@ export class VideoThumbnailComponent {
   @Input() video: Video
   @Input() nsfw = false
   @Input() routerLink: any[]
-  @Input() queryParams: any[]
+  @Input() queryParams: { [ p: string ]: any }
 
-  constructor (private screenService: ScreenService) {
+  @Input() displayWatchLaterPlaylist: boolean
+  @Input() inWatchLaterPlaylist: boolean
+
+  @Output() watchLaterClick = new EventEmitter<boolean>()
+
+  addToWatchLaterText: string
+  addedToWatchLaterText: string
+
+  constructor (
+    private screenService: ScreenService,
+    private i18n: I18n
+  ) {
+    this.addToWatchLaterText = this.i18n('Add to watch later')
+    this.addedToWatchLaterText = this.i18n('Remove from watch later')
   }
 
   getImageUrl () {
@@ -39,4 +53,11 @@ export class VideoThumbnailComponent {
 
     return [ '/videos/watch', this.video.uuid ]
   }
+
+  onWatchLaterClick (event: Event) {
+    this.watchLaterClick.emit(this.inWatchLaterPlaylist)
+
+    event.stopPropagation()
+    return false
+  }
 }