]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/images/global-icon.component.ts
add channel avatar to watch view
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / images / global-icon.component.ts
index a13b7d8e05bb00bf3259e63e5d4b7cbbebba754b..31cfe26664249be81256dbaef8968cb99ea7cba8 100644 (file)
@@ -1,4 +1,5 @@
 import { ChangeDetectionStrategy, Component, ElementRef, Input, OnInit } from '@angular/core'
+import { HooksService } from '@app/core/plugins/hooks.service'
 
 const icons = {
   'add': require('!!raw-loader?!../../../assets/images/global/add.svg'),
@@ -25,6 +26,7 @@ const icons = {
   'cross': require('!!raw-loader?!../../../assets/images/global/cross.svg'),
   'validate': require('!!raw-loader?!../../../assets/images/global/validate.svg'),
   'tick': require('!!raw-loader?!../../../assets/images/global/tick.svg'),
+  'repeat': require('!!raw-loader?!../../../assets/images/global/repeat.svg'),
   'dislike': require('!!raw-loader?!../../../assets/images/video/dislike.svg'),
   'support': require('!!raw-loader?!../../../assets/images/video/support.svg'),
   'like': require('!!raw-loader?!../../../assets/images/video/like.svg'),
@@ -60,11 +62,24 @@ export type GlobalIconName = keyof typeof icons
 export class GlobalIconComponent implements OnInit {
   @Input() iconName: GlobalIconName
 
-  constructor (private el: ElementRef) {}
+  constructor (
+    private el: ElementRef,
+    private hooks: HooksService
+  ) { }
 
-  ngOnInit () {
+  async ngOnInit () {
     const nativeElement = this.el.nativeElement
 
-    nativeElement.innerHTML = icons[this.iconName]
+    nativeElement.innerHTML = await this.hooks.wrapFun(
+      this.getSVGContent.bind(this),
+      { name: this.iconName },
+      'common',
+      'filter:internal.common.svg-icons.get-content.params',
+      'filter:internal.common.svg-icons.get-content.result'
+    )
+  }
+
+  private getSVGContent (options: { name: string }) {
+    return icons[options.name]
   }
 }