diff options
Diffstat (limited to 'client/src/app/+my-library/my-library.component.ts')
-rw-r--r-- | client/src/app/+my-library/my-library.component.ts | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/client/src/app/+my-library/my-library.component.ts b/client/src/app/+my-library/my-library.component.ts new file mode 100644 index 000000000..0cc91e484 --- /dev/null +++ b/client/src/app/+my-library/my-library.component.ts | |||
@@ -0,0 +1,76 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | ||
2 | import { AuthService, AuthUser, ScreenService, ServerService } from '@app/core' | ||
3 | import { ServerConfig } from '@shared/models' | ||
4 | import { TopMenuDropdownParam } from '../shared/shared-main/misc/top-menu-dropdown.component' | ||
5 | |||
6 | @Component({ | ||
7 | templateUrl: './my-library.component.html', | ||
8 | styleUrls: [ './my-library.component.scss' ] | ||
9 | }) | ||
10 | export class MyLibraryComponent implements OnInit { | ||
11 | menuEntries: TopMenuDropdownParam[] = [] | ||
12 | user: AuthUser | ||
13 | |||
14 | private serverConfig: ServerConfig | ||
15 | |||
16 | constructor ( | ||
17 | private serverService: ServerService, | ||
18 | private authService: AuthService, | ||
19 | private screenService: ScreenService | ||
20 | ) { } | ||
21 | |||
22 | get isBroadcastMessageDisplayed () { | ||
23 | return this.screenService.isBroadcastMessageDisplayed | ||
24 | } | ||
25 | |||
26 | ngOnInit (): void { | ||
27 | this.serverConfig = this.serverService.getTmpConfig() | ||
28 | this.serverService.getConfig() | ||
29 | .subscribe(config => this.serverConfig = config) | ||
30 | |||
31 | this.user = this.authService.getUser() | ||
32 | |||
33 | this.authService.userInformationLoaded.subscribe( | ||
34 | () => this.buildMenu() | ||
35 | ) | ||
36 | } | ||
37 | |||
38 | isVideoImportEnabled () { | ||
39 | const importConfig = this.serverConfig.import.videos | ||
40 | |||
41 | return importConfig.http.enabled || importConfig.torrent.enabled | ||
42 | } | ||
43 | |||
44 | private buildMenu () { | ||
45 | this.menuEntries = [ | ||
46 | { | ||
47 | label: $localize`Channels`, | ||
48 | routerLink: '/my-library/video-channels' | ||
49 | } | ||
50 | ] | ||
51 | |||
52 | if (this.user.canSeeVideosLink) { | ||
53 | this.menuEntries.push({ | ||
54 | label: $localize`Videos`, | ||
55 | routerLink: '/my-library/videos' | ||
56 | }) | ||
57 | } | ||
58 | |||
59 | this.menuEntries = this.menuEntries.concat([ | ||
60 | { | ||
61 | label: $localize`Playlists`, | ||
62 | routerLink: '/my-library/video-playlists' | ||
63 | }, | ||
64 | |||
65 | { | ||
66 | label: $localize`Subscriptions`, | ||
67 | routerLink: '/my-library/subscriptions' | ||
68 | }, | ||
69 | |||
70 | { | ||
71 | label: $localize`History`, | ||
72 | routerLink: '/my-library/history/videos' | ||
73 | } | ||
74 | ]) | ||
75 | } | ||
76 | } | ||