X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fvideo%2Fvideo-thumbnail.component.ts;h=111b4c8bbe57e3fde7f028bda6867a971e5f6322;hb=be27ef3b4682c5639039474c39ee0d234d16f482;hp=ca43700c7c7d620eba0ce29fe3034564569eb714;hpb=71e318b4fe66175d03c7c82357d60062eb68af81;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/shared/video/video-thumbnail.component.ts b/client/src/app/shared/video/video-thumbnail.component.ts index ca43700c7..111b4c8bb 100644 --- a/client/src/app/shared/video/video-thumbnail.component.ts +++ b/client/src/app/shared/video/video-thumbnail.component.ts @@ -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', @@ -10,8 +11,24 @@ import { ScreenService } from '@app/shared/misc/screen.service' export class VideoThumbnailComponent { @Input() video: Video @Input() nsfw = false + @Input() routerLink: any[] + @Input() queryParams: { [ p: string ]: any } - constructor (private screenService: ScreenService) {} + @Input() displayWatchLaterPlaylist: boolean + @Input() inWatchLaterPlaylist: boolean + + @Output() watchLaterClick = new EventEmitter() + + 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 () { if (!this.video) return '' @@ -30,4 +47,17 @@ export class VideoThumbnailComponent { return (currentTime / this.video.duration) * 100 } + + getVideoRouterLink () { + if (this.routerLink) return this.routerLink + + return [ '/videos/watch', this.video.uuid ] + } + + onWatchLaterClick (event: Event) { + this.watchLaterClick.emit(this.inWatchLaterPlaylist) + + event.stopPropagation() + return false + } }