]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/core/hotkeys/hotkeys.component.ts
Move to sass module
[github/Chocobozzz/PeerTube.git] / client / src / app / core / hotkeys / hotkeys.component.ts
index fd62289fa256ea54e342554b9caa1777eb22f890..315e1a25e26782b18e034159bc6004b1b995cd3e 100644 (file)
@@ -1,7 +1,6 @@
-import { Component, OnInit, OnDestroy, Input } from '@angular/core'
+import { Hotkey, HotkeysService } from 'angular2-hotkeys'
 import { Subscription } from 'rxjs'
-import { I18n } from '@ngx-translate/i18n-polyfill'
-import { HotkeysService, Hotkey } from 'angular2-hotkeys'
+import { Component, Input, OnDestroy, OnInit } from '@angular/core'
 
 @Component({
   selector : 'my-hotkeys-cheatsheet',
@@ -9,16 +8,15 @@ import { HotkeysService, Hotkey } from 'angular2-hotkeys'
   styleUrls: [ './hotkeys.component.scss' ]
 })
 export class CheatSheetComponent implements OnInit, OnDestroy {
-  @Input() title = this.i18n('Keyboard Shortcuts:')
+  @Input() title = $localize`Keyboard Shortcuts:`
   helpVisible = false
   subscription: Subscription
 
   hotkeys: Hotkey[]
 
   constructor (
-    private hotkeysService: HotkeysService,
-    private i18n: I18n
-  ) {}
+    private hotkeysService: HotkeysService
+    ) {}
 
   public ngOnInit (): void {
     this.subscription = this.hotkeysService.cheatSheetToggle.subscribe((isOpen) => {
@@ -29,7 +27,7 @@ export class CheatSheetComponent implements OnInit, OnDestroy {
       if (isOpen === false) {
         this.helpVisible = false
       } else {
-        this.toggleCheatSheet()
+        this.toggleHelpVisible()
       }
     })
   }
@@ -41,6 +39,10 @@ export class CheatSheetComponent implements OnInit, OnDestroy {
   }
 
   public toggleCheatSheet (): void {
+    this.hotkeysService.cheatSheetToggle.next(!this.helpVisible)
+  }
+
+  public toggleHelpVisible (): void {
     this.helpVisible = !this.helpVisible
   }
 }