aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/follows/follows.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/+admin/follows/follows.component.ts')
-rw-r--r--client/src/app/+admin/follows/follows.component.ts43
1 files changed, 43 insertions, 0 deletions
diff --git a/client/src/app/+admin/follows/follows.component.ts b/client/src/app/+admin/follows/follows.component.ts
new file mode 100644
index 000000000..97422a41b
--- /dev/null
+++ b/client/src/app/+admin/follows/follows.component.ts
@@ -0,0 +1,43 @@
1import { AfterViewInit, Component, ViewChild } from '@angular/core'
2import { TabsetComponent } from 'ngx-bootstrap/tabs'
3
4@Component({
5 templateUrl: './follows.component.html',
6 styleUrls: [ './follows.component.scss' ]
7})
8export class FollowsComponent implements AfterViewInit {
9 @ViewChild('followsMenuTabs') followsMenuTabs: TabsetComponent
10
11 links = [
12 {
13 path: 'following-list',
14 title: 'Following'
15 },
16 {
17 path: 'following-add',
18 title: 'Follow'
19 },
20 {
21 path: 'followers-list',
22 title: 'Followers'
23 }
24 ]
25
26 ngAfterViewInit () {
27 // Avoid issue with change detector
28 setTimeout(() => this.updateActiveTab())
29 }
30
31 private updateActiveTab () {
32 const url = window.location.pathname
33
34 for (let i = 0; i < this.links.length; i++) {
35 const path = this.links[i].path
36
37 if (url.endsWith(path) === true) {
38 this.followsMenuTabs.tabs[i].active = true
39 return
40 }
41 }
42 }
43}