]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/videos/recommendations/recommended-videos.component.ts
provide specific engine boundaries for nodejs and yarn
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / recommendations / recommended-videos.component.ts
index d4b4c929b42dcd79e0f81ce9a01180d205f2fe89..a6f3bce3d36b01cbe066a218b4a91a6bc864fd79 100644 (file)
@@ -1,29 +1,38 @@
-import { Component, Input, Output, OnChanges, EventEmitter } from '@angular/core'
 import { Observable } from 'rxjs'
-import { Video } from '@app/shared/video/video.model'
+import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core'
+import { AuthService, Notifier } from '@app/core'
+import { User } from '@app/shared'
+import { SessionStorageService } from '@app/shared/misc/storage.service'
+import { UserService } from '@app/shared/users/user.service'
 import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model'
 import { RecommendationInfo } from '@app/shared/video/recommendation-info.model'
+import { MiniatureDisplayOptions } from '@app/shared/video/video-miniature.component'
+import { Video } from '@app/shared/video/video.model'
 import { RecommendedVideosStore } from '@app/videos/recommendations/recommended-videos.store'
-import { User } from '@app/shared'
-import { AuthService, Notifier } from '@app/core'
-import { UserService } from '@app/shared/users/user.service'
 import { I18n } from '@ngx-translate/i18n-polyfill'
-import { SessionStorageService } from '@app/shared/misc/storage.service'
 
 @Component({
   selector: 'my-recommended-videos',
   templateUrl: './recommended-videos.component.html',
   styleUrls: [ './recommended-videos.component.scss' ]
 })
-export class RecommendedVideosComponent implements OnChanges {
+export class RecommendedVideosComponent implements OnInit, OnChanges {
   @Input() inputRecommendation: RecommendationInfo
-  @Input() user: User
   @Input() playlist: VideoPlaylist
   @Output() gotRecommendations = new EventEmitter<Video[]>()
 
   autoPlayNextVideo: boolean
   autoPlayNextVideoTooltip: string
 
+  displayOptions: MiniatureDisplayOptions = {
+    date: true,
+    views: true,
+    by: true,
+    avatar: true
+  }
+
+  userMiniature: User
+
   readonly hasVideos$: Observable<boolean>
   readonly videos$: Observable<Video[]>
 
@@ -51,7 +60,12 @@ export class RecommendedVideosComponent implements OnChanges {
     this.autoPlayNextVideoTooltip = this.i18n('When active, the next video is automatically played after the current one.')
   }
 
-  public ngOnChanges (): void {
+  ngOnInit () {
+    this.userService.getAnonymousOrLoggedUser()
+      .subscribe(user => this.userMiniature = user)
+  }
+
+  ngOnChanges () {
     if (this.inputRecommendation) {
       this.store.requestNewRecommendations(this.inputRecommendation)
     }