Started interface user shortcut form interface

Built controller actions and initual UI.
Still needs JS logic for shortcut input handling.
This commit is contained in:
Dan Brown
2022-11-08 21:17:45 +00:00
parent 1fc994177f
commit 66c8809799
13 changed files with 232 additions and 40 deletions

View File

@ -1,35 +1,3 @@
/**
* The default mapping of unique id to shortcut key.
* @type {Object<string, string>}
*/
const defaultMap = {
// Header actions
"home": "1",
"shelves_view": "2",
"books_view": "3",
"settings_view": "4",
"favorites_view": "5",
"profile_view": "6",
"global_search": "/",
"logout": "0",
// Generic actions
"edit": "e",
"new": "n",
"copy": "c",
"delete": "d",
"favorite": "f",
"export": "x",
"sort": "s",
"permissions": "p",
"move": "m",
"revisions": "r",
// Navigation
"next": "ArrowRight",
"prev": "ArrowLeft",
};
function reverseMap(map) {
const reversed = {};
for (const [key, value] of Object.entries(map)) {
@ -45,14 +13,12 @@ class Shortcuts {
setup() {
this.container = this.$el;
this.mapById = defaultMap;
this.mapById = JSON.parse(this.$opts.keyMap);
this.mapByShortcut = reverseMap(this.mapById);
this.hintsShowing = false;
this.hideHints = this.hideHints.bind(this);
// TODO - Allow custom key maps
// TODO - Allow turning off shortcuts
this.setupListeners();
}