]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/videos/recommendations/recommended-videos.component.ts
Add max file size, max files and ip anonymize log options
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / recommendations / recommended-videos.component.ts
CommitLineData
6aa54148 1import { Component, Input, Output, OnChanges, EventEmitter } from '@angular/core'
7f5f4152
BJ
2import { Observable } from 'rxjs'
3import { Video } from '@app/shared/video/video.model'
b0c36821 4import { RecommendationInfo } from '@app/shared/video/recommendation-info.model'
7f5f4152
BJ
5import { RecommendedVideosStore } from '@app/videos/recommendations/recommended-videos.store'
6import { User } from '@app/shared'
7
8@Component({
9 selector: 'my-recommended-videos',
10 templateUrl: './recommended-videos.component.html'
11})
12export class RecommendedVideosComponent implements OnChanges {
b0c36821 13 @Input() inputRecommendation: RecommendationInfo
7f5f4152 14 @Input() user: User
6aa54148 15 @Output() gotRecommendations = new EventEmitter<Video[]>()
7f5f4152
BJ
16
17 readonly hasVideos$: Observable<boolean>
18 readonly videos$: Observable<Video[]>
19
20 constructor (
21 private store: RecommendedVideosStore
22 ) {
23 this.videos$ = this.store.recommendations$
24 this.hasVideos$ = this.store.hasRecommendations$
6aa54148 25 this.videos$.subscribe(videos => this.gotRecommendations.emit(videos))
7f5f4152
BJ
26 }
27
28 public ngOnChanges (): void {
b0c36821
J
29 if (this.inputRecommendation) {
30 this.store.requestNewRecommendations(this.inputRecommendation)
7f5f4152
BJ
31 }
32 }
33
0a57bbff
C
34 onVideoRemoved () {
35 this.store.requestNewRecommendations(this.inputRecommendation)
36 }
7f5f4152 37}