]>
Commit | Line | Data |
---|---|---|
d3e56c0c | 1 | import { Component, OnInit, ViewChild } from '@angular/core' |
f8b2c1b4 | 2 | import { Notifier, ServerService } from '@app/core' |
d3e56c0c C |
3 | import { ContactAdminModalComponent } from '@app/+about/about-instance/contact-admin-modal.component' |
4 | import { InstanceService } from '@app/shared/instance/instance.service' | |
ba430d75 | 5 | import { ServerConfig } from '@shared/models' |
b42f9c40 C |
6 | import { ActivatedRoute } from '@angular/router' |
7 | import { ResolverData } from './about-instance.resolver' | |
36f9424f C |
8 | |
9 | @Component({ | |
78f912ed C |
10 | selector: 'my-about-instance', |
11 | templateUrl: './about-instance.component.html', | |
12 | styleUrls: [ './about-instance.component.scss' ] | |
36f9424f | 13 | }) |
78f912ed | 14 | export class AboutInstanceComponent implements OnInit { |
f36da21e | 15 | @ViewChild('contactAdminModal', { static: true }) contactAdminModal: ContactAdminModalComponent |
d3e56c0c | 16 | |
45c0fb35 | 17 | shortDescription = '' |
ccc00cb2 C |
18 | |
19 | html = { | |
20 | description: '', | |
21 | terms: '', | |
22 | codeOfConduct: '', | |
23 | moderationInformation: '', | |
be04c6fd C |
24 | administrator: '', |
25 | hardwareInformation: '' | |
ccc00cb2 C |
26 | } |
27 | ||
8ae03c37 | 28 | creationReason = '' |
ccc00cb2 C |
29 | maintenanceLifetime = '' |
30 | businessModel = '' | |
31 | ||
32 | languages: string[] = [] | |
4402b54d | 33 | categories: string[] = [] |
36f9424f | 34 | |
ba430d75 C |
35 | serverConfig: ServerConfig |
36 | ||
36f9424f | 37 | constructor ( |
b42f9c40 | 38 | private route: ActivatedRoute, |
f8b2c1b4 | 39 | private notifier: Notifier, |
36f9424f | 40 | private serverService: ServerService, |
b42f9c40 | 41 | private instanceService: InstanceService |
36f9424f C |
42 | ) {} |
43 | ||
44 | get instanceName () { | |
ba430d75 | 45 | return this.serverConfig.instance.name |
36f9424f C |
46 | } |
47 | ||
d3e56c0c | 48 | get isContactFormEnabled () { |
ba430d75 | 49 | return this.serverConfig.email.enabled && this.serverConfig.contactForm.enabled |
d3e56c0c C |
50 | } |
51 | ||
c8000975 | 52 | get isNSFW () { |
ba430d75 | 53 | return this.serverConfig.instance.isNSFW |
c8000975 C |
54 | } |
55 | ||
b42f9c40 | 56 | async ngOnInit () { |
ba430d75 C |
57 | this.serverConfig = this.serverService.getTmpConfig() |
58 | this.serverService.getConfig() | |
59 | .subscribe(config => this.serverConfig = config) | |
60 | ||
b42f9c40 C |
61 | const { about, languages, categories }: ResolverData = this.route.snapshot.data.instanceData |
62 | ||
63 | this.languages = languages | |
64 | this.categories = categories | |
65 | ||
66 | this.shortDescription = about.instance.shortDescription | |
67 | ||
68 | this.creationReason = about.instance.creationReason | |
69 | this.maintenanceLifetime = about.instance.maintenanceLifetime | |
70 | this.businessModel = about.instance.businessModel | |
71 | ||
72 | this.html = await this.instanceService.buildHtml(about) | |
36f9424f C |
73 | } |
74 | ||
d3e56c0c C |
75 | openContactModal () { |
76 | return this.contactAdminModal.show() | |
77 | } | |
36f9424f | 78 | } |