diff options
author | Chocobozzz <chocobozzz@cpy.re> | 2021-05-27 15:59:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-27 15:59:55 +0200 |
commit | 2539932e16129992a2c0889b4ff527c265a8e2c7 (patch) | |
tree | fb5048e63e02a2485eb96d27455f43e4b22e8ae0 /client/src/app/menu/menu.component.ts | |
parent | eb34ec30e0b57286fc6f85160490d2e973a3b0b1 (diff) | |
download | PeerTube-2539932e16129992a2c0889b4ff527c265a8e2c7.tar.gz PeerTube-2539932e16129992a2c0889b4ff527c265a8e2c7.tar.zst PeerTube-2539932e16129992a2c0889b4ff527c265a8e2c7.zip |
Instance homepage support (#4007)
* Prepare homepage parsers
* Add ability to update instance hompage
* Add ability to set homepage as landing page
* Add homepage preview in admin
* Dynamically update left menu for homepage
* Inject home content in homepage
* Add videos list and channel miniature custom markup
* Remove unused elements in markup service
Diffstat (limited to 'client/src/app/menu/menu.component.ts')
-rw-r--r-- | client/src/app/menu/menu.component.ts | 23 |
1 files changed, 21 insertions, 2 deletions
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 = [] |