]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/+videos/video-list/videos-list-common-page.component.ts
Support ICU in TS components
[github/Chocobozzz/PeerTube.git] / client / src / app / +videos / video-list / videos-list-common-page.component.ts
index ba64d4feca8e4861b8644b96875d7fa39af8b4f1..c8fa8ef302c59bc9d0f68a4a67ec8ccd6ce9752b 100644 (file)
@@ -85,7 +85,7 @@ export class VideosListCommonPageComponent implements OnInit, OnDestroy, Disable
   getSyndicationItems (filters: VideoFilters) {
     const result = filters.toVideosAPIObject()
 
-    return this.videoService.getVideoFeedUrls(result.sort, result.filter)
+    return this.videoService.getVideoFeedUrls(result.sort, result.isLocal)
   }
 
   onFiltersChanged (filters: VideoFilters) {
@@ -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
     }
@@ -197,16 +201,31 @@ export class VideosListCommonPageComponent implements OnInit, OnDestroy, Disable
       return
     }
 
-    if ([ 'best', 'hot', 'trending', 'likes' ].includes(sanitizedSort)) {
+    if ([ 'hot', 'trending', 'likes', 'views' ].includes(sanitizedSort)) {
       this.title = $localize`Trending`
 
-      if (sanitizedSort === 'best') this.titleTooltip = $localize`Videos with the most interactions for recent videos, minus user history`
-      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 === '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