PeerTube/client/src/app/+my-account/my-account.component.ts

83 lines
2.0 KiB
TypeScript
Raw Normal View History

import { Component } from '@angular/core'
2018-08-03 11:10:31 +02:00
import { ServerService } from '@app/core'
import { I18n } from '@ngx-translate/i18n-polyfill'
import { TopMenuDropdownParam } from '@app/shared/menu/top-menu-dropdown.component'
2018-04-23 16:16:05 +02:00
@Component({
2018-04-24 15:10:54 +02:00
selector: 'my-my-account',
templateUrl: './my-account.component.html',
styleUrls: [ './my-account.component.scss' ]
2018-04-23 16:16:05 +02:00
})
export class MyAccountComponent {
menuEntries: TopMenuDropdownParam[] = []
2018-09-05 17:18:13 +02:00
2018-08-03 11:10:31 +02:00
constructor (
private serverService: ServerService,
private i18n: I18n
) {
const libraryEntries: TopMenuDropdownParam = {
label: this.i18n('My library'),
children: [
{
label: this.i18n('My channels'),
2018-12-18 09:31:09 +01:00
routerLink: '/my-account/video-channels'
},
{
label: this.i18n('My videos'),
routerLink: '/my-account/videos'
},
{
label: this.i18n('My subscriptions'),
routerLink: '/my-account/subscriptions'
2018-12-18 09:31:09 +01:00
},
{
label: this.i18n('My history'),
routerLink: '/my-account/history/videos'
}
]
}
2018-08-03 11:10:31 +02:00
if (this.isVideoImportEnabled()) {
libraryEntries.children.push({
label: 'My imports',
routerLink: '/my-account/video-imports'
})
}
const miscEntries: TopMenuDropdownParam = {
label: this.i18n('Misc'),
children: [
{
label: this.i18n('Muted accounts'),
routerLink: '/my-account/blocklist/accounts'
},
{
label: this.i18n('Muted instances'),
routerLink: '/my-account/blocklist/servers'
},
{
label: this.i18n('Ownership changes'),
routerLink: '/my-account/ownership'
}
]
}
this.menuEntries = [
{
label: this.i18n('My settings'),
routerLink: '/my-account/settings'
},
libraryEntries,
miscEntries
]
2018-09-05 17:18:13 +02:00
}
2018-08-03 11:10:31 +02:00
isVideoImportEnabled () {
2018-09-05 14:59:15 +02:00
const importConfig = this.serverService.getConfig().import.videos
return importConfig.http.enabled || importConfig.torrent.enabled
2018-08-03 11:10:31 +02:00
}
2018-08-03 11:10:31 +02:00
}