1 import { Component, OnInit, ViewChild } from '@angular/core'
2 import { Notifier, ServerService } from '@app/core'
3 import { I18n } from '@ngx-translate/i18n-polyfill'
4 import { ContactAdminModalComponent } from '@app/+about/about-instance/contact-admin-modal.component'
5 import { InstanceService } from '@app/shared/instance/instance.service'
6 import { MarkdownService } from '@app/shared/renderer'
7 import { forkJoin } from 'rxjs'
8 import { first } from 'rxjs/operators'
11 selector: 'my-about-instance',
12 templateUrl: './about-instance.component.html',
13 styleUrls: [ './about-instance.component.scss' ]
15 export class AboutInstanceComponent implements OnInit {
16 @ViewChild('contactAdminModal', { static: true }) contactAdminModal: ContactAdminModalComponent
24 moderationInformation: '',
29 maintenanceLifetime = ''
32 languages: string[] = []
33 categories: string[] = []
36 private notifier: Notifier,
37 private serverService: ServerService,
38 private instanceService: InstanceService,
39 private markdownService: MarkdownService,
44 return this.serverService.getConfig().instance.name
47 get isContactFormEnabled () {
48 return this.serverService.getConfig().email.enabled && this.serverService.getConfig().contactForm.enabled
52 return this.serverService.getConfig().instance.isNSFW
57 this.instanceService.getAbout(),
58 this.serverService.localeObservable.pipe(first()),
59 this.serverService.videoLanguagesLoaded.pipe(first()),
60 this.serverService.videoCategoriesLoaded.pipe(first())
62 async ([ about, translations ]) => {
63 this.shortDescription = about.instance.shortDescription
65 this.creationReason = about.instance.creationReason
66 this.maintenanceLifetime = about.instance.maintenanceLifetime
67 this.businessModel = about.instance.businessModel
69 this.html = await this.instanceService.buildHtml(about)
71 this.languages = this.instanceService.buildTranslatedLanguages(about, translations)
72 this.categories = this.instanceService.buildTranslatedCategories(about, translations)
75 () => this.notifier.error(this.i18n('Cannot get about information from server'))
80 return this.contactAdminModal.show()