import { Account } from '@app/shared/account/account.model'
import { Notifier } from '@app/core'
import { ServerConfig } from '@shared/models'
+import { BytesPipe } from 'ngx-pipes'
+import { I18n } from '@ngx-translate/i18n-polyfill'
@Component({
selector: 'my-actor-avatar-info',
styleUrls: [ './actor-avatar-info.component.scss' ]
})
export class ActorAvatarInfoComponent implements OnInit {
- @ViewChild('avatarfileInput', { static: false }) avatarfileInput: ElementRef<HTMLInputElement>
+ @ViewChild('avatarfileInput') avatarfileInput: ElementRef<HTMLInputElement>
@Input() actor: VideoChannel | Account
@Output() avatarChange = new EventEmitter<FormData>()
+ maxSizeText: string
+
private serverConfig: ServerConfig
+ private bytesPipe: BytesPipe
constructor (
private serverService: ServerService,
- private notifier: Notifier
- ) {}
+ private notifier: Notifier,
+ private i18n: I18n
+ ) {
+ this.bytesPipe = new BytesPipe()
+ this.maxSizeText = this.i18n('max size')
+ }
ngOnInit (): void {
this.serverConfig = this.serverService.getTmpConfig()
return this.serverConfig.avatar.file.size.max
}
+ get maxAvatarSizeInBytes () {
+ return this.bytesPipe.transform(this.maxAvatarSize)
+ }
+
get avatarExtensions () {
- return this.serverConfig.avatar.file.extensions.join(',')
+ return this.serverConfig.avatar.file.extensions.join(', ')
}
}