From 4428ad543e0c717eb7edb27003b9d9a52c616d5d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 2 May 2022 13:46:09 +0200 Subject: Fix avatar responsive --- .../shared/shared-actor-image/actor-avatar.component.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'client/src/app/shared/shared-actor-image/actor-avatar.component.ts') diff --git a/client/src/app/shared/shared-actor-image/actor-avatar.component.ts b/client/src/app/shared/shared-actor-image/actor-avatar.component.ts index b2e1ef46e..600984aa2 100644 --- a/client/src/app/shared/shared-actor-image/actor-avatar.component.ts +++ b/client/src/app/shared/shared-actor-image/actor-avatar.component.ts @@ -23,7 +23,7 @@ export class ActorAvatarComponent { @Input() previewImage: string - @Input() size: ActorAvatarSize = '32' + @Input() size: ActorAvatarSize // Use an external link @Input() href: string @@ -50,13 +50,13 @@ export class ActorAvatarComponent { } get defaultAvatarUrl () { - if (this.account) return Account.GET_DEFAULT_AVATAR_URL(+this.size) - if (this.channel) return VideoChannel.GET_DEFAULT_AVATAR_URL(+this.size) + if (this.account) return Account.GET_DEFAULT_AVATAR_URL(this.getSizeNumber()) + if (this.channel) return VideoChannel.GET_DEFAULT_AVATAR_URL(this.getSizeNumber()) } get avatarUrl () { - if (this.account) return Account.GET_ACTOR_AVATAR_URL(this.account, +this.size) - if (this.channel) return VideoChannel.GET_ACTOR_AVATAR_URL(this.channel, +this.size) + if (this.account) return Account.GET_ACTOR_AVATAR_URL(this.account, this.getSizeNumber()) + if (this.channel) return VideoChannel.GET_ACTOR_AVATAR_URL(this.channel, this.getSizeNumber()) return '' } @@ -88,6 +88,12 @@ export class ActorAvatarComponent { return !!this.account || !!this.channel } + private getSizeNumber () { + if (this.size) return +this.size + + return undefined + } + private getColorTheme () { const initialLowercase = this.initial.toLowerCase() -- cgit v1.2.3