diff options
Diffstat (limited to 'client/src/app/+my-account/my-account.component.ts')
-rw-r--r-- | client/src/app/+my-account/my-account.component.ts | 41 |
1 files changed, 37 insertions, 4 deletions
diff --git a/client/src/app/+my-account/my-account.component.ts b/client/src/app/+my-account/my-account.component.ts index 6e29cdd83..548f6a1c0 100644 --- a/client/src/app/+my-account/my-account.component.ts +++ b/client/src/app/+my-account/my-account.component.ts | |||
@@ -1,17 +1,50 @@ | |||
1 | import { Component } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { ServerService } from '@app/core' | 2 | import { ServerService } from '@app/core' |
3 | import { NavigationStart, Router } from '@angular/router' | ||
4 | import { filter } from 'rxjs/operators' | ||
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
3 | 6 | ||
4 | @Component({ | 7 | @Component({ |
5 | selector: 'my-my-account', | 8 | selector: 'my-my-account', |
6 | templateUrl: './my-account.component.html' | 9 | templateUrl: './my-account.component.html', |
10 | styleUrls: [ './my-account.component.scss' ] | ||
7 | }) | 11 | }) |
8 | export class MyAccountComponent { | 12 | export class MyAccountComponent implements OnInit { |
13 | |||
14 | libraryLabel = '' | ||
9 | 15 | ||
10 | constructor ( | 16 | constructor ( |
11 | private serverService: ServerService | 17 | private serverService: ServerService, |
18 | private router: Router, | ||
19 | private i18n: I18n | ||
12 | ) {} | 20 | ) {} |
13 | 21 | ||
22 | ngOnInit () { | ||
23 | console.log(this.router.url) | ||
24 | this.updateLibraryLabel(this.router.url) | ||
25 | |||
26 | this.router.events | ||
27 | .pipe(filter(event => event instanceof NavigationStart)) | ||
28 | .subscribe((event: NavigationStart) => this.updateLibraryLabel(event.url)) | ||
29 | } | ||
30 | |||
14 | isVideoImportEnabled () { | 31 | isVideoImportEnabled () { |
15 | return this.serverService.getConfig().import.videos.http.enabled | 32 | return this.serverService.getConfig().import.videos.http.enabled |
16 | } | 33 | } |
34 | |||
35 | private updateLibraryLabel (url: string) { | ||
36 | const [ path ] = url.split('?') | ||
37 | |||
38 | if (path === '/my-account/video-channels') { | ||
39 | this.libraryLabel = this.i18n('Channels') | ||
40 | } else if (path === '/my-account/videos') { | ||
41 | this.libraryLabel = this.i18n('Videos') | ||
42 | } else if (path === '/my-account/subscriptions') { | ||
43 | this.libraryLabel = this.i18n('Subscriptions') | ||
44 | } else if (path === '/my-account/video-imports') { | ||
45 | this.libraryLabel = this.i18n('Video imports') | ||
46 | } else { | ||
47 | this.libraryLabel = '' | ||
48 | } | ||
49 | } | ||
17 | } | 50 | } |