diff options
author | Aurélien Béranger <43744761+auberanger@users.noreply.github.com> | 2019-01-14 09:06:48 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-01-14 09:06:48 +0100 |
commit | 9b4b15f91c485f9a7fe2ed314b4101f4b7506b38 (patch) | |
tree | 6ab137f0d309da68ab357602ddd7f56390280a72 /client/src | |
parent | e902e03f0fd2eded99d635b1f9d2c59f417c4721 (diff) | |
download | PeerTube-9b4b15f91c485f9a7fe2ed314b4101f4b7506b38.tar.gz PeerTube-9b4b15f91c485f9a7fe2ed314b4101f4b7506b38.tar.zst PeerTube-9b4b15f91c485f9a7fe2ed314b4101f4b7506b38.zip |
WIP : Indicate to users how "trending" works (#1458)
* Get the INTERVAL_DAYS const in the video-trending component
* Change Trending section title
* Add a tooltip to explain how trending section works
* Minor CSS fix for the my-feed popover next to the titlepage
Diffstat (limited to 'client/src')
5 files changed, 22 insertions, 4 deletions
diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.ts index f33e6f20c..4ae72427b 100644 --- a/client/src/app/core/server/server.service.ts +++ b/client/src/app/core/server/server.service.ts | |||
@@ -87,6 +87,11 @@ export class ServerService { | |||
87 | enabled: false | 87 | enabled: false |
88 | } | 88 | } |
89 | } | 89 | } |
90 | }, | ||
91 | trending: { | ||
92 | videos: { | ||
93 | intervalDays: 0 | ||
94 | } | ||
90 | } | 95 | } |
91 | } | 96 | } |
92 | private videoCategories: Array<VideoConstant<number>> = [] | 97 | private videoCategories: Array<VideoConstant<number>> = [] |
diff --git a/client/src/app/shared/video/abstract-video-list.html b/client/src/app/shared/video/abstract-video-list.html index 29492351b..1f97bc389 100644 --- a/client/src/app/shared/video/abstract-video-list.html +++ b/client/src/app/shared/video/abstract-video-list.html | |||
@@ -1,8 +1,11 @@ | |||
1 | <div [ngClass]="{ 'margin-content': marginContent }"> | 1 | <div [ngClass]="{ 'margin-content': marginContent }"> |
2 | <div class="videos-header"> | 2 | <div class="videos-header"> |
3 | <div *ngIf="titlePage" class="title-page title-page-single"> | 3 | <div *ngIf="titlePage" class="title-page title-page-single"> |
4 | {{ titlePage }} | 4 | <div placement="bottom" [ngbTooltip]="titleTooltip" container="body"> |
5 | {{ titlePage }} | ||
6 | </div> | ||
5 | </div> | 7 | </div> |
8 | |||
6 | <my-feed [syndicationItems]="syndicationItems"></my-feed> | 9 | <my-feed [syndicationItems]="syndicationItems"></my-feed> |
7 | 10 | ||
8 | <div class="moderation-block" *ngIf="displayModerationBlock"> | 11 | <div class="moderation-block" *ngIf="displayModerationBlock"> |
diff --git a/client/src/app/shared/video/abstract-video-list.scss b/client/src/app/shared/video/abstract-video-list.scss index 9fb3fd4d6..292ede698 100644 --- a/client/src/app/shared/video/abstract-video-list.scss +++ b/client/src/app/shared/video/abstract-video-list.scss | |||
@@ -19,8 +19,8 @@ | |||
19 | 19 | ||
20 | my-feed { | 20 | my-feed { |
21 | display: inline-block; | 21 | display: inline-block; |
22 | position: relative; | ||
23 | top: 1px; | 22 | top: 1px; |
23 | min-width: 60px; | ||
24 | } | 24 | } |
25 | 25 | ||
26 | .moderation-block { | 26 | .moderation-block { |
diff --git a/client/src/app/shared/video/abstract-video-list.ts b/client/src/app/shared/video/abstract-video-list.ts index d234c8bfa..d74384293 100644 --- a/client/src/app/shared/video/abstract-video-list.ts +++ b/client/src/app/shared/video/abstract-video-list.ts | |||
@@ -39,6 +39,8 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy { | |||
39 | ownerDisplayType: OwnerDisplayType = 'account' | 39 | ownerDisplayType: OwnerDisplayType = 'account' |
40 | firstLoadedPage: number | 40 | firstLoadedPage: number |
41 | displayModerationBlock = false | 41 | displayModerationBlock = false |
42 | trendingDays: number | ||
43 | titleTooltip: string | ||
42 | 44 | ||
43 | protected baseVideoWidth = 215 | 45 | protected baseVideoWidth = 215 |
44 | protected baseVideoHeight = 205 | 46 | protected baseVideoHeight = 205 |
diff --git a/client/src/app/videos/video-list/video-trending.component.ts b/client/src/app/videos/video-list/video-trending.component.ts index accc5bfe5..d3c0f5316 100644 --- a/client/src/app/videos/video-list/video-trending.component.ts +++ b/client/src/app/videos/video-list/video-trending.component.ts | |||
@@ -8,7 +8,7 @@ import { VideoSortField } from '../../shared/video/sort-field.type' | |||
8 | import { VideoService } from '../../shared/video/video.service' | 8 | import { VideoService } from '../../shared/video/video.service' |
9 | import { I18n } from '@ngx-translate/i18n-polyfill' | 9 | import { I18n } from '@ngx-translate/i18n-polyfill' |
10 | import { ScreenService } from '@app/shared/misc/screen.service' | 10 | import { ScreenService } from '@app/shared/misc/screen.service' |
11 | import { Notifier } from '@app/core' | 11 | import { Notifier, ServerService } from '@app/core' |
12 | 12 | ||
13 | @Component({ | 13 | @Component({ |
14 | selector: 'my-videos-trending', | 14 | selector: 'my-videos-trending', |
@@ -19,6 +19,7 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit, | |||
19 | titlePage: string | 19 | titlePage: string |
20 | currentRoute = '/videos/trending' | 20 | currentRoute = '/videos/trending' |
21 | defaultSort: VideoSortField = '-trending' | 21 | defaultSort: VideoSortField = '-trending' |
22 | trendingDays: number | ||
22 | 23 | ||
23 | constructor ( | 24 | constructor ( |
24 | protected router: Router, | 25 | protected router: Router, |
@@ -27,12 +28,19 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit, | |||
27 | protected authService: AuthService, | 28 | protected authService: AuthService, |
28 | protected location: Location, | 29 | protected location: Location, |
29 | protected screenService: ScreenService, | 30 | protected screenService: ScreenService, |
31 | private serverService: ServerService, | ||
30 | protected i18n: I18n, | 32 | protected i18n: I18n, |
31 | private videoService: VideoService | 33 | private videoService: VideoService |
32 | ) { | 34 | ) { |
33 | super() | 35 | super() |
34 | 36 | ||
35 | this.titlePage = i18n('Trending') | 37 | this.trendingDays = this.serverService.getConfig().trending.videos.intervalDays |
38 | |||
39 | this.titlePage = this.i18n('Trending for the last ') | ||
40 | this.trendingDays === 1 ? this.titlePage += '24 hours' : this.titlePage += this.trendingDays + ' days' | ||
41 | |||
42 | this.titleTooltip = this.i18n('trending videos are those totalizing the greatest number of views during the last ') | ||
43 | this.trendingDays === 1 ? this.titleTooltip += '24 hours.' : this.titleTooltip += this.trendingDays + ' days.' | ||
36 | } | 44 | } |
37 | 45 | ||
38 | ngOnInit () { | 46 | ngOnInit () { |