diff options
author | Phil <phil.buschmann@tum.de> | 2018-06-24 02:24:43 +0200 |
---|---|---|
committer | Phil <phil.buschmann@tum.de> | 2018-06-24 02:24:43 +0200 |
commit | 6c6a674e02d3f4460dbcfa049ba717873895dbde (patch) | |
tree | 53d725ad66e9720abe19b9dec133f714084160bd /src/app/app.component.ts | |
parent | 6929f530e36335b5c96f13e9dd7e7a25376408ed (diff) | |
download | gnunet-webui-6c6a674e02d3f4460dbcfa049ba717873895dbde.tar.gz gnunet-webui-6c6a674e02d3f4460dbcfa049ba717873895dbde.zip |
Update design and fix minor bugs
Diffstat (limited to 'src/app/app.component.ts')
-rw-r--r-- | src/app/app.component.ts | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/app/app.component.ts b/src/app/app.component.ts index cb12491..5ee4946 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts | |||
@@ -23,14 +23,37 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | import { Component } from '@angular/core'; | 25 | import { Component } from '@angular/core'; |
26 | import { Router, ActivatedRoute, NavigationEnd } from '@angular/router'; | ||
27 | |||
28 | |||
29 | import { filter } from 'rxjs/operators'; | ||
26 | 30 | ||
27 | @Component({ | 31 | @Component({ |
28 | selector: 'app-root', | 32 | selector: 'app-root', |
29 | templateUrl: './app.component.html', | 33 | templateUrl: './app.component.html' |
30 | //styleUrls: ['./../scss/main.scss'] | ||
31 | }) | 34 | }) |
32 | 35 | ||
33 | 36 | ||
34 | export class AppComponent { | 37 | export class AppComponent { |
35 | title = ''; | 38 | |
39 | private active: number = 0; | ||
40 | |||
41 | menu : any[] = [ | ||
42 | {id:0, name: 'Main', link: ''}, | ||
43 | {id:1, name: 'Identities', link: 'identity'}, | ||
44 | {id:2, name: 'Names', link: 'namestore'}, | ||
45 | {id:3, name: 'Peers', link: 'peerstore'}, | ||
46 | ]; | ||
47 | |||
48 | constructor(private router: Router) { | ||
49 | router.events.pipe(filter(event => event instanceof NavigationEnd)) | ||
50 | .subscribe((route: ActivatedRoute) => { | ||
51 | let index = this.menu.find(x => { | ||
52 | let url = '/'+x.link; | ||
53 | return url == route.url+''; | ||
54 | }); | ||
55 | this.active = this.menu.indexOf(index); | ||
56 | }); | ||
57 | } | ||
58 | |||
36 | } | 59 | } |