]>
Commit | Line | Data |
---|---|---|
17119e4a C |
1 | import { Component, OnInit } from '@angular/core' |
2 | import { AuthService, AuthUser, ScreenService, ServerService } from '@app/core' | |
2989628b | 3 | import { HTMLServerConfig } from '@shared/models' |
17119e4a C |
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 | ||
2989628b C |
14 | |
15 | private serverConfig: HTMLServerConfig | |
17119e4a C |
16 | |
17 | constructor ( | |
18 | private serverService: ServerService, | |
19 | private authService: AuthService, | |
20 | private screenService: ScreenService | |
21 | ) { } | |
22 | ||
23 | get isBroadcastMessageDisplayed () { | |
24 | return this.screenService.isBroadcastMessageDisplayed | |
25 | } | |
26 | ||
27 | ngOnInit (): void { | |
2989628b | 28 | this.serverConfig = this.serverService.getHTMLConfig() |
17119e4a C |
29 | |
30 | this.user = this.authService.getUser() | |
31 | ||
32 | this.authService.userInformationLoaded.subscribe( | |
33 | () => this.buildMenu() | |
34 | ) | |
35 | } | |
36 | ||
37 | isVideoImportEnabled () { | |
38 | const importConfig = this.serverConfig.import.videos | |
39 | ||
40 | return importConfig.http.enabled || importConfig.torrent.enabled | |
41 | } | |
42 | ||
43 | private buildMenu () { | |
44 | this.menuEntries = [ | |
45 | { | |
46 | label: $localize`Channels`, | |
47 | routerLink: '/my-library/video-channels' | |
48 | } | |
49 | ] | |
50 | ||
51 | if (this.user.canSeeVideosLink) { | |
52 | this.menuEntries.push({ | |
53 | label: $localize`Videos`, | |
54 | routerLink: '/my-library/videos' | |
55 | }) | |
56 | } | |
57 | ||
58 | this.menuEntries = this.menuEntries.concat([ | |
59 | { | |
60 | label: $localize`Playlists`, | |
61 | routerLink: '/my-library/video-playlists' | |
62 | }, | |
63 | ||
64 | { | |
65 | label: $localize`Subscriptions`, | |
66 | routerLink: '/my-library/subscriptions' | |
67 | }, | |
68 | ||
69 | { | |
70 | label: $localize`History`, | |
71 | routerLink: '/my-library/history/videos' | |
72 | } | |
73 | ]) | |
74 | } | |
75 | } |