diff options
Diffstat (limited to 'client/src/app/videos/recommendations')
6 files changed, 34 insertions, 30 deletions
diff --git a/client/src/app/videos/recommendations/recent-videos-recommendation.service.ts b/client/src/app/videos/recommendations/recent-videos-recommendation.service.ts index 0abf938b7..a376453bf 100644 --- a/client/src/app/videos/recommendations/recent-videos-recommendation.service.ts +++ b/client/src/app/videos/recommendations/recent-videos-recommendation.service.ts | |||
@@ -1,15 +1,13 @@ | |||
1 | import { Observable, of } from 'rxjs' | 1 | import { Observable, of } from 'rxjs' |
2 | import { map, switchMap } from 'rxjs/operators' | 2 | import { map, switchMap } from 'rxjs/operators' |
3 | import { Injectable } from '@angular/core' | 3 | import { Injectable } from '@angular/core' |
4 | import { ServerService } from '@app/core' | 4 | import { ServerService, UserService } from '@app/core' |
5 | import { AdvancedSearch } from '@app/search/advanced-search.model' | 5 | import { AdvancedSearch } from '@app/search/advanced-search.model' |
6 | import { SearchService } from '@app/search/search.service' | 6 | import { SearchService } from '@app/search/search.service' |
7 | import { UserService } from '@app/shared' | 7 | import { Video, VideoService } from '@app/shared/shared-main' |
8 | import { RecommendationInfo } from '@app/shared/video/recommendation-info.model' | ||
9 | import { Video } from '@app/shared/video/video.model' | ||
10 | import { VideoService } from '@app/shared/video/video.service' | ||
11 | import { RecommendationService } from '@app/videos/recommendations/recommendations.service' | ||
12 | import { ServerConfig } from '@shared/models' | 8 | import { ServerConfig } from '@shared/models' |
9 | import { RecommendationInfo } from './recommendation-info.model' | ||
10 | import { RecommendationService } from './recommendations.service' | ||
13 | 11 | ||
14 | /** | 12 | /** |
15 | * Provides "recommendations" by providing the most recently uploaded videos. | 13 | * Provides "recommendations" by providing the most recently uploaded videos. |
diff --git a/client/src/app/videos/recommendations/recommendation-info.model.ts b/client/src/app/videos/recommendations/recommendation-info.model.ts new file mode 100644 index 000000000..0233563bb --- /dev/null +++ b/client/src/app/videos/recommendations/recommendation-info.model.ts | |||
@@ -0,0 +1,4 @@ | |||
1 | export interface RecommendationInfo { | ||
2 | uuid: string | ||
3 | tags?: string[] | ||
4 | } | ||
diff --git a/client/src/app/videos/recommendations/recommendations.module.ts b/client/src/app/videos/recommendations/recommendations.module.ts index 3e279cc29..03cc272ca 100644 --- a/client/src/app/videos/recommendations/recommendations.module.ts +++ b/client/src/app/videos/recommendations/recommendations.module.ts | |||
@@ -1,16 +1,21 @@ | |||
1 | import { NgModule } from '@angular/core' | ||
2 | import { InputSwitchModule } from 'primeng/inputswitch' | 1 | import { InputSwitchModule } from 'primeng/inputswitch' |
3 | import { RecommendedVideosComponent } from '@app/videos/recommendations/recommended-videos.component' | ||
4 | import { RecommendedVideosStore } from '@app/videos/recommendations/recommended-videos.store' | ||
5 | import { CommonModule } from '@angular/common' | 2 | import { CommonModule } from '@angular/common' |
6 | import { SharedModule } from '@app/shared' | 3 | import { NgModule } from '@angular/core' |
7 | import { RecentVideosRecommendationService } from '@app/videos/recommendations/recent-videos-recommendation.service' | 4 | import { SharedMainModule } from '@app/shared/shared-main' |
5 | import { SharedVideoMiniatureModule } from '@app/shared/shared-video-miniature' | ||
6 | import { SharedVideoPlaylistModule } from '@app/shared/shared-video-playlist' | ||
7 | import { RecentVideosRecommendationService } from './recent-videos-recommendation.service' | ||
8 | import { RecommendedVideosComponent } from './recommended-videos.component' | ||
9 | import { RecommendedVideosStore } from './recommended-videos.store' | ||
8 | 10 | ||
9 | @NgModule({ | 11 | @NgModule({ |
10 | imports: [ | 12 | imports: [ |
13 | CommonModule, | ||
11 | InputSwitchModule, | 14 | InputSwitchModule, |
12 | SharedModule, | 15 | |
13 | CommonModule | 16 | SharedMainModule, |
17 | SharedVideoPlaylistModule, | ||
18 | SharedVideoMiniatureModule | ||
14 | ], | 19 | ], |
15 | declarations: [ | 20 | declarations: [ |
16 | RecommendedVideosComponent | 21 | RecommendedVideosComponent |
diff --git a/client/src/app/videos/recommendations/recommendations.service.ts b/client/src/app/videos/recommendations/recommendations.service.ts index a547e289d..1d79d35f6 100644 --- a/client/src/app/videos/recommendations/recommendations.service.ts +++ b/client/src/app/videos/recommendations/recommendations.service.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { Video } from '@app/shared/video/video.model' | ||
2 | import { RecommendationInfo } from '@app/shared/video/recommendation-info.model' | ||
3 | import { Observable } from 'rxjs' | 1 | import { Observable } from 'rxjs' |
2 | import { Video } from '@app/shared/shared-main' | ||
3 | import { RecommendationInfo } from './recommendation-info.model' | ||
4 | 4 | ||
5 | export interface RecommendationService { | 5 | export interface RecommendationService { |
6 | getRecommendations (recommendation: RecommendationInfo): Observable<Video[]> | 6 | getRecommendations (recommendation: RecommendationInfo): Observable<Video[]> |
diff --git a/client/src/app/videos/recommendations/recommended-videos.component.ts b/client/src/app/videos/recommendations/recommended-videos.component.ts index a6f3bce3d..016975341 100644 --- a/client/src/app/videos/recommendations/recommended-videos.component.ts +++ b/client/src/app/videos/recommendations/recommended-videos.component.ts | |||
@@ -1,15 +1,12 @@ | |||
1 | import { Observable } from 'rxjs' | 1 | import { Observable } from 'rxjs' |
2 | import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core' | 2 | import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core' |
3 | import { AuthService, Notifier } from '@app/core' | 3 | import { AuthService, Notifier, SessionStorageService, User, UserService } from '@app/core' |
4 | import { User } from '@app/shared' | 4 | import { Video } from '@app/shared/shared-main' |
5 | import { SessionStorageService } from '@app/shared/misc/storage.service' | 5 | import { MiniatureDisplayOptions } from '@app/shared/shared-video-miniature' |
6 | import { UserService } from '@app/shared/users/user.service' | 6 | import { VideoPlaylist } from '@app/shared/shared-video-playlist' |
7 | import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' | ||
8 | import { RecommendationInfo } from '@app/shared/video/recommendation-info.model' | ||
9 | import { MiniatureDisplayOptions } from '@app/shared/video/video-miniature.component' | ||
10 | import { Video } from '@app/shared/video/video.model' | ||
11 | import { RecommendedVideosStore } from '@app/videos/recommendations/recommended-videos.store' | ||
12 | import { I18n } from '@ngx-translate/i18n-polyfill' | 7 | import { I18n } from '@ngx-translate/i18n-polyfill' |
8 | import { RecommendationInfo } from './recommendation-info.model' | ||
9 | import { RecommendedVideosStore } from './recommended-videos.store' | ||
13 | 10 | ||
14 | @Component({ | 11 | @Component({ |
15 | selector: 'my-recommended-videos', | 12 | selector: 'my-recommended-videos', |
diff --git a/client/src/app/videos/recommendations/recommended-videos.store.ts b/client/src/app/videos/recommendations/recommended-videos.store.ts index 858ec3a27..8c3fb6480 100644 --- a/client/src/app/videos/recommendations/recommended-videos.store.ts +++ b/client/src/app/videos/recommendations/recommended-videos.store.ts | |||
@@ -1,10 +1,10 @@ | |||
1 | import { Inject, Injectable } from '@angular/core' | ||
2 | import { Observable, ReplaySubject } from 'rxjs' | 1 | import { Observable, ReplaySubject } from 'rxjs' |
3 | import { Video } from '@app/shared/video/video.model' | ||
4 | import { RecommendationInfo } from '@app/shared/video/recommendation-info.model' | ||
5 | import { RecentVideosRecommendationService } from '@app/videos/recommendations/recent-videos-recommendation.service' | ||
6 | import { RecommendationService } from '@app/videos/recommendations/recommendations.service' | ||
7 | import { map, shareReplay, switchMap, take } from 'rxjs/operators' | 2 | import { map, shareReplay, switchMap, take } from 'rxjs/operators' |
3 | import { Inject, Injectable } from '@angular/core' | ||
4 | import { Video } from '@app/shared/shared-main' | ||
5 | import { RecentVideosRecommendationService } from './recent-videos-recommendation.service' | ||
6 | import { RecommendationInfo } from './recommendation-info.model' | ||
7 | import { RecommendationService } from './recommendations.service' | ||
8 | 8 | ||
9 | /** | 9 | /** |
10 | * This store is intended to provide data for the RecommendedVideosComponent. | 10 | * This store is intended to provide data for the RecommendedVideosComponent. |
@@ -20,7 +20,7 @@ export class RecommendedVideosStore { | |||
20 | ) { | 20 | ) { |
21 | this.recommendations$ = this.requestsForLoad$$.pipe( | 21 | this.recommendations$ = this.requestsForLoad$$.pipe( |
22 | switchMap(requestedRecommendation => { | 22 | switchMap(requestedRecommendation => { |
23 | return recommendations.getRecommendations(requestedRecommendation) | 23 | return this.recommendations.getRecommendations(requestedRecommendation) |
24 | .pipe(take(1)) | 24 | .pipe(take(1)) |
25 | }), | 25 | }), |
26 | shareReplay() | 26 | shareReplay() |