X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2F%2Bvideos%2Fvideo-list%2Fvideos-list-common-page.component.ts;h=c8fa8ef302c59bc9d0f68a4a67ec8ccd6ce9752b;hb=5b0ec7cddb1ae6dbd2057f067382866f846b882c;hp=72c7e1ef69f9c9929ccaea703ff78c548d66dfed;hpb=db19581fb25a28cd226aa2a411db3b78a72b6f09;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/+videos/video-list/videos-list-common-page.component.ts b/client/src/app/+videos/video-list/videos-list-common-page.component.ts index 72c7e1ef6..c8fa8ef30 100644 --- a/client/src/app/+videos/video-list/videos-list-common-page.component.ts +++ b/client/src/app/+videos/video-list/videos-list-common-page.component.ts @@ -173,6 +173,10 @@ export class VideosListCommonPageComponent implements OnInit, OnDestroy, Disable case 'most-liked': return '-likes' + // We'll automatically apply "best" sort if using "hot" sort with a logged user + case 'best': + return '-hot' + default: return '-' + algorithm as VideoSortField } @@ -200,13 +204,28 @@ export class VideosListCommonPageComponent implements OnInit, OnDestroy, Disable if ([ 'hot', 'trending', 'likes', 'views' ].includes(sanitizedSort)) { this.title = $localize`Trending` - if (sanitizedSort === 'hot') this.titleTooltip = $localize`Videos with the most interactions for recent videos` - if (sanitizedSort === 'likes') this.titleTooltip = $localize`Videos that have the most likes` - if (sanitizedSort === 'views') this.titleTooltip = undefined + if (sanitizedSort === 'hot') { + this.titleTooltip = $localize`Videos with the most interactions for recent videos` + return + } + + if (sanitizedSort === 'likes') { + this.titleTooltip = $localize`Videos that have the most likes` + return + } + + if (sanitizedSort === 'views') { + this.titleTooltip = undefined + return + } if (sanitizedSort === 'trending') { - if (this.trendingDays === 1) this.titleTooltip = $localize`Videos with the most views during the last 24 hours` - else this.titleTooltip = $localize`Videos with the most views during the last ${this.trendingDays} days` + if (this.trendingDays === 1) { + this.titleTooltip = $localize`Videos with the most views during the last 24 hours` + return + } + + this.titleTooltip = $localize`Videos with the most views during the last ${this.trendingDays} days` } return