diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2018-09-04 23:14:31 +0200 |
---|---|---|
committer | Rigel Kent <par@rigelk.eu> | 2018-09-04 23:24:34 +0200 |
commit | 8c985ef5cee948093a0c44bf9f09a96374a061d3 (patch) | |
tree | fdd8567907755642122aab56a2352cb36b358c06 /client/src/app | |
parent | 9a0fc8409c7a783348ec212fa9f38d0a98413467 (diff) | |
download | PeerTube-8c985ef5cee948093a0c44bf9f09a96374a061d3.tar.gz PeerTube-8c985ef5cee948093a0c44bf9f09a96374a061d3.tar.zst PeerTube-8c985ef5cee948093a0c44bf9f09a96374a061d3.zip |
hotkey to toggle dark theme
Diffstat (limited to 'client/src/app')
-rw-r--r-- | client/src/app/menu/menu.component.ts | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/client/src/app/menu/menu.component.ts b/client/src/app/menu/menu.component.ts index 3de4a78af..22ddfad02 100644 --- a/client/src/app/menu/menu.component.ts +++ b/client/src/app/menu/menu.component.ts | |||
@@ -3,6 +3,7 @@ import { UserRight } from '../../../../shared/models/users/user-right.enum' | |||
3 | import { AuthService, AuthStatus, RedirectService, ServerService } from '../core' | 3 | import { AuthService, AuthStatus, RedirectService, ServerService } from '../core' |
4 | import { User } from '../shared/users/user.model' | 4 | import { User } from '../shared/users/user.model' |
5 | import { LanguageChooserComponent } from '@app/menu/language-chooser.component' | 5 | import { LanguageChooserComponent } from '@app/menu/language-chooser.component' |
6 | import { Hotkey, HotkeysService } from 'angular2-hotkeys' | ||
6 | 7 | ||
7 | @Component({ | 8 | @Component({ |
8 | selector: 'my-menu', | 9 | selector: 'my-menu', |
@@ -15,6 +16,7 @@ export class MenuComponent implements OnInit { | |||
15 | user: User | 16 | user: User |
16 | isLoggedIn: boolean | 17 | isLoggedIn: boolean |
17 | userHasAdminAccess = false | 18 | userHasAdminAccess = false |
19 | hotkeys: Hotkey[] | ||
18 | 20 | ||
19 | private routesPerRight = { | 21 | private routesPerRight = { |
20 | [UserRight.MANAGE_USERS]: '/admin/users', | 22 | [UserRight.MANAGE_USERS]: '/admin/users', |
@@ -28,7 +30,8 @@ export class MenuComponent implements OnInit { | |||
28 | constructor ( | 30 | constructor ( |
29 | private authService: AuthService, | 31 | private authService: AuthService, |
30 | private serverService: ServerService, | 32 | private serverService: ServerService, |
31 | private redirectService: RedirectService | 33 | private redirectService: RedirectService, |
34 | private hotkeysService: HotkeysService | ||
32 | ) {} | 35 | ) {} |
33 | 36 | ||
34 | ngOnInit () { | 37 | ngOnInit () { |
@@ -60,6 +63,14 @@ export class MenuComponent implements OnInit { | |||
60 | this.previousTheme['submenuColor'] = 'rgb(32,32,32)' | 63 | this.previousTheme['submenuColor'] = 'rgb(32,32,32)' |
61 | this.previousTheme['inputColor'] = 'gray' | 64 | this.previousTheme['inputColor'] = 'gray' |
62 | this.previousTheme['inputPlaceholderColor'] = '#fff' | 65 | this.previousTheme['inputPlaceholderColor'] = '#fff' |
66 | |||
67 | this.hotkeys = [ | ||
68 | new Hotkey('T', (event: KeyboardEvent): boolean => { | ||
69 | this.toggleDarkTheme() | ||
70 | return false | ||
71 | }, undefined, 'Toggle Dark theme') | ||
72 | ] | ||
73 | this.hotkeysService.add(this.hotkeys) | ||
63 | } | 74 | } |
64 | 75 | ||
65 | isRegistrationAllowed () { | 76 | isRegistrationAllowed () { |