2019-12-18 15:31:54 +01:00
|
|
|
import { Component, OnInit } from '@angular/core'
|
2018-08-03 11:10:31 +02:00
|
|
|
import { ServerService } from '@app/core'
|
2018-09-05 14:42:59 +02:00
|
|
|
import { I18n } from '@ngx-translate/i18n-polyfill'
|
2019-12-18 15:31:54 +01:00
|
|
|
import { ServerConfig } from '@shared/models'
|
2020-06-23 14:10:17 +02:00
|
|
|
import { TopMenuDropdownParam } from './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',
|
2018-09-05 14:42:59 +02:00
|
|
|
templateUrl: './my-account.component.html',
|
|
|
|
styleUrls: [ './my-account.component.scss' ]
|
2018-04-23 16:16:05 +02:00
|
|
|
})
|
2019-12-18 15:31:54 +01:00
|
|
|
export class MyAccountComponent implements OnInit {
|
2018-12-05 14:21:10 +01:00
|
|
|
menuEntries: TopMenuDropdownParam[] = []
|
2018-09-05 17:18:13 +02:00
|
|
|
|
2019-12-18 15:31:54 +01:00
|
|
|
private serverConfig: ServerConfig
|
|
|
|
|
2018-08-03 11:10:31 +02:00
|
|
|
constructor (
|
2018-09-05 14:42:59 +02:00
|
|
|
private serverService: ServerService,
|
|
|
|
private i18n: I18n
|
2019-12-18 15:31:54 +01:00
|
|
|
) { }
|
|
|
|
|
|
|
|
ngOnInit (): void {
|
|
|
|
this.serverConfig = this.serverService.getTmpConfig()
|
|
|
|
this.serverService.getConfig()
|
|
|
|
.subscribe(config => this.serverConfig = config)
|
2018-12-05 14:21:10 +01:00
|
|
|
|
|
|
|
const libraryEntries: TopMenuDropdownParam = {
|
|
|
|
label: this.i18n('My library'),
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
label: this.i18n('My channels'),
|
2019-03-20 13:53:51 +01:00
|
|
|
routerLink: '/my-account/video-channels',
|
2020-06-30 11:21:04 +02:00
|
|
|
iconName: 'channel'
|
2018-12-05 14:21:10 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: this.i18n('My videos'),
|
2019-03-20 13:53:51 +01:00
|
|
|
routerLink: '/my-account/videos',
|
|
|
|
iconName: 'videos'
|
2018-12-05 14:21:10 +01:00
|
|
|
},
|
2019-03-06 15:36:44 +01:00
|
|
|
{
|
|
|
|
label: this.i18n('My playlists'),
|
2019-03-20 13:53:51 +01:00
|
|
|
routerLink: '/my-account/video-playlists',
|
|
|
|
iconName: 'playlists'
|
2019-03-06 15:36:44 +01:00
|
|
|
},
|
2018-12-05 14:21:10 +01:00
|
|
|
{
|
|
|
|
label: this.i18n('My subscriptions'),
|
2019-03-20 13:53:51 +01:00
|
|
|
routerLink: '/my-account/subscriptions',
|
2020-06-30 11:21:04 +02:00
|
|
|
iconName: 'inbox-full'
|
2018-12-18 09:31:09 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: this.i18n('My history'),
|
2019-03-20 13:53:51 +01:00
|
|
|
routerLink: '/my-account/history/videos',
|
|
|
|
iconName: 'history'
|
2018-12-05 14:21:10 +01:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2018-08-03 11:10:31 +02:00
|
|
|
|
2018-12-05 14:21:10 +01:00
|
|
|
if (this.isVideoImportEnabled()) {
|
|
|
|
libraryEntries.children.push({
|
|
|
|
label: 'My imports',
|
2019-03-20 13:53:51 +01:00
|
|
|
routerLink: '/my-account/video-imports',
|
|
|
|
iconName: 'cloud-download'
|
2018-12-05 14:21:10 +01:00
|
|
|
})
|
|
|
|
}
|
2018-09-05 14:42:59 +02:00
|
|
|
|
2018-12-05 14:21:10 +01:00
|
|
|
const miscEntries: TopMenuDropdownParam = {
|
|
|
|
label: this.i18n('Misc'),
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
label: this.i18n('Muted accounts'),
|
2019-03-20 13:53:51 +01:00
|
|
|
routerLink: '/my-account/blocklist/accounts',
|
|
|
|
iconName: 'user'
|
2018-12-05 14:21:10 +01:00
|
|
|
},
|
|
|
|
{
|
2020-06-15 13:18:22 +02:00
|
|
|
label: this.i18n('Muted servers'),
|
2019-03-20 13:53:51 +01:00
|
|
|
routerLink: '/my-account/blocklist/servers',
|
|
|
|
iconName: 'server'
|
2018-12-05 14:21:10 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: this.i18n('Ownership changes'),
|
2019-03-20 13:53:51 +01:00
|
|
|
routerLink: '/my-account/ownership',
|
2020-06-30 11:21:04 +02:00
|
|
|
iconName: 'ownership-change'
|
2018-12-05 14:21:10 +01:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2018-09-05 14:42:59 +02:00
|
|
|
|
2018-12-05 14:21:10 +01:00
|
|
|
this.menuEntries = [
|
|
|
|
{
|
|
|
|
label: this.i18n('My settings'),
|
|
|
|
routerLink: '/my-account/settings'
|
|
|
|
},
|
2019-01-08 11:26:41 +01:00
|
|
|
{
|
|
|
|
label: this.i18n('My notifications'),
|
|
|
|
routerLink: '/my-account/notifications'
|
|
|
|
},
|
2018-12-05 14:21:10 +01:00
|
|
|
libraryEntries,
|
|
|
|
miscEntries
|
|
|
|
]
|
2018-09-05 17:18:13 +02:00
|
|
|
}
|
|
|
|
|
2018-08-03 11:10:31 +02:00
|
|
|
isVideoImportEnabled () {
|
2019-12-18 15:31:54 +01:00
|
|
|
const importConfig = this.serverConfig.import.videos
|
2018-09-05 14:59:15 +02:00
|
|
|
|
|
|
|
return importConfig.http.enabled || importConfig.torrent.enabled
|
2018-08-03 11:10:31 +02:00
|
|
|
}
|
2018-09-05 14:42:59 +02:00
|
|
|
|
2018-08-03 11:10:31 +02:00
|
|
|
}
|