X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fvideo%2Fvideo-thumbnail.component.ts;h=fe65ade9442a1b5da0beedaab65b269fa699d0fd;hb=8c559fad1e1c4c2ab7f1388c73200aa4c6256d74;hp=e52f7dfb0824f2da18389a7a73a49d6a961c5a6c;hpb=3290f37c76784f1b96cefb5d389e48db56033b0a;p=oweals%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 e52f7dfb0..fe65ade94 100644 --- a/client/src/app/shared/video/video-thumbnail.component.ts +++ b/client/src/app/shared/video/video-thumbnail.component.ts @@ -1,6 +1,6 @@ import { Component, Input } from '@angular/core' -import { isInMobileView } from '@app/shared/misc/utils' import { Video } from './video.model' +import { ScreenService } from '@app/shared/misc/screen.service' @Component({ selector: 'my-video-thumbnail', @@ -10,14 +10,33 @@ import { Video } from './video.model' export class VideoThumbnailComponent { @Input() video: Video @Input() nsfw = false + @Input() routerLink: any[] + @Input() queryParams: any[] + + constructor (private screenService: ScreenService) { + } getImageUrl () { if (!this.video) return '' - if (isInMobileView()) { + if (this.screenService.isInMobileView()) { return this.video.previewUrl } return this.video.thumbnailUrl } + + getProgressPercent () { + if (!this.video.userHistory) return 0 + + const currentTime = this.video.userHistory.currentTime + + return (currentTime / this.video.duration) * 100 + } + + getVideoRouterLink () { + if (this.routerLink) return this.routerLink + + return [ '/videos/watch', this.video.uuid ] + } }