aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/app.component.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-06-16 14:32:15 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-06-16 14:32:15 +0200
commitdf98563e2104b82b119c00a3cd83cd0dc1242d25 (patch)
treea9720bf01bac9ad5646bd3d3c9bc7653617afdad /client/src/app/app.component.ts
parent46757b477c1adb5f98060d15998a3852e18902a6 (diff)
downloadPeerTube-df98563e2104b82b119c00a3cd83cd0dc1242d25.tar.gz
PeerTube-df98563e2104b82b119c00a3cd83cd0dc1242d25.tar.zst
PeerTube-df98563e2104b82b119c00a3cd83cd0dc1242d25.zip
Use typescript standard and lint all files
Diffstat (limited to 'client/src/app/app.component.ts')
-rw-r--r--client/src/app/app.component.ts50
1 files changed, 25 insertions, 25 deletions
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts
index b8b732169..a90654e26 100644
--- a/client/src/app/app.component.ts
+++ b/client/src/app/app.component.ts
@@ -1,9 +1,9 @@
1import { Component, OnInit, ViewContainerRef } from '@angular/core'; 1import { Component, OnInit, ViewContainerRef } from '@angular/core'
2import { Router } from '@angular/router'; 2import { Router } from '@angular/router'
3 3
4import { AuthService, ConfigService } from './core'; 4import { AuthService, ConfigService } from './core'
5import { VideoService } from './videos'; 5import { VideoService } from './videos'
6import { UserService } from './shared'; 6import { UserService } from './shared'
7 7
8@Component({ 8@Component({
9 selector: 'my-app', 9 selector: 'my-app',
@@ -22,11 +22,11 @@ export class AppComponent implements OnInit {
22 preventDuplicates: false, 22 preventDuplicates: false,
23 preventLastDuplicates: 'visible', 23 preventLastDuplicates: 'visible',
24 rtl: false 24 rtl: false
25 }; 25 }
26 26
27 isMenuDisplayed = true; 27 isMenuDisplayed = true
28 28
29 constructor( 29 constructor (
30 private router: Router, 30 private router: Router,
31 private authService: AuthService, 31 private authService: AuthService,
32 private configService: ConfigService, 32 private configService: ConfigService,
@@ -35,46 +35,46 @@ export class AppComponent implements OnInit {
35 viewContainerRef: ViewContainerRef 35 viewContainerRef: ViewContainerRef
36 ) {} 36 ) {}
37 37
38 ngOnInit() { 38 ngOnInit () {
39 if (this.authService.isLoggedIn()) { 39 if (this.authService.isLoggedIn()) {
40 // The service will automatically redirect to the login page if the token is not valid anymore 40 // The service will automatically redirect to the login page if the token is not valid anymore
41 this.userService.checkTokenValidity(); 41 this.userService.checkTokenValidity()
42 } 42 }
43 43
44 this.configService.loadConfig(); 44 this.configService.loadConfig()
45 this.videoService.loadVideoCategories(); 45 this.videoService.loadVideoCategories()
46 this.videoService.loadVideoLicences(); 46 this.videoService.loadVideoLicences()
47 this.videoService.loadVideoLanguages(); 47 this.videoService.loadVideoLanguages()
48 48
49 // Do not display menu on small screens 49 // Do not display menu on small screens
50 if (window.innerWidth < 600) { 50 if (window.innerWidth < 600) {
51 this.isMenuDisplayed = false; 51 this.isMenuDisplayed = false
52 } 52 }
53 } 53 }
54 54
55 isInAdmin() { 55 isInAdmin () {
56 return this.router.url.indexOf('/admin/') !== -1; 56 return this.router.url.indexOf('/admin/') !== -1
57 } 57 }
58 58
59 toggleMenu() { 59 toggleMenu () {
60 this.isMenuDisplayed = !this.isMenuDisplayed; 60 this.isMenuDisplayed = !this.isMenuDisplayed
61 } 61 }
62 62
63 getMainColClasses() { 63 getMainColClasses () {
64 const colSizes = { 64 const colSizes = {
65 md: 10, 65 md: 10,
66 sm: 9, 66 sm: 9,
67 xs: 9 67 xs: 9
68 }; 68 }
69 69
70 // Take all width is the menu is not displayed 70 // Take all width is the menu is not displayed
71 if (this.isMenuDisplayed === false) { 71 if (this.isMenuDisplayed === false) {
72 Object.keys(colSizes).forEach(col => colSizes[col] = 12); 72 Object.keys(colSizes).forEach(col => colSizes[col] = 12)
73 } 73 }
74 74
75 const classes = [ 'main-col' ]; 75 const classes = [ 'main-col' ]
76 Object.keys(colSizes).forEach(col => classes.push(`col-${col}-${colSizes[col]}`)); 76 Object.keys(colSizes).forEach(col => classes.push(`col-${col}-${colSizes[col]}`))
77 77
78 return classes; 78 return classes
79 } 79 }
80} 80}