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: '',
28 maintenanceLifetime = ''
31 languages: string[] = []
32 categories: string[] = []
35 private notifier: Notifier,
36 private serverService: ServerService,
37 private instanceService: InstanceService,
38 private markdownService: MarkdownService,
43 return this.serverService.getConfig().instance.name
46 get isContactFormEnabled () {
47 return this.serverService.getConfig().email.enabled && this.serverService.getConfig().contactForm.enabled
51 return this.serverService.getConfig().instance.isNSFW
56 this.instanceService.getAbout(),
57 this.serverService.localeObservable.pipe(first()),
58 this.serverService.videoLanguagesLoaded.pipe(first()),
59 this.serverService.videoCategoriesLoaded.pipe(first())
61 async ([ about, translations ]) => {
62 this.shortDescription = about.instance.shortDescription
64 this.maintenanceLifetime = about.instance.maintenanceLifetime
65 this.businessModel = about.instance.businessModel
67 this.html = await this.instanceService.buildHtml(about)
69 this.languages = this.instanceService.buildTranslatedLanguages(about, translations)
70 this.categories = this.instanceService.buildTranslatedCategories(about, translations)
73 () => this.notifier.error(this.i18n('Cannot get about information from server'))
78 return this.contactAdminModal.show()