diff options
Diffstat (limited to 'client/src/app/menu')
-rw-r--r-- | client/src/app/menu/menu.component.html | 21 | ||||
-rw-r--r-- | client/src/app/menu/menu.component.ts | 23 |
2 files changed, 24 insertions, 20 deletions
diff --git a/client/src/app/menu/menu.component.html b/client/src/app/menu/menu.component.html index 3a7ffcbb6..2c2c4f260 100644 --- a/client/src/app/menu/menu.component.html +++ b/client/src/app/menu/menu.component.html | |||
@@ -123,24 +123,9 @@ | |||
123 | <div class="on-instance"> | 123 | <div class="on-instance"> |
124 | <div i18n class="block-title">ON {{instanceName}}</div> | 124 | <div i18n class="block-title">ON {{instanceName}}</div> |
125 | 125 | ||
126 | <a class="menu-link" routerLink="/videos/overview" routerLinkActive="active"> | 126 | <a class="menu-link" *ngFor="let commonLink of commonMenuLinks" [routerLink]="commonLink.path" routerLinkActive="active"> |
127 | <my-global-icon iconName="globe" aria-hidden="true"></my-global-icon> | 127 | <my-global-icon [iconName]="commonLink.icon" aria-hidden="true"></my-global-icon> |
128 | <ng-container i18n>Discover</ng-container> | 128 | <ng-container>{{ commonLink.menuLabel }}</ng-container> |
129 | </a> | ||
130 | |||
131 | <a class="menu-link" routerLink="/videos/trending" routerLinkActive="active"> | ||
132 | <my-global-icon iconName="trending" aria-hidden="true"></my-global-icon> | ||
133 | <ng-container i18n>Trending</ng-container> | ||
134 | </a> | ||
135 | |||
136 | <a class="menu-link" routerLink="/videos/recently-added" routerLinkActive="active"> | ||
137 | <my-global-icon iconName="recently-added" aria-hidden="true"></my-global-icon> | ||
138 | <ng-container i18n>Recently added</ng-container> | ||
139 | </a> | ||
140 | |||
141 | <a class="menu-link" routerLink="/videos/local" routerLinkActive="active"> | ||
142 | <my-global-icon iconName="home" aria-hidden="true"></my-global-icon> | ||
143 | <ng-container i18n>Local videos</ng-container> | ||
144 | </a> | 129 | </a> |
145 | </div> | 130 | </div> |
146 | </div> | 131 | </div> |
diff --git a/client/src/app/menu/menu.component.ts b/client/src/app/menu/menu.component.ts index 8fa1de326..2f7e0cf07 100644 --- a/client/src/app/menu/menu.component.ts +++ b/client/src/app/menu/menu.component.ts | |||
@@ -4,7 +4,17 @@ import { switchMap } from 'rxjs/operators' | |||
4 | import { ViewportScroller } from '@angular/common' | 4 | import { ViewportScroller } from '@angular/common' |
5 | import { Component, OnInit, ViewChild } from '@angular/core' | 5 | import { Component, OnInit, ViewChild } from '@angular/core' |
6 | import { Router } from '@angular/router' | 6 | import { Router } from '@angular/router' |
7 | import { AuthService, AuthStatus, AuthUser, MenuService, RedirectService, ScreenService, ServerService, UserService } from '@app/core' | 7 | import { |
8 | AuthService, | ||
9 | AuthStatus, | ||
10 | AuthUser, | ||
11 | MenuLink, | ||
12 | MenuService, | ||
13 | RedirectService, | ||
14 | ScreenService, | ||
15 | ServerService, | ||
16 | UserService | ||
17 | } from '@app/core' | ||
8 | import { scrollToTop } from '@app/helpers' | 18 | import { scrollToTop } from '@app/helpers' |
9 | import { LanguageChooserComponent } from '@app/menu/language-chooser.component' | 19 | import { LanguageChooserComponent } from '@app/menu/language-chooser.component' |
10 | import { QuickSettingsModalComponent } from '@app/modal/quick-settings-modal.component' | 20 | import { QuickSettingsModalComponent } from '@app/modal/quick-settings-modal.component' |
@@ -35,6 +45,8 @@ export class MenuComponent implements OnInit { | |||
35 | 45 | ||
36 | currentInterfaceLanguage: string | 46 | currentInterfaceLanguage: string |
37 | 47 | ||
48 | commonMenuLinks: MenuLink[] = [] | ||
49 | |||
38 | private languages: VideoConstant<string>[] = [] | 50 | private languages: VideoConstant<string>[] = [] |
39 | private serverConfig: ServerConfig | 51 | private serverConfig: ServerConfig |
40 | private routesPerRight: { [role in UserRight]?: string } = { | 52 | private routesPerRight: { [role in UserRight]?: string } = { |
@@ -80,7 +92,10 @@ export class MenuComponent implements OnInit { | |||
80 | ngOnInit () { | 92 | ngOnInit () { |
81 | this.serverConfig = this.serverService.getTmpConfig() | 93 | this.serverConfig = this.serverService.getTmpConfig() |
82 | this.serverService.getConfig() | 94 | this.serverService.getConfig() |
83 | .subscribe(config => this.serverConfig = config) | 95 | .subscribe(config => { |
96 | this.serverConfig = config | ||
97 | this.buildMenuLinks() | ||
98 | }) | ||
84 | 99 | ||
85 | this.isLoggedIn = this.authService.isLoggedIn() | 100 | this.isLoggedIn = this.authService.isLoggedIn() |
86 | if (this.isLoggedIn === true) { | 101 | if (this.isLoggedIn === true) { |
@@ -241,6 +256,10 @@ export class MenuComponent implements OnInit { | |||
241 | } | 256 | } |
242 | } | 257 | } |
243 | 258 | ||
259 | private buildMenuLinks () { | ||
260 | this.commonMenuLinks = this.menuService.buildCommonLinks(this.serverConfig) | ||
261 | } | ||
262 | |||
244 | private buildUserLanguages () { | 263 | private buildUserLanguages () { |
245 | if (!this.user) { | 264 | if (!this.user) { |
246 | this.videoLanguages = [] | 265 | this.videoLanguages = [] |