From 06727bfb5bfdec415b229bbbbce300a09c6b410a Mon Sep 17 00:00:00 2001 From: James Barnsley Date: Sun, 4 Sep 2022 08:57:58 +1200 Subject: [PATCH] Reinstating page navigation hotkeys, fixes #862 --- src/js/components/Hotkeys.js | 30 ++++++++++++++++++++++++++++++ src/js/locale/en.yaml | 3 +++ src/js/views/Modals/HotkeysInfo.js | 4 ++++ 3 files changed, 37 insertions(+) diff --git a/src/js/components/Hotkeys.js b/src/js/components/Hotkeys.js index 373076cf..987f914a 100755 --- a/src/js/components/Hotkeys.js +++ b/src/js/components/Hotkeys.js @@ -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', diff --git a/src/js/locale/en.yaml b/src/js/locale/en.yaml index 6f46dcd6..aeac3de6 100755 --- a/src/js/locale/en.yaml +++ b/src/js/locale/en.yaml @@ -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 diff --git a/src/js/views/Modals/HotkeysInfo.js b/src/js/views/Modals/HotkeysInfo.js index 3f679f16..bc949fe4 100644 --- a/src/js/views/Modals/HotkeysInfo.js +++ b/src/js/views/Modals/HotkeysInfo.js @@ -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']] },