1 import { Component, OnInit } from '@angular/core'
2 import { ServerService } from '@app/core'
3 import { I18n } from '@ngx-translate/i18n-polyfill'
4 import { TopMenuDropdownParam } from '@app/shared/menu/top-menu-dropdown.component'
5 import { ServerConfig } from '@shared/models'
8 selector: 'my-my-account',
9 templateUrl: './my-account.component.html',
10 styleUrls: [ './my-account.component.scss' ]
12 export class MyAccountComponent implements OnInit {
13 menuEntries: TopMenuDropdownParam[] = []
15 private serverConfig: ServerConfig
18 private serverService: ServerService,
23 this.serverConfig = this.serverService.getTmpConfig()
24 this.serverService.getConfig()
25 .subscribe(config => this.serverConfig = config)
27 const libraryEntries: TopMenuDropdownParam = {
28 label: this.i18n('My library'),
31 label: this.i18n('My channels'),
32 routerLink: '/my-account/video-channels',
36 label: this.i18n('My videos'),
37 routerLink: '/my-account/videos',
41 label: this.i18n('My playlists'),
42 routerLink: '/my-account/video-playlists',
46 label: this.i18n('My subscriptions'),
47 routerLink: '/my-account/subscriptions',
48 iconName: 'subscriptions'
51 label: this.i18n('My history'),
52 routerLink: '/my-account/history/videos',
58 if (this.isVideoImportEnabled()) {
59 libraryEntries.children.push({
61 routerLink: '/my-account/video-imports',
62 iconName: 'cloud-download'
66 const miscEntries: TopMenuDropdownParam = {
67 label: this.i18n('Misc'),
70 label: this.i18n('Muted accounts'),
71 routerLink: '/my-account/blocklist/accounts',
75 label: this.i18n('Muted instances'),
76 routerLink: '/my-account/blocklist/servers',
80 label: this.i18n('Ownership changes'),
81 routerLink: '/my-account/ownership',
82 iconName: 'im-with-her'
89 label: this.i18n('My settings'),
90 routerLink: '/my-account/settings'
93 label: this.i18n('My notifications'),
94 routerLink: '/my-account/notifications'
101 isVideoImportEnabled () {
102 const importConfig = this.serverConfig.import.videos
104 return importConfig.http.enabled || importConfig.torrent.enabled