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