import { Component, EventEmitter, Input, Output } from '@angular/core'
import { ScreenService } from '@app/core'
-import { I18n } from '@ngx-translate/i18n-polyfill'
+import { VideoState } from '@shared/models'
import { Video } from '../shared-main'
@Component({
export class VideoThumbnailComponent {
@Input() video: Video
@Input() nsfw = false
- @Input() routerLink: any[]
+
+ @Input() videoRouterLink: string | any[]
@Input() queryParams: { [ p: string ]: any }
+ @Input() videoHref: string
+ @Input() videoTarget: string
@Input() displayWatchLaterPlaylist: boolean
@Input() inWatchLaterPlaylist: 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')
+ constructor (private screenService: ScreenService) {
+ this.addToWatchLaterText = $localize`Add to watch later`
+ this.addedToWatchLaterText = $localize`Remove from watch later`
+ }
+
+ isLiveEnded () {
+ if (!this.video.state) return
+
+ return this.video.state.id === VideoState.LIVE_ENDED
}
getImageUrl () {
}
getVideoRouterLink () {
- if (this.routerLink) return this.routerLink
+ if (this.videoRouterLink) return this.videoRouterLink
- return [ '/videos/watch', this.video.uuid ]
+ return Video.buildWatchUrl(this.video)
}
onWatchLaterClick (event: Event) {