diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2018-09-06 12:00:53 +0200 |
---|---|---|
committer | Rigel Kent <sendmemail@rigelk.eu> | 2018-09-06 12:00:53 +0200 |
commit | 1a00c5619f11c5faecd384b011e037a8ed5fde46 (patch) | |
tree | 82d2830d5a25089d825711c225766711dc08c99f /client/src/app/app.component.ts | |
parent | 1c66c35c55eed2ffbbf97ec463a3539c35952ec3 (diff) | |
download | PeerTube-1a00c5619f11c5faecd384b011e037a8ed5fde46.tar.gz PeerTube-1a00c5619f11c5faecd384b011e037a8ed5fde46.tar.zst PeerTube-1a00c5619f11c5faecd384b011e037a8ed5fde46.zip |
refactor theme toggle into a service
Diffstat (limited to 'client/src/app/app.component.ts')
-rw-r--r-- | client/src/app/app.component.ts | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index 5086384f4..d4841a69b 100644 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { DomSanitizer, SafeHtml } from '@angular/platform-browser' | 2 | import { DomSanitizer, SafeHtml } from '@angular/platform-browser' |
3 | import { GuardsCheckStart, NavigationEnd, Router } from '@angular/router' | 3 | import { GuardsCheckStart, NavigationEnd, Router } from '@angular/router' |
4 | import { AuthService, RedirectService, ServerService } from '@app/core' | 4 | import { AuthService, RedirectService, ServerService, ThemeService } from '@app/core' |
5 | import { is18nPath } from '../../../shared/models/i18n' | 5 | import { is18nPath } from '../../../shared/models/i18n' |
6 | import { ScreenService } from '@app/shared/misc/screen.service' | 6 | import { ScreenService } from '@app/shared/misc/screen.service' |
7 | import { skip } from 'rxjs/operators' | 7 | import { skip } from 'rxjs/operators' |
@@ -37,7 +37,8 @@ export class AppComponent implements OnInit { | |||
37 | private domSanitizer: DomSanitizer, | 37 | private domSanitizer: DomSanitizer, |
38 | private redirectService: RedirectService, | 38 | private redirectService: RedirectService, |
39 | private screenService: ScreenService, | 39 | private screenService: ScreenService, |
40 | private hotkeysService: HotkeysService | 40 | private hotkeysService: HotkeysService, |
41 | private themeService: ThemeService | ||
41 | ) { } | 42 | ) { } |
42 | 43 | ||
43 | get serverVersion () { | 44 | get serverVersion () { |
@@ -155,7 +156,11 @@ export class AppComponent implements OnInit { | |||
155 | new Hotkey('g u', (event: KeyboardEvent): boolean => { | 156 | new Hotkey('g u', (event: KeyboardEvent): boolean => { |
156 | this.router.navigate([ '/videos/upload' ]) | 157 | this.router.navigate([ '/videos/upload' ]) |
157 | return false | 158 | return false |
158 | }, undefined, 'Go to the videos upload page') | 159 | }, undefined, 'Go to the videos upload page'), |
160 | new Hotkey('T', (event: KeyboardEvent): boolean => { | ||
161 | this.themeService.toggleDarkTheme() | ||
162 | return false | ||
163 | }, undefined, 'Toggle Dark theme') | ||
159 | ]) | 164 | ]) |
160 | } | 165 | } |
161 | 166 | ||