aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/src/app/menu/menu.component.html5
-rw-r--r--client/src/app/videos/video-list/index.ts1
-rw-r--r--client/src/app/videos/video-list/video-most-liked.component.ts71
-rw-r--r--client/src/app/videos/videos-routing.module.ts14
-rw-r--r--client/src/app/videos/videos.module.ts2
5 files changed, 93 insertions, 0 deletions
diff --git a/client/src/app/menu/menu.component.html b/client/src/app/menu/menu.component.html
index 7eb6f7b35..a29e145ad 100644
--- a/client/src/app/menu/menu.component.html
+++ b/client/src/app/menu/menu.component.html
@@ -71,6 +71,11 @@
71 <ng-container i18n>Trending</ng-container> 71 <ng-container i18n>Trending</ng-container>
72 </a> 72 </a>
73 73
74 <a routerLink="/videos/most-liked" routerLinkActive="active">
75 <my-global-icon iconName="like"></my-global-icon>
76 <ng-container i18n>Most liked</ng-container>
77 </a>
78
74 <a routerLink="/videos/recently-added" routerLinkActive="active"> 79 <a routerLink="/videos/recently-added" routerLinkActive="active">
75 <my-global-icon iconName="recently-added"></my-global-icon> 80 <my-global-icon iconName="recently-added"></my-global-icon>
76 <ng-container i18n>Recently added</ng-container> 81 <ng-container i18n>Recently added</ng-container>
diff --git a/client/src/app/videos/video-list/index.ts b/client/src/app/videos/video-list/index.ts
index 5f7c8bd48..b367110ae 100644
--- a/client/src/app/videos/video-list/index.ts
+++ b/client/src/app/videos/video-list/index.ts
@@ -1,3 +1,4 @@
1export * from './video-local.component' 1export * from './video-local.component'
2export * from './video-recently-added.component' 2export * from './video-recently-added.component'
3export * from './video-trending.component' 3export * from './video-trending.component'
4export * from './video-most-liked.component'
diff --git a/client/src/app/videos/video-list/video-most-liked.component.ts b/client/src/app/videos/video-list/video-most-liked.component.ts
new file mode 100644
index 000000000..aff8413eb
--- /dev/null
+++ b/client/src/app/videos/video-list/video-most-liked.component.ts
@@ -0,0 +1,71 @@
1import { Component, OnInit } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router'
3import { immutableAssign } from '@app/shared/misc/utils'
4import { AuthService } from '../../core/auth'
5import { AbstractVideoList } from '../../shared/video/abstract-video-list'
6import { VideoSortField } from '../../shared/video/sort-field.type'
7import { VideoService } from '../../shared/video/video.service'
8import { I18n } from '@ngx-translate/i18n-polyfill'
9import { ScreenService } from '@app/shared/misc/screen.service'
10import { Notifier, ServerService } from '@app/core'
11import { HooksService } from '@app/core/plugins/hooks.service'
12
13@Component({
14 selector: 'my-videos-most-liked',
15 styleUrls: [ '../../shared/video/abstract-video-list.scss' ],
16 templateUrl: '../../shared/video/abstract-video-list.html'
17})
18export class VideoMostLikedComponent extends AbstractVideoList implements OnInit {
19 titlePage: string
20 defaultSort: VideoSortField = '-likes'
21
22 useUserVideoLanguagePreferences = true
23
24 constructor (
25 protected i18n: I18n,
26 protected router: Router,
27 protected serverService: ServerService,
28 protected route: ActivatedRoute,
29 protected notifier: Notifier,
30 protected authService: AuthService,
31 protected screenService: ScreenService,
32 private videoService: VideoService,
33 private hooks: HooksService
34 ) {
35 super()
36 }
37
38 ngOnInit () {
39 super.ngOnInit()
40
41 this.generateSyndicationList()
42
43 this.serverService.configLoaded.subscribe(
44 () => {
45 this.titlePage = this.i18n('Most liked videos')
46 this.titleTooltip = this.i18n('Videos that have the higher number of likes.')
47 })
48 }
49
50 getVideosObservable (page: number) {
51 const newPagination = immutableAssign(this.pagination, { currentPage: page })
52 const params = {
53 videoPagination: newPagination,
54 sort: this.sort,
55 categoryOneOf: this.categoryOneOf,
56 languageOneOf: this.languageOneOf
57 }
58
59 return this.hooks.wrapObsFun(
60 this.videoService.getVideos.bind(this.videoService),
61 params,
62 'common',
63 'filter:api.most-liked-videos.videos.list.params',
64 'filter:api.most-liked-videos.videos.list.result'
65 )
66 }
67
68 generateSyndicationList () {
69 this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, undefined, this.categoryOneOf)
70 }
71}
diff --git a/client/src/app/videos/videos-routing.module.ts b/client/src/app/videos/videos-routing.module.ts
index f0049d8c4..11a087d0a 100644
--- a/client/src/app/videos/videos-routing.module.ts
+++ b/client/src/app/videos/videos-routing.module.ts
@@ -4,6 +4,7 @@ import { VideoLocalComponent } from '@app/videos/video-list/video-local.componen
4import { MetaGuard } from '@ngx-meta/core' 4import { MetaGuard } from '@ngx-meta/core'
5import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component' 5import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component'
6import { VideoTrendingComponent } from './video-list/video-trending.component' 6import { VideoTrendingComponent } from './video-list/video-trending.component'
7import { VideoMostLikedComponent } from './video-list/video-most-liked.component'
7import { VideosComponent } from './videos.component' 8import { VideosComponent } from './videos.component'
8import { VideoUserSubscriptionsComponent } from '@app/videos/video-list/video-user-subscriptions.component' 9import { VideoUserSubscriptionsComponent } from '@app/videos/video-list/video-user-subscriptions.component'
9import { VideoOverviewComponent } from '@app/videos/video-list/video-overview.component' 10import { VideoOverviewComponent } from '@app/videos/video-list/video-overview.component'
@@ -37,6 +38,19 @@ const videosRoutes: Routes = [
37 } 38 }
38 }, 39 },
39 { 40 {
41 path: 'most-liked',
42 component: VideoMostLikedComponent,
43 data: {
44 meta: {
45 title: 'Most liked videos'
46 },
47 reuse: {
48 enabled: true,
49 key: 'most-liked-videos-list'
50 }
51 }
52 },
53 {
40 path: 'recently-added', 54 path: 'recently-added',
41 component: VideoRecentlyAddedComponent, 55 component: VideoRecentlyAddedComponent,
42 data: { 56 data: {
diff --git a/client/src/app/videos/videos.module.ts b/client/src/app/videos/videos.module.ts
index 5cf1e944f..95078a734 100644
--- a/client/src/app/videos/videos.module.ts
+++ b/client/src/app/videos/videos.module.ts
@@ -3,6 +3,7 @@ import { VideoLocalComponent } from '@app/videos/video-list/video-local.componen
3import { SharedModule } from '../shared' 3import { SharedModule } from '../shared'
4import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component' 4import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component'
5import { VideoTrendingComponent } from './video-list/video-trending.component' 5import { VideoTrendingComponent } from './video-list/video-trending.component'
6import { VideoMostLikedComponent } from './video-list/video-most-liked.component'
6import { VideosRoutingModule } from './videos-routing.module' 7import { VideosRoutingModule } from './videos-routing.module'
7import { VideosComponent } from './videos.component' 8import { VideosComponent } from './videos.component'
8import { VideoUserSubscriptionsComponent } from '@app/videos/video-list/video-user-subscriptions.component' 9import { VideoUserSubscriptionsComponent } from '@app/videos/video-list/video-user-subscriptions.component'
@@ -18,6 +19,7 @@ import { VideoOverviewComponent } from '@app/videos/video-list/video-overview.co
18 VideosComponent, 19 VideosComponent,
19 20
20 VideoTrendingComponent, 21 VideoTrendingComponent,
22 VideoMostLikedComponent,
21 VideoRecentlyAddedComponent, 23 VideoRecentlyAddedComponent,
22 VideoLocalComponent, 24 VideoLocalComponent,
23 VideoUserSubscriptionsComponent, 25 VideoUserSubscriptionsComponent,