1 import { Component, OnDestroy, OnInit } from '@angular/core'
2 import { Account } from '@app/shared/account/account.model'
3 import { AccountService } from '@app/shared/account/account.service'
4 import { I18n } from '@ngx-translate/i18n-polyfill'
5 import { Subscription } from 'rxjs'
6 import { MarkdownService } from '@app/shared/renderer'
9 selector: 'my-account-about',
10 templateUrl: './account-about.component.html',
11 styleUrls: [ './account-about.component.scss' ]
13 export class AccountAboutComponent implements OnInit, OnDestroy {
17 private accountSub: Subscription
21 private accountService: AccountService,
22 private markdownService: MarkdownService
26 // Parent get the account for us
27 this.accountSub = this.accountService.accountLoaded
28 .subscribe(async account => {
29 this.account = account
30 this.descriptionHTML = await this.markdownService.textMarkdownToHTML(this.account.description, true)
35 if (this.accountSub) this.accountSub.unsubscribe()
38 getAccountDescription () {
39 if (this.descriptionHTML) return this.descriptionHTML
41 return this.i18n('No description')