2018-12-05 07:21:10 -06:00
|
|
|
import { Component } from '@angular/core'
|
2018-08-03 04:10:31 -05:00
|
|
|
import { ServerService } from '@app/core'
|
2018-09-05 07:42:59 -05:00
|
|
|
import { I18n } from '@ngx-translate/i18n-polyfill'
|
2018-12-05 07:21:10 -06:00
|
|
|
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',
|
2018-09-05 07:42:59 -05:00
|
|
|
templateUrl: './my-account.component.html',
|
|
|
|
styleUrls: [ './my-account.component.scss' ]
|
2018-04-23 09:16:05 -05:00
|
|
|
})
|
2018-12-05 07:21:10 -06:00
|
|
|
export class MyAccountComponent {
|
|
|
|
menuEntries: TopMenuDropdownParam[] = []
|
2018-09-05 10:18:13 -05:00
|
|
|
|
2018-08-03 04:10:31 -05:00
|
|
|
constructor (
|
2018-09-05 07:42:59 -05:00
|
|
|
private serverService: ServerService,
|
|
|
|
private i18n: I18n
|
2018-12-05 07:21:10 -06:00
|
|
|
) {
|
|
|
|
|
|
|
|
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'
|
2018-12-05 07:21:10 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
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-12-05 07:21:10 -06:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2018-08-03 04:10:31 -05:00
|
|
|
|
2018-12-05 07:21:10 -06:00
|
|
|
if (this.isVideoImportEnabled()) {
|
|
|
|
libraryEntries.children.push({
|
|
|
|
label: 'My imports',
|
|
|
|
routerLink: '/my-account/video-imports'
|
|
|
|
})
|
|
|
|
}
|
2018-09-05 07:42:59 -05:00
|
|
|
|
2018-12-05 07:21:10 -06:00
|
|
|
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'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2018-09-05 07:42:59 -05:00
|
|
|
|
2018-12-05 07:21:10 -06:00
|
|
|
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'
|
|
|
|
},
|
2018-12-05 07:21:10 -06:00
|
|
|
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-09-05 07:42:59 -05:00
|
|
|
|
2018-08-03 04:10:31 -05:00
|
|
|
}
|