]>
Commit | Line | Data |
---|---|---|
ddb83e49 | 1 | import { Component } from '@angular/core' |
5d08a6a7 | 2 | import { ServerService } from '@app/core' |
4c8e4e04 | 3 | import { I18n } from '@ngx-translate/i18n-polyfill' |
ddb83e49 | 4 | import { TopMenuDropdownParam } from '@app/shared/menu/top-menu-dropdown.component' |
4bb6886d C |
5 | |
6 | @Component({ | |
0626e7af | 7 | selector: 'my-my-account', |
4c8e4e04 C |
8 | templateUrl: './my-account.component.html', |
9 | styleUrls: [ './my-account.component.scss' ] | |
4bb6886d | 10 | }) |
ddb83e49 C |
11 | export class MyAccountComponent { |
12 | menuEntries: TopMenuDropdownParam[] = [] | |
d7639f66 | 13 | |
5d08a6a7 | 14 | constructor ( |
4c8e4e04 | 15 | private serverService: ServerService, |
4c8e4e04 | 16 | private i18n: I18n |
ddb83e49 C |
17 | ) { |
18 | ||
19 | const libraryEntries: TopMenuDropdownParam = { | |
20 | label: this.i18n('My library'), | |
21 | children: [ | |
22 | { | |
23 | label: this.i18n('My channels'), | |
a55052c9 C |
24 | routerLink: '/my-account/video-channels', |
25 | iconName: 'folder' | |
ddb83e49 C |
26 | }, |
27 | { | |
28 | label: this.i18n('My videos'), | |
a55052c9 C |
29 | routerLink: '/my-account/videos', |
30 | iconName: 'videos' | |
ddb83e49 | 31 | }, |
830b4faf C |
32 | { |
33 | label: this.i18n('My playlists'), | |
a55052c9 C |
34 | routerLink: '/my-account/video-playlists', |
35 | iconName: 'playlists' | |
830b4faf | 36 | }, |
ddb83e49 C |
37 | { |
38 | label: this.i18n('My subscriptions'), | |
a55052c9 C |
39 | routerLink: '/my-account/subscriptions', |
40 | iconName: 'subscriptions' | |
80bfd33c C |
41 | }, |
42 | { | |
43 | label: this.i18n('My history'), | |
a55052c9 C |
44 | routerLink: '/my-account/history/videos', |
45 | iconName: 'history' | |
ddb83e49 C |
46 | } |
47 | ] | |
48 | } | |
5d08a6a7 | 49 | |
ddb83e49 C |
50 | if (this.isVideoImportEnabled()) { |
51 | libraryEntries.children.push({ | |
52 | label: 'My imports', | |
a55052c9 C |
53 | routerLink: '/my-account/video-imports', |
54 | iconName: 'cloud-download' | |
ddb83e49 C |
55 | }) |
56 | } | |
4c8e4e04 | 57 | |
ddb83e49 C |
58 | const miscEntries: TopMenuDropdownParam = { |
59 | label: this.i18n('Misc'), | |
60 | children: [ | |
61 | { | |
62 | label: this.i18n('Muted accounts'), | |
a55052c9 C |
63 | routerLink: '/my-account/blocklist/accounts', |
64 | iconName: 'user' | |
ddb83e49 C |
65 | }, |
66 | { | |
67 | label: this.i18n('Muted instances'), | |
a55052c9 C |
68 | routerLink: '/my-account/blocklist/servers', |
69 | iconName: 'server' | |
ddb83e49 C |
70 | }, |
71 | { | |
72 | label: this.i18n('Ownership changes'), | |
a55052c9 C |
73 | routerLink: '/my-account/ownership', |
74 | iconName: 'im-with-her' | |
ddb83e49 C |
75 | } |
76 | ] | |
77 | } | |
4c8e4e04 | 78 | |
ddb83e49 C |
79 | this.menuEntries = [ |
80 | { | |
81 | label: this.i18n('My settings'), | |
82 | routerLink: '/my-account/settings' | |
83 | }, | |
2f1548fd C |
84 | { |
85 | label: this.i18n('My notifications'), | |
86 | routerLink: '/my-account/notifications' | |
87 | }, | |
ddb83e49 C |
88 | libraryEntries, |
89 | miscEntries | |
90 | ] | |
d7639f66 C |
91 | } |
92 | ||
5d08a6a7 | 93 | isVideoImportEnabled () { |
b0ee41df C |
94 | const importConfig = this.serverService.getConfig().import.videos |
95 | ||
96 | return importConfig.http.enabled || importConfig.torrent.enabled | |
5d08a6a7 | 97 | } |
4c8e4e04 | 98 | |
5d08a6a7 | 99 | } |