]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts
Support ICU in TS components
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-video-miniature / video-actions-dropdown.component.ts
index 5eef96145a87bc2354bc8ece553db1283544116c..ed6a4afc0f90c3980c0531f2fe223c91a33e38ef 100644 (file)
@@ -30,6 +30,7 @@ export type VideoActionsDisplayType = {
   removeFiles?: boolean
   transcoding?: boolean
   studio?: boolean
+  stats?: boolean
 }
 
 @Component({
@@ -61,9 +62,11 @@ export class VideoActionsDropdownComponent implements OnChanges {
     liveInfo: false,
     removeFiles: false,
     transcoding: false,
-    studio: true
+    studio: true,
+    stats: true
   }
   @Input() placement = 'left'
+  @Input() moreActions: DropdownAction<{ video: Video }>[][] = []
 
   @Input() label: string
 
@@ -156,6 +159,10 @@ export class VideoActionsDropdownComponent implements OnChanges {
     return this.video.isEditableBy(this.user, this.serverService.getHTMLConfig().videoStudio.enabled)
   }
 
+  isVideoStatsAvailable () {
+    return this.video.canSeeStats(this.user)
+  }
+
   isVideoRemovable () {
     return this.video.isRemovableBy(this.user)
   }
@@ -342,6 +349,12 @@ export class VideoActionsDropdownComponent implements OnChanges {
           iconName: 'film',
           isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.studio && this.isVideoEditable()
         },
+        {
+          label: $localize`Stats`,
+          linkBuilder: ({ video }) => [ '/stats/videos', video.uuid ],
+          iconName: 'stats',
+          isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.stats && this.isVideoStatsAvailable()
+        },
         {
           label: $localize`Block`,
           handler: () => this.showBlockModal(),
@@ -408,5 +421,7 @@ export class VideoActionsDropdownComponent implements OnChanges {
         }
       ]
     ]
+
+    this.videoActions = this.videoActions.concat(this.moreActions)
   }
 }