]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-actor-image/actor-avatar.component.ts
Fix miniature avatar size
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-actor-image / actor-avatar.component.ts
index 6bb3b65fa31a826835a24285d050ba3e7a353da8..e74dd163484105e34b3c3058c30b1053e27bc7f6 100644 (file)
@@ -9,6 +9,8 @@ type ActorInput = {
   url: string
 }
 
+export type ActorAvatarSize = '18' | '25' | '32' | '34' | '36' | '40' | '100' | '120'
+
 @Component({
   selector: 'my-actor-avatar',
   styleUrls: [ './actor-avatar.component.scss' ],
@@ -20,7 +22,7 @@ export class ActorAvatarComponent {
 
   @Input() previewImage: SafeResourceUrl
 
-  @Input() size: '18' | '25' | '32' | '34' | '36' | '40' | '100' | '120'
+  @Input() size: ActorAvatarSize
 
   // Use an external link
   @Input() href: string
@@ -48,7 +50,7 @@ export class ActorAvatarComponent {
     return ''
   }
 
-  get class () {
+  getClass (type: 'avatar' | 'initial') {
     const base = [ 'avatar' ]
 
     if (this.size) base.push(`avatar-${this.size}`)
@@ -56,7 +58,7 @@ export class ActorAvatarComponent {
     if (this.account) base.push('account')
     else base.push('channel')
 
-    if (this.initial) {
+    if (type === 'initial' && this.initial) {
       base.push('initial')
       base.push(this.getColorTheme())
     }
@@ -73,7 +75,7 @@ export class ActorAvatarComponent {
 
   get avatarUrl () {
     if (this.account) return Account.GET_ACTOR_AVATAR_URL(this.account)
-    if (this.channel) return VideoChannel.GET_ACTOR_AVATAR_URL(this.account)
+    if (this.channel) return VideoChannel.GET_ACTOR_AVATAR_URL(this.channel)
 
     return ''
   }
@@ -98,7 +100,7 @@ export class ActorAvatarComponent {
       jkl: 'gray',
       mno: 'yellow',
       pqr: 'orange',
-      stv: 'red',
+      stvu: 'red',
       wxyz: 'dark-blue'
     }