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'
7 templateUrl: './my-library.component.html',
8 styleUrls: [ './my-library.component.scss' ]
10 export class MyLibraryComponent implements OnInit {
11 menuEntries: TopMenuDropdownParam[] = []
14 private serverConfig: ServerConfig
17 private serverService: ServerService,
18 private authService: AuthService,
19 private screenService: ScreenService
22 get isBroadcastMessageDisplayed () {
23 return this.screenService.isBroadcastMessageDisplayed
27 this.serverConfig = this.serverService.getTmpConfig()
28 this.serverService.getConfig()
29 .subscribe(config => this.serverConfig = config)
31 this.user = this.authService.getUser()
33 this.authService.userInformationLoaded.subscribe(
34 () => this.buildMenu()
38 isVideoImportEnabled () {
39 const importConfig = this.serverConfig.import.videos
41 return importConfig.http.enabled || importConfig.torrent.enabled
44 private buildMenu () {
47 label: $localize`Channels`,
48 routerLink: '/my-library/video-channels'
52 if (this.user.canSeeVideosLink) {
53 this.menuEntries.push({
54 label: $localize`Videos`,
55 routerLink: '/my-library/videos'
59 this.menuEntries = this.menuEntries.concat([
61 label: $localize`Playlists`,
62 routerLink: '/my-library/video-playlists'
66 label: $localize`Subscriptions`,
67 routerLink: '/my-library/subscriptions'
71 label: $localize`History`,
72 routerLink: '/my-library/history/videos'