New: Add support for left/right arrows on the movie details to navigate through movies

New: Add support for ctrl+home and ctrl+end to jump to the top and bottom of the movie index
New: Add redirect to previous movie instead of index when deleting one
This commit is contained in:
nitsua
2020-09-07 21:12:47 -04:00
committed by Qstick
parent 870a39278c
commit 7f814a3cb9
8 changed files with 91 additions and 11 deletions

View File

@@ -20,18 +20,26 @@ function getShortcuts() {
}
function getShortcutKey(combo, isOsx) {
const comboMatch = combo.match(/(.+?)\+(.)/);
const comboMatch = combo.match(/(.+?)\+(.*)/);
if (!comboMatch) {
return combo;
}
const modifier = comboMatch[1];
const key = comboMatch[2];
let key = comboMatch[2];
let osModifier = modifier;
if (modifier === 'mod') {
osModifier = isOsx ? 'cmd' : 'ctrl';
osModifier = isOsx ? 'cmd' : 'Ctrl';
}
if (key === 'home') {
key = isOsx ? '↑' : 'Home';
}
if (key === 'end') {
key = isOsx ? '↓' : 'End';
}
return `${osModifier} + ${key}`;

View File

@@ -1,31 +1,52 @@
import Mousetrap from 'mousetrap';
import React, { Component } from 'react';
import getDisplayName from 'Helpers/getDisplayName';
import translate from 'Utilities/String/translate';
export const shortcuts = {
OPEN_KEYBOARD_SHORTCUTS_MODAL: {
key: '?',
name: 'Open This Modal'
name: translate('OpenThisModal')
},
CLOSE_MODAL: {
key: 'Esc',
name: 'Close Current Modal'
name: translate('CloseCurrentModal')
},
ACCEPT_CONFIRM_MODAL: {
key: 'Enter',
name: 'Accept Confirmation Modal'
name: translate('AcceptConfirmationModal')
},
MOVIE_SEARCH_INPUT: {
key: 's',
name: 'Focus Search Box'
name: translate('FocusSearchBox')
},
SAVE_SETTINGS: {
key: 'mod+s',
name: 'Save Settings'
name: translate('SaveSettings')
},
SCROLL_TOP: {
key: 'mod+home',
name: translate('MovieIndexScrollTop')
},
SCROLL_BOTTOM: {
key: 'mod+end',
name: translate('MovieIndexScrollBottom')
},
DETAILS_NEXT: {
key: '→',
name: translate('MovieDetailsNextMovie')
},
DETAILS_PREVIOUS: {
key: '←',
name: translate('MovieDetailsPreviousMovie')
}
};