Skip to content

Commit

Permalink
Reinstating page navigation hotkeys, fixes #862
Browse files Browse the repository at this point in the history
  • Loading branch information
jaedb committed Sep 3, 2022
1 parent daee7b4 commit 06727bf
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/js/components/Hotkeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,36 @@ const Hotkeys = () => {
});
});

useHotkeys('1', (e) => {
prepare({
e,
label: 'Now playing',
callback: () => {
history.push('/queue');
},
});
});

useHotkeys('2', (e) => {
prepare({
e,
label: 'Search',
callback: () => {
history.push('/search');
},
});
});

useHotkeys('3', (e) => {
prepare({
e,
label: 'Kiosk mode',
callback: () => {
history.push('/modal/kiosk-mode');
},
});
});

useHotkeys('space,p', (e) => prepare({
e,
label: 'Play/pause',
Expand Down
3 changes: 3 additions & 0 deletions src/js/locale/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,9 @@ modal:
title: Hotkeys
keys:
info: Hotkeys info (this dialog)
now_playing: Now playing
search: Search
kiosk_mode: Kiosk mode
exit: Cancel the current interaction
play_pause: Play/pause
stop: Stop
Expand Down
4 changes: 4 additions & 0 deletions src/js/views/Modals/HotkeysInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import * as uiActions from '../../services/ui/actions';
import { I18n, i18n } from '../../locale';

const hotkeys = [
{ label: 'now_playing', keysets: [['1']] },
{ label: 'search', keysets: [['2']] },
{ label: 'kiosk_mode', keysets: [['3']] },
{ label: 'info', keysets: [['i']] },
{ label: 'info', keysets: [['i']] },
{ label: 'play_pause', keysets: [['p'], ['spacebar']] },
{ label: 'stop', keysets: [['s']] },
Expand Down

0 comments on commit 06727bf

Please sign in to comment.