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 04:10:31 -05: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 09:16:05 -05:00
@Component({
2018-04-24 08:10:54 -05:00
selector: 'my-my-account',
templateUrl: './my-account.component.html',
styleUrls: [ './my-account.component.scss' ]
2018-04-23 09:16:05 -05:00
})
export class MyAccountComponent {
menuEntries: TopMenuDropdownParam[] = []
2018-09-05 10:18:13 -05:00
2018-08-03 04:10:31 -05: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 02:31:09 -06: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 02:31:09 -06:00
},
{
label: this.i18n('My history'),
routerLink: '/my-account/history/videos'
}
]
}
2018-08-03 04:10:31 -05: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 10:18:13 -05:00
}
2018-08-03 04:10:31 -05:00
isVideoImportEnabled () {
2018-09-05 07:59:15 -05:00
const importConfig = this.serverService.getConfig().import.videos
return importConfig.http.enabled || importConfig.torrent.enabled
2018-08-03 04:10:31 -05:00
}
2018-08-03 04:10:31 -05:00
}