]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-thumbnail/video-thumbnail.component.ts
Merge branch 'release/4.2.0' into develop
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-thumbnail / video-thumbnail.component.ts
index b2a2cf240e11c24a57b26873b81acffb2db6b7f4..ad5d30db2aaf3ef088ff21bd6f5eb85db3de4c87 100644 (file)
@@ -1,5 +1,6 @@
 import { Component, EventEmitter, Input, Output } from '@angular/core'
 import { ScreenService } from '@app/core'
+import { VideoState } from '@shared/models'
 import { Video } from '../shared-main'
 
 @Component({
@@ -11,7 +12,7 @@ export class VideoThumbnailComponent {
   @Input() video: Video
   @Input() nsfw = false
 
-  @Input() videoRouterLink: any[]
+  @Input() videoRouterLink: string | any[]
   @Input() queryParams: { [ p: string ]: any }
   @Input() videoHref: string
   @Input() videoTarget: string
@@ -29,6 +30,12 @@ export class VideoThumbnailComponent {
     this.addedToWatchLaterText = $localize`Remove from watch later`
   }
 
+  isLiveEnded () {
+    if (!this.video.state) return
+
+    return this.video.state.id === VideoState.LIVE_ENDED
+  }
+
   getImageUrl () {
     if (!this.video) return ''
 
@@ -50,7 +57,7 @@ export class VideoThumbnailComponent {
   getVideoRouterLink () {
     if (this.videoRouterLink) return this.videoRouterLink
 
-    return [ '/videos/watch', this.video.uuid ]
+    return Video.buildWatchUrl(this.video)
   }
 
   onWatchLaterClick (event: Event) {