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

100 lines
2.5 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'),
2019-03-20 07:53:51 -05:00
routerLink: '/my-account/video-channels',
iconName: 'folder'
},
{
label: this.i18n('My videos'),
2019-03-20 07:53:51 -05:00
routerLink: '/my-account/videos',
iconName: 'videos'
},
2019-03-06 08:36:44 -06:00
{
label: this.i18n('My playlists'),
2019-03-20 07:53:51 -05:00
routerLink: '/my-account/video-playlists',
iconName: 'playlists'
2019-03-06 08:36:44 -06:00
},
{
label: this.i18n('My subscriptions'),
2019-03-20 07:53:51 -05:00
routerLink: '/my-account/subscriptions',
iconName: 'subscriptions'
2018-12-18 02:31:09 -06:00
},
{
label: this.i18n('My history'),
2019-03-20 07:53:51 -05:00
routerLink: '/my-account/history/videos',
iconName: 'history'
}
]
}
2018-08-03 04:10:31 -05:00
if (this.isVideoImportEnabled()) {
libraryEntries.children.push({
label: 'My imports',
2019-03-20 07:53:51 -05:00
routerLink: '/my-account/video-imports',
iconName: 'cloud-download'
})
}
const miscEntries: TopMenuDropdownParam = {
label: this.i18n('Misc'),
children: [
{
label: this.i18n('Muted accounts'),
2019-03-20 07:53:51 -05:00
routerLink: '/my-account/blocklist/accounts',
iconName: 'user'
},
{
label: this.i18n('Muted instances'),
2019-03-20 07:53:51 -05:00
routerLink: '/my-account/blocklist/servers',
iconName: 'server'
},
{
label: this.i18n('Ownership changes'),
2019-03-20 07:53:51 -05:00
routerLink: '/my-account/ownership',
iconName: 'im-with-her'
}
]
}
this.menuEntries = [
{
label: this.i18n('My settings'),
routerLink: '/my-account/settings'
},
2019-01-08 04:26:41 -06:00
{
label: this.i18n('My notifications'),
routerLink: '/my-account/notifications'
},
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
}