diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2018-09-08 17:54:38 +0200 |
---|---|---|
committer | Rigel Kent <sendmemail@rigelk.eu> | 2018-09-11 22:02:58 +0200 |
commit | c13e2bf340644a28012ac7ee3cf1d57763342baa (patch) | |
tree | fd235acec9649bf684fce10f68a0222aa102fa37 /client | |
parent | 7aba23d13fe56835b07ebb00c0b4c2a929551ec3 (diff) | |
download | PeerTube-c13e2bf340644a28012ac7ee3cf1d57763342baa.tar.gz PeerTube-c13e2bf340644a28012ac7ee3cf1d57763342baa.tar.zst PeerTube-c13e2bf340644a28012ac7ee3cf1d57763342baa.zip |
update hotkeys to include user-specific routes
also fix left-menu width
Diffstat (limited to 'client')
-rw-r--r-- | client/src/app/app.component.ts | 4 | ||||
-rw-r--r-- | client/src/app/core/auth/auth.service.ts | 27 | ||||
-rw-r--r-- | client/src/app/menu/menu.component.scss | 6 | ||||
-rw-r--r-- | client/src/sass/primeng-custom.scss | 2 |
4 files changed, 32 insertions, 7 deletions
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index 8354a8724..907bc583b 100644 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts | |||
@@ -133,10 +133,6 @@ export class AppComponent implements OnInit { | |||
133 | this.toggleMenu() | 133 | this.toggleMenu() |
134 | return false | 134 | return false |
135 | }, undefined, 'Toggle the left menu'), | 135 | }, undefined, 'Toggle the left menu'), |
136 | new Hotkey('g s', (event: KeyboardEvent): boolean => { | ||
137 | this.router.navigate([ '/videos/subscriptions' ]) | ||
138 | return false | ||
139 | }, undefined, 'Go to the subscriptions videos page'), | ||
140 | new Hotkey('g o', (event: KeyboardEvent): boolean => { | 136 | new Hotkey('g o', (event: KeyboardEvent): boolean => { |
141 | this.router.navigate([ '/videos/overview' ]) | 137 | this.router.navigate([ '/videos/overview' ]) |
142 | return false | 138 | return false |
diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts index 9ec404557..88ea89639 100644 --- a/client/src/app/core/auth/auth.service.ts +++ b/client/src/app/core/auth/auth.service.ts | |||
@@ -14,6 +14,7 @@ import { AuthUser } from './auth-user.model' | |||
14 | import { objectToUrlEncoded } from '@app/shared/misc/utils' | 14 | import { objectToUrlEncoded } from '@app/shared/misc/utils' |
15 | import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage' | 15 | import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage' |
16 | import { I18n } from '@ngx-translate/i18n-polyfill' | 16 | import { I18n } from '@ngx-translate/i18n-polyfill' |
17 | import { HotkeysService, Hotkey } from 'angular2-hotkeys' | ||
17 | 18 | ||
18 | interface UserLoginWithUsername extends UserLogin { | 19 | interface UserLoginWithUsername extends UserLogin { |
19 | access_token: string | 20 | access_token: string |
@@ -36,6 +37,7 @@ export class AuthService { | |||
36 | 37 | ||
37 | loginChangedSource: Observable<AuthStatus> | 38 | loginChangedSource: Observable<AuthStatus> |
38 | userInformationLoaded = new ReplaySubject<boolean>(1) | 39 | userInformationLoaded = new ReplaySubject<boolean>(1) |
40 | hotkeys: Hotkey[] | ||
39 | 41 | ||
40 | private clientId: string = peertubeLocalStorage.getItem(AuthService.LOCAL_STORAGE_OAUTH_CLIENT_KEYS.CLIENT_ID) | 42 | private clientId: string = peertubeLocalStorage.getItem(AuthService.LOCAL_STORAGE_OAUTH_CLIENT_KEYS.CLIENT_ID) |
41 | private clientSecret: string = peertubeLocalStorage.getItem(AuthService.LOCAL_STORAGE_OAUTH_CLIENT_KEYS.CLIENT_SECRET) | 43 | private clientSecret: string = peertubeLocalStorage.getItem(AuthService.LOCAL_STORAGE_OAUTH_CLIENT_KEYS.CLIENT_SECRET) |
@@ -46,6 +48,7 @@ export class AuthService { | |||
46 | constructor ( | 48 | constructor ( |
47 | private http: HttpClient, | 49 | private http: HttpClient, |
48 | private notificationsService: NotificationsService, | 50 | private notificationsService: NotificationsService, |
51 | private hotkeysService: HotkeysService, | ||
49 | private restExtractor: RestExtractor, | 52 | private restExtractor: RestExtractor, |
50 | private router: Router, | 53 | private router: Router, |
51 | private i18n: I18n | 54 | private i18n: I18n |
@@ -55,6 +58,26 @@ export class AuthService { | |||
55 | 58 | ||
56 | // Return null if there is nothing to load | 59 | // Return null if there is nothing to load |
57 | this.user = AuthUser.load() | 60 | this.user = AuthUser.load() |
61 | |||
62 | // Set HotKeys | ||
63 | this.hotkeys = [ | ||
64 | new Hotkey('m s', (event: KeyboardEvent): boolean => { | ||
65 | this.router.navigate([ '/videos/subscriptions' ]) | ||
66 | return false | ||
67 | }, undefined, 'Go to my subscriptions'), | ||
68 | new Hotkey('m v', (event: KeyboardEvent): boolean => { | ||
69 | this.router.navigate([ '/my-account/videos' ]) | ||
70 | return false | ||
71 | }, undefined, 'Go to my videos'), | ||
72 | new Hotkey('m i', (event: KeyboardEvent): boolean => { | ||
73 | this.router.navigate([ '/my-account/video-imports' ]) | ||
74 | return false | ||
75 | }, undefined, 'Go to my imports'), | ||
76 | new Hotkey('m c', (event: KeyboardEvent): boolean => { | ||
77 | this.router.navigate([ '/my-account/video-channels' ]) | ||
78 | return false | ||
79 | }, undefined, 'Go to my channels') | ||
80 | ] | ||
58 | } | 81 | } |
59 | 82 | ||
60 | loadClientCredentials () { | 83 | loadClientCredentials () { |
@@ -152,6 +175,8 @@ export class AuthService { | |||
152 | AuthUser.flush() | 175 | AuthUser.flush() |
153 | 176 | ||
154 | this.setStatus(AuthStatus.LoggedOut) | 177 | this.setStatus(AuthStatus.LoggedOut) |
178 | |||
179 | this.hotkeysService.remove(this.hotkeys) | ||
155 | } | 180 | } |
156 | 181 | ||
157 | refreshAccessToken () { | 182 | refreshAccessToken () { |
@@ -231,6 +256,8 @@ export class AuthService { | |||
231 | 256 | ||
232 | this.setStatus(AuthStatus.LoggedIn) | 257 | this.setStatus(AuthStatus.LoggedIn) |
233 | this.userInformationLoaded.next(true) | 258 | this.userInformationLoaded.next(true) |
259 | |||
260 | this.hotkeysService.add(this.hotkeys) | ||
234 | } | 261 | } |
235 | 262 | ||
236 | private handleRefreshToken (obj: UserRefreshToken) { | 263 | private handleRefreshToken (obj: UserRefreshToken) { |
diff --git a/client/src/app/menu/menu.component.scss b/client/src/app/menu/menu.component.scss index f1b0a284f..0f98da0e2 100644 --- a/client/src/app/menu/menu.component.scss +++ b/client/src/app/menu/menu.component.scss | |||
@@ -28,6 +28,7 @@ menu { | |||
28 | 28 | ||
29 | .top-menu { | 29 | .top-menu { |
30 | flex-grow: 1; | 30 | flex-grow: 1; |
31 | width: $menu-width; | ||
31 | } | 32 | } |
32 | 33 | ||
33 | .logged-in-block { | 34 | .logged-in-block { |
@@ -193,6 +194,7 @@ menu { | |||
193 | padding-bottom: 15px; | 194 | padding-bottom: 15px; |
194 | padding-left: $menu-lateral-padding; | 195 | padding-left: $menu-lateral-padding; |
195 | padding-right: $menu-lateral-padding; | 196 | padding-right: $menu-lateral-padding; |
197 | width: $menu-width; | ||
196 | 198 | ||
197 | .language, .color-palette { | 199 | .language, .color-palette { |
198 | display: inline-block; | 200 | display: inline-block; |
@@ -238,7 +240,7 @@ menu { | |||
238 | width: 100% !important; | 240 | width: 100% !important; |
239 | } | 241 | } |
240 | 242 | ||
241 | .top-menu { | 243 | .top-menu, .footer { |
242 | width: 100%; | 244 | width: 100% !important; |
243 | } | 245 | } |
244 | } | 246 | } |
diff --git a/client/src/sass/primeng-custom.scss b/client/src/sass/primeng-custom.scss index a998652d5..d99c5b96a 100644 --- a/client/src/sass/primeng-custom.scss +++ b/client/src/sass/primeng-custom.scss | |||
@@ -26,7 +26,7 @@ p-table { | |||
26 | } | 26 | } |
27 | 27 | ||
28 | tr { | 28 | tr { |
29 | background-color: #fff !important; | 29 | background-color: var(--mainBackgroundColor) !important; |
30 | height: 46px; | 30 | height: 46px; |
31 | } | 31 | } |
32 | 32 | ||