aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+my-account/my-account.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-09-05 14:42:59 +0200
committerChocobozzz <me@florianbigard.com>2018-09-05 14:42:59 +0200
commit4c8e4e04d1b3f0f207e9155df393ceeb23dc2172 (patch)
treee873838b8547576f73390b14606feb7f5080a293 /client/src/app/+my-account/my-account.component.ts
parentc182527a6c6e01bd5cd32b212026c3176ecbe63d (diff)
downloadPeerTube-4c8e4e04d1b3f0f207e9155df393ceeb23dc2172.tar.gz
PeerTube-4c8e4e04d1b3f0f207e9155df393ceeb23dc2172.tar.zst
PeerTube-4c8e4e04d1b3f0f207e9155df393ceeb23dc2172.zip
Use dropdown in my account -> "my library"
Diffstat (limited to 'client/src/app/+my-account/my-account.component.ts')
-rw-r--r--client/src/app/+my-account/my-account.component.ts41
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 @@
1import { Component } from '@angular/core' 1import { Component, OnInit } from '@angular/core'
2import { ServerService } from '@app/core' 2import { ServerService } from '@app/core'
3import { NavigationStart, Router } from '@angular/router'
4import { filter } from 'rxjs/operators'
5import { 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})
8export class MyAccountComponent { 12export 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}