Add categories and languages to about page
This commit is contained in:
parent
a00045a218
commit
4402b54dce
|
@ -8,9 +8,25 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="short-description">
|
<div class="short-description">
|
||||||
<div>{{ shortDescription }}</div>
|
<div class="block short-description">{{ shortDescription }}</div>
|
||||||
|
|
||||||
<div *ngIf="isNSFW" class="dedicated-to-nsfw">This instance is dedicated to sensitive/NSFW content.</div>
|
<div *ngIf="isNSFW" class="block dedicated-to-nsfw">This instance is dedicated to sensitive/NSFW content.</div>
|
||||||
|
|
||||||
|
<div class="block">
|
||||||
|
<div class="section-title" *ngIf="languages.length !== 0">Main instance languages</div>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li *ngFor="let language of languages">{{ language }}</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="block">
|
||||||
|
<div class="section-title" *ngIf="categories.length !== 0">Main instance categories</div>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li *ngFor="let category of categories">{{ category }}</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="middle-title" *ngIf="html.administrator || maintenanceLifetime || businessModel">
|
<div class="middle-title" *ngIf="html.administrator || maintenanceLifetime || businessModel">
|
||||||
|
@ -18,19 +34,19 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="block administrator" *ngIf="html.administrator">
|
<div class="block administrator" *ngIf="html.administrator">
|
||||||
<div i18n class="section-title">Instance administrators</div>
|
<div i18n class="section-title">Who are we?</div>
|
||||||
|
|
||||||
<div [innerHTML]="html.administrator"></div>
|
<div [innerHTML]="html.administrator"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="block maintenance-lifetime" *ngIf="maintenanceLifetime">
|
<div class="block maintenance-lifetime" *ngIf="maintenanceLifetime">
|
||||||
<div i18n class="section-title">Maintenance lifetime</div>
|
<div i18n class="section-title">How long do we plan to maintain this instance?</div>
|
||||||
|
|
||||||
<p>{{ maintenanceLifetime }}</p>
|
<p>{{ maintenanceLifetime }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="block business-model" *ngIf="businessModel">
|
<div class="block business-model" *ngIf="businessModel">
|
||||||
<div i18n class="section-title">Business model</div>
|
<div i18n class="section-title">How will we pay this instance?</div>
|
||||||
|
|
||||||
<p>{{ businessModel }}</p>
|
<p>{{ businessModel }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
|
|
||||||
.block {
|
.block {
|
||||||
margin-bottom: 30px;
|
margin-bottom: 30px;
|
||||||
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.short-description .dedicated-to-nsfw {
|
.short-description .dedicated-to-nsfw {
|
||||||
|
|
|
@ -4,6 +4,9 @@ import { I18n } from '@ngx-translate/i18n-polyfill'
|
||||||
import { ContactAdminModalComponent } from '@app/+about/about-instance/contact-admin-modal.component'
|
import { ContactAdminModalComponent } from '@app/+about/about-instance/contact-admin-modal.component'
|
||||||
import { InstanceService } from '@app/shared/instance/instance.service'
|
import { InstanceService } from '@app/shared/instance/instance.service'
|
||||||
import { MarkdownService } from '@app/shared/renderer'
|
import { MarkdownService } from '@app/shared/renderer'
|
||||||
|
import { forkJoin } from 'rxjs'
|
||||||
|
import { first } from 'rxjs/operators'
|
||||||
|
import { peertubeTranslate } from '@shared/models'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-about-instance',
|
selector: 'my-about-instance',
|
||||||
|
@ -27,7 +30,7 @@ export class AboutInstanceComponent implements OnInit {
|
||||||
businessModel = ''
|
businessModel = ''
|
||||||
|
|
||||||
languages: string[] = []
|
languages: string[] = []
|
||||||
categories: number[] = []
|
categories: string[] = []
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
private notifier: Notifier,
|
private notifier: Notifier,
|
||||||
|
@ -50,9 +53,13 @@ export class AboutInstanceComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit () {
|
ngOnInit () {
|
||||||
this.instanceService.getAbout()
|
forkJoin([
|
||||||
.subscribe(
|
this.instanceService.getAbout(),
|
||||||
async res => {
|
this.serverService.localeObservable.pipe(first()),
|
||||||
|
this.serverService.videoLanguagesLoaded.pipe(first()),
|
||||||
|
this.serverService.videoCategoriesLoaded.pipe(first())
|
||||||
|
]).subscribe(
|
||||||
|
async ([ res, translations ]) => {
|
||||||
this.shortDescription = res.instance.shortDescription
|
this.shortDescription = res.instance.shortDescription
|
||||||
|
|
||||||
this.maintenanceLifetime = res.instance.maintenanceLifetime
|
this.maintenanceLifetime = res.instance.maintenanceLifetime
|
||||||
|
@ -62,8 +69,22 @@ export class AboutInstanceComponent implements OnInit {
|
||||||
this.html[ key ] = await this.markdownService.textMarkdownToHTML(res.instance[ key ])
|
this.html[ key ] = await this.markdownService.textMarkdownToHTML(res.instance[ key ])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const languagesArray = this.serverService.getVideoLanguages()
|
||||||
|
const categoriesArray = this.serverService.getVideoCategories()
|
||||||
|
|
||||||
this.languages = res.instance.languages
|
this.languages = res.instance.languages
|
||||||
|
.map(l => {
|
||||||
|
const languageObj = languagesArray.find(la => la.id === l)
|
||||||
|
|
||||||
|
return peertubeTranslate(languageObj.label, translations)
|
||||||
|
})
|
||||||
|
|
||||||
this.categories = res.instance.categories
|
this.categories = res.instance.categories
|
||||||
|
.map(c => {
|
||||||
|
const categoryObj = categoriesArray.find(ca => ca.id === c)
|
||||||
|
|
||||||
|
return peertubeTranslate(categoryObj.label, translations)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
() => this.notifier.error(this.i18n('Cannot get about information from server'))
|
() => this.notifier.error(this.i18n('Cannot get about information from server'))
|
||||||
|
@ -73,5 +94,4 @@ export class AboutInstanceComponent implements OnInit {
|
||||||
openContactModal () {
|
openContactModal () {
|
||||||
return this.contactAdminModal.show()
|
return this.contactAdminModal.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user