1 import { Subscription } from 'rxjs'
2 import { Component, OnDestroy, OnInit } from '@angular/core'
3 import { MarkdownService } from '@app/core'
4 import { Account, AccountService } from '@app/shared/shared-main'
5 import { I18n } from '@ngx-translate/i18n-polyfill'
8 selector: 'my-account-about',
9 templateUrl: './account-about.component.html',
10 styleUrls: [ './account-about.component.scss' ]
12 export class AccountAboutComponent implements OnInit, OnDestroy {
16 private accountSub: Subscription
20 private accountService: AccountService,
21 private markdownService: MarkdownService
25 // Parent get the account for us
26 this.accountSub = this.accountService.accountLoaded
27 .subscribe(async account => {
28 this.account = account
29 this.descriptionHTML = await this.markdownService.textMarkdownToHTML(this.account.description, true)
34 if (this.accountSub) this.accountSub.unsubscribe()
37 getAccountDescription () {
38 if (this.descriptionHTML) return this.descriptionHTML
40 return this.i18n('No description')