]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - client/src/app/+accounts/account-about/account-about.component.ts
add theming via css custom properties
[github/Chocobozzz/PeerTube.git] / client / src / app / +accounts / account-about / account-about.component.ts
... / ...
CommitLineData
1import { Component, OnInit, OnDestroy } from '@angular/core'
2import { ActivatedRoute } from '@angular/router'
3import { Account } from '@app/shared/account/account.model'
4import { AccountService } from '@app/shared/account/account.service'
5import { I18n } from '@ngx-translate/i18n-polyfill'
6import { Subscription } from 'rxjs'
7import { MarkdownService } from '@app/videos/shared'
8
9@Component({
10 selector: 'my-account-about',
11 templateUrl: './account-about.component.html',
12 styleUrls: [ './account-about.component.scss' ]
13})
14export class AccountAboutComponent implements OnInit, OnDestroy {
15 account: Account
16 descriptionHTML = ''
17
18 private accountSub: Subscription
19
20 constructor (
21 private route: ActivatedRoute,
22 private i18n: I18n,
23 private accountService: AccountService,
24 private markdownService: MarkdownService
25 ) { }
26
27 ngOnInit () {
28 // Parent get the account for us
29 this.accountSub = this.accountService.accountLoaded
30 .subscribe(account => {
31 this.account = account
32 this.descriptionHTML = this.markdownService.textMarkdownToHTML(this.account.description)
33 })
34 }
35
36 ngOnDestroy () {
37 if (this.accountSub) this.accountSub.unsubscribe()
38 }
39
40 getAccountDescription () {
41 if (this.descriptionHTML) return this.descriptionHTML
42
43 return this.i18n('No description')
44 }
45}