diff options
author | kontrollanten <6680299+kontrollanten@users.noreply.github.com> | 2022-02-28 08:34:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-28 08:34:43 +0100 |
commit | d0800f7661f13fabe7bb6f4aa0ea50764f106405 (patch) | |
tree | d43e6b0b6f4a5a32e03487e6464edbcaf288be2a /client/src/app/shared/shared-actor-image/actor-avatar.component.ts | |
parent | 5cad2ca9db9b9d138f8a33058d10b94a9fd50c69 (diff) | |
download | PeerTube-d0800f7661f13fabe7bb6f4aa0ea50764f106405.tar.gz PeerTube-d0800f7661f13fabe7bb6f4aa0ea50764f106405.tar.zst PeerTube-d0800f7661f13fabe7bb6f4aa0ea50764f106405.zip |
Implement avatar miniatures (#4639)
* client: remove unused file
* refactor(client/my-actor-avatar): size from input
Read size from component input instead of scss, to make it possible to
use smaller avatar images when implemented.
* implement avatar miniatures
close #4560
* fix(test): max file size
* fix(search-index): normalize res acc to avatarMini
* refactor avatars to an array
* client/search: resize channel avatar to 120
* refactor(client/videos): remove unused function
* client(actor-avatar): set default size
* fix tests and avatars full result
When findOne is used only an array containting one avatar is returned.
* update migration version and version notations
* server/search: harmonize normalizing
* Cleanup avatar miniature PR
Co-authored-by: Chocobozzz <me@florianbigard.com>
Diffstat (limited to 'client/src/app/shared/shared-actor-image/actor-avatar.component.ts')
-rw-r--r-- | client/src/app/shared/shared-actor-image/actor-avatar.component.ts | 15 |
1 files changed, 7 insertions, 8 deletions
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 c323dc724..bc7e8a096 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 | |||
@@ -4,11 +4,11 @@ import { Account } from '../shared-main/account/account.model' | |||
4 | 4 | ||
5 | type ActorInput = { | 5 | type ActorInput = { |
6 | name: string | 6 | name: string |
7 | avatar?: { url?: string, path: string } | 7 | avatars: { width: number, url?: string, path: string }[] |
8 | url: string | 8 | url: string |
9 | } | 9 | } |
10 | 10 | ||
11 | export type ActorAvatarSize = '18' | '25' | '32' | '34' | '36' | '40' | '100' | '120' | 11 | export type ActorAvatarSize = '18' | '25' | '28' | '32' | '34' | '35' | '36' | '40' | '48' | '75' | '80' | '100' | '120' |
12 | 12 | ||
13 | @Component({ | 13 | @Component({ |
14 | selector: 'my-actor-avatar', | 14 | selector: 'my-actor-avatar', |
@@ -23,7 +23,7 @@ export class ActorAvatarComponent { | |||
23 | 23 | ||
24 | @Input() previewImage: string | 24 | @Input() previewImage: string |
25 | 25 | ||
26 | @Input() size: ActorAvatarSize | 26 | @Input() size: ActorAvatarSize = '32' |
27 | 27 | ||
28 | // Use an external link | 28 | // Use an external link |
29 | @Input() href: string | 29 | @Input() href: string |
@@ -50,14 +50,13 @@ export class ActorAvatarComponent { | |||
50 | } | 50 | } |
51 | 51 | ||
52 | get defaultAvatarUrl () { | 52 | get defaultAvatarUrl () { |
53 | if (this.channel) return VideoChannel.GET_DEFAULT_AVATAR_URL() | 53 | if (this.account) return Account.GET_DEFAULT_AVATAR_URL(+this.size) |
54 | 54 | if (this.channel) return VideoChannel.GET_DEFAULT_AVATAR_URL(+this.size) | |
55 | return Account.GET_DEFAULT_AVATAR_URL() | ||
56 | } | 55 | } |
57 | 56 | ||
58 | get avatarUrl () { | 57 | get avatarUrl () { |
59 | if (this.account) return Account.GET_ACTOR_AVATAR_URL(this.account) | 58 | if (this.account) return Account.GET_ACTOR_AVATAR_URL(this.account, +this.size) |
60 | if (this.channel) return VideoChannel.GET_ACTOR_AVATAR_URL(this.channel) | 59 | if (this.channel) return VideoChannel.GET_ACTOR_AVATAR_URL(this.channel, +this.size) |
61 | 60 | ||
62 | return '' | 61 | return '' |
63 | } | 62 | } |