X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fmenu%2Fmenu.component.ts;h=2f7e0cf07bea2699929d169934e03fdfc62b2d25;hb=2539932e16129992a2c0889b4ff527c265a8e2c7;hp=9b6b7cda5be8aaab394476b42ed928f47c08adb6;hpb=43a3d281fe562d5fe24feb53451b58630be3a288;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/menu/menu.component.ts b/client/src/app/menu/menu.component.ts index 9b6b7cda5..2f7e0cf07 100644 --- a/client/src/app/menu/menu.component.ts +++ b/client/src/app/menu/menu.component.ts @@ -1,16 +1,26 @@ -import { ViewportScroller } from '@angular/common' import { HotkeysService } from 'angular2-hotkeys' import * as debug from 'debug' import { switchMap } from 'rxjs/operators' +import { ViewportScroller } from '@angular/common' import { Component, OnInit, ViewChild } from '@angular/core' import { Router } from '@angular/router' +import { + AuthService, + AuthStatus, + AuthUser, + MenuLink, + MenuService, + RedirectService, + ScreenService, + ServerService, + UserService +} from '@app/core' import { scrollToTop } from '@app/helpers' -import { AuthService, AuthStatus, AuthUser, MenuService, RedirectService, ScreenService, ServerService, UserService } from '@app/core' import { LanguageChooserComponent } from '@app/menu/language-chooser.component' import { QuickSettingsModalComponent } from '@app/modal/quick-settings-modal.component' -import { ServerConfig, UserRight, VideoConstant } from '@shared/models' -import { NgbDropdown, NgbDropdownConfig } from '@ng-bootstrap/ng-bootstrap' import { PeertubeModalService } from '@app/shared/shared-main/peertube-modal/peertube-modal.service' +import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap' +import { ServerConfig, UserRight, VideoConstant } from '@shared/models' const logger = debug('peertube:menu:MenuComponent') @@ -35,6 +45,8 @@ export class MenuComponent implements OnInit { currentInterfaceLanguage: string + commonMenuLinks: MenuLink[] = [] + private languages: VideoConstant[] = [] private serverConfig: ServerConfig private routesPerRight: { [role in UserRight]?: string } = { @@ -56,22 +68,17 @@ export class MenuComponent implements OnInit { private screenService: ScreenService, private menuService: MenuService, private modalService: PeertubeModalService, - private dropdownConfig: NgbDropdownConfig, private router: Router - ) { - this.dropdownConfig.container = 'body' - } + ) { } get isInMobileView () { return this.screenService.isInMobileView() } get dropdownContainer () { - if (this.isInMobileView) { - return null - } else { - return this.dropdownConfig.container - } + if (this.isInMobileView) return null + + return 'body' as 'body' } get language () { @@ -85,7 +92,10 @@ export class MenuComponent implements OnInit { ngOnInit () { this.serverConfig = this.serverService.getTmpConfig() this.serverService.getConfig() - .subscribe(config => this.serverConfig = config) + .subscribe(config => { + this.serverConfig = config + this.buildMenuLinks() + }) this.isLoggedIn = this.authService.isLoggedIn() if (this.isLoggedIn === true) { @@ -246,6 +256,10 @@ export class MenuComponent implements OnInit { } } + private buildMenuLinks () { + this.commonMenuLinks = this.menuService.buildCommonLinks(this.serverConfig) + } + private buildUserLanguages () { if (!this.user) { this.videoLanguages = []