diff options
Diffstat (limited to 'client/src/app/+videos/video-list/trending/video-trending-header.component.ts')
-rw-r--r-- | client/src/app/+videos/video-list/trending/video-trending-header.component.ts | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/client/src/app/+videos/video-list/trending/video-trending-header.component.ts b/client/src/app/+videos/video-list/trending/video-trending-header.component.ts new file mode 100644 index 000000000..125f14e33 --- /dev/null +++ b/client/src/app/+videos/video-list/trending/video-trending-header.component.ts | |||
@@ -0,0 +1,59 @@ | |||
1 | import { Component, Inject } from '@angular/core' | ||
2 | import { Router } from '@angular/router' | ||
3 | import { VideoListHeaderComponent } from '@app/shared/shared-video-miniature' | ||
4 | import { GlobalIconName } from '@app/shared/shared-icons' | ||
5 | import { VideoSortField } from '@shared/models' | ||
6 | |||
7 | interface VideoTrendingHeaderItem { | ||
8 | label: string | ||
9 | iconName: GlobalIconName | ||
10 | value: VideoSortField | ||
11 | path: string | ||
12 | tooltip?: string | ||
13 | } | ||
14 | |||
15 | @Component({ | ||
16 | selector: 'video-trending-title-page', | ||
17 | host: { 'class': 'title-page title-page-single' }, | ||
18 | styleUrls: [ './video-trending-header.component.scss' ], | ||
19 | templateUrl: './video-trending-header.component.html' | ||
20 | }) | ||
21 | export class VideoTrendingHeaderComponent extends VideoListHeaderComponent { | ||
22 | buttons: VideoTrendingHeaderItem[] | ||
23 | |||
24 | constructor ( | ||
25 | @Inject('data') public data: any, | ||
26 | private router: Router | ||
27 | ) { | ||
28 | super(data) | ||
29 | |||
30 | this.buttons = [ | ||
31 | { | ||
32 | label: $localize`:A variant of Trending videos based on the number of recent interactions:Hot`, | ||
33 | iconName: 'flame', | ||
34 | value: '-hot', | ||
35 | path: 'hot', | ||
36 | tooltip: $localize`Videos totalizing the most interactions for recent videos`, | ||
37 | }, | ||
38 | { | ||
39 | label: $localize`:Main variant of Trending videos based on number of recent views:Views`, | ||
40 | iconName: 'trending', | ||
41 | value: '-trending', | ||
42 | path: 'trending', | ||
43 | tooltip: $localize`Videos totalizing the most views during the last 24 hours`, | ||
44 | }, | ||
45 | { | ||
46 | label: $localize`:a variant of Trending videos based on the number of likes:Likes`, | ||
47 | iconName: 'like', | ||
48 | value: '-likes', | ||
49 | path: 'most-liked', | ||
50 | tooltip: $localize`Videos that have the most likes` | ||
51 | } | ||
52 | ] | ||
53 | } | ||
54 | |||
55 | setSort () { | ||
56 | const path = this.buttons.find(b => b.value === this.data.model).path | ||
57 | this.router.navigate([ `/videos/${path}` ]) | ||
58 | } | ||
59 | } | ||