update hotkeys to include user-specific routes
also fix left-menu width
This commit is contained in:
parent
7aba23d13f
commit
c13e2bf340
|
@ -133,10 +133,6 @@ export class AppComponent implements OnInit {
|
||||||
this.toggleMenu()
|
this.toggleMenu()
|
||||||
return false
|
return false
|
||||||
}, undefined, 'Toggle the left menu'),
|
}, undefined, 'Toggle the left menu'),
|
||||||
new Hotkey('g s', (event: KeyboardEvent): boolean => {
|
|
||||||
this.router.navigate([ '/videos/subscriptions' ])
|
|
||||||
return false
|
|
||||||
}, undefined, 'Go to the subscriptions videos page'),
|
|
||||||
new Hotkey('g o', (event: KeyboardEvent): boolean => {
|
new Hotkey('g o', (event: KeyboardEvent): boolean => {
|
||||||
this.router.navigate([ '/videos/overview' ])
|
this.router.navigate([ '/videos/overview' ])
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -14,6 +14,7 @@ import { AuthUser } from './auth-user.model'
|
||||||
import { objectToUrlEncoded } from '@app/shared/misc/utils'
|
import { objectToUrlEncoded } from '@app/shared/misc/utils'
|
||||||
import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage'
|
import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage'
|
||||||
import { I18n } from '@ngx-translate/i18n-polyfill'
|
import { I18n } from '@ngx-translate/i18n-polyfill'
|
||||||
|
import { HotkeysService, Hotkey } from 'angular2-hotkeys'
|
||||||
|
|
||||||
interface UserLoginWithUsername extends UserLogin {
|
interface UserLoginWithUsername extends UserLogin {
|
||||||
access_token: string
|
access_token: string
|
||||||
|
@ -36,6 +37,7 @@ export class AuthService {
|
||||||
|
|
||||||
loginChangedSource: Observable<AuthStatus>
|
loginChangedSource: Observable<AuthStatus>
|
||||||
userInformationLoaded = new ReplaySubject<boolean>(1)
|
userInformationLoaded = new ReplaySubject<boolean>(1)
|
||||||
|
hotkeys: Hotkey[]
|
||||||
|
|
||||||
private clientId: string = peertubeLocalStorage.getItem(AuthService.LOCAL_STORAGE_OAUTH_CLIENT_KEYS.CLIENT_ID)
|
private clientId: string = peertubeLocalStorage.getItem(AuthService.LOCAL_STORAGE_OAUTH_CLIENT_KEYS.CLIENT_ID)
|
||||||
private clientSecret: string = peertubeLocalStorage.getItem(AuthService.LOCAL_STORAGE_OAUTH_CLIENT_KEYS.CLIENT_SECRET)
|
private clientSecret: string = peertubeLocalStorage.getItem(AuthService.LOCAL_STORAGE_OAUTH_CLIENT_KEYS.CLIENT_SECRET)
|
||||||
|
@ -46,6 +48,7 @@ export class AuthService {
|
||||||
constructor (
|
constructor (
|
||||||
private http: HttpClient,
|
private http: HttpClient,
|
||||||
private notificationsService: NotificationsService,
|
private notificationsService: NotificationsService,
|
||||||
|
private hotkeysService: HotkeysService,
|
||||||
private restExtractor: RestExtractor,
|
private restExtractor: RestExtractor,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private i18n: I18n
|
private i18n: I18n
|
||||||
|
@ -55,6 +58,26 @@ export class AuthService {
|
||||||
|
|
||||||
// Return null if there is nothing to load
|
// Return null if there is nothing to load
|
||||||
this.user = AuthUser.load()
|
this.user = AuthUser.load()
|
||||||
|
|
||||||
|
// Set HotKeys
|
||||||
|
this.hotkeys = [
|
||||||
|
new Hotkey('m s', (event: KeyboardEvent): boolean => {
|
||||||
|
this.router.navigate([ '/videos/subscriptions' ])
|
||||||
|
return false
|
||||||
|
}, undefined, 'Go to my subscriptions'),
|
||||||
|
new Hotkey('m v', (event: KeyboardEvent): boolean => {
|
||||||
|
this.router.navigate([ '/my-account/videos' ])
|
||||||
|
return false
|
||||||
|
}, undefined, 'Go to my videos'),
|
||||||
|
new Hotkey('m i', (event: KeyboardEvent): boolean => {
|
||||||
|
this.router.navigate([ '/my-account/video-imports' ])
|
||||||
|
return false
|
||||||
|
}, undefined, 'Go to my imports'),
|
||||||
|
new Hotkey('m c', (event: KeyboardEvent): boolean => {
|
||||||
|
this.router.navigate([ '/my-account/video-channels' ])
|
||||||
|
return false
|
||||||
|
}, undefined, 'Go to my channels')
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
loadClientCredentials () {
|
loadClientCredentials () {
|
||||||
|
@ -152,6 +175,8 @@ export class AuthService {
|
||||||
AuthUser.flush()
|
AuthUser.flush()
|
||||||
|
|
||||||
this.setStatus(AuthStatus.LoggedOut)
|
this.setStatus(AuthStatus.LoggedOut)
|
||||||
|
|
||||||
|
this.hotkeysService.remove(this.hotkeys)
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshAccessToken () {
|
refreshAccessToken () {
|
||||||
|
@ -231,6 +256,8 @@ export class AuthService {
|
||||||
|
|
||||||
this.setStatus(AuthStatus.LoggedIn)
|
this.setStatus(AuthStatus.LoggedIn)
|
||||||
this.userInformationLoaded.next(true)
|
this.userInformationLoaded.next(true)
|
||||||
|
|
||||||
|
this.hotkeysService.add(this.hotkeys)
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleRefreshToken (obj: UserRefreshToken) {
|
private handleRefreshToken (obj: UserRefreshToken) {
|
||||||
|
|
|
@ -28,6 +28,7 @@ menu {
|
||||||
|
|
||||||
.top-menu {
|
.top-menu {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
|
width: $menu-width;
|
||||||
}
|
}
|
||||||
|
|
||||||
.logged-in-block {
|
.logged-in-block {
|
||||||
|
@ -193,6 +194,7 @@ menu {
|
||||||
padding-bottom: 15px;
|
padding-bottom: 15px;
|
||||||
padding-left: $menu-lateral-padding;
|
padding-left: $menu-lateral-padding;
|
||||||
padding-right: $menu-lateral-padding;
|
padding-right: $menu-lateral-padding;
|
||||||
|
width: $menu-width;
|
||||||
|
|
||||||
.language, .color-palette {
|
.language, .color-palette {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
@ -238,7 +240,7 @@ menu {
|
||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-menu {
|
.top-menu, .footer {
|
||||||
width: 100%;
|
width: 100% !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ p-table {
|
||||||
}
|
}
|
||||||
|
|
||||||
tr {
|
tr {
|
||||||
background-color: #fff !important;
|
background-color: var(--mainBackgroundColor) !important;
|
||||||
height: 46px;
|
height: 46px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue