Upgrading redux; Refactoring tabs; Adding servers index

This commit is contained in:
James Barnsley
2020-04-26 22:04:39 +12:00
parent b95c0fe3cb
commit 92292b18d7
20 changed files with 8852 additions and 4806 deletions

View File

@ -66,49 +66,49 @@ class Hotkeys extends React.Component {
prevent = true;
break;
case 'escape':
if (dragging) {
uiActions.dragEnd();
prevent = true;
if (allow_reporting) ReactGA.event({ category: 'Hotkey', action: key, label: 'Dragging' });
} else if (modal) {
window.history.back();
prevent = true;
if (allow_reporting) ReactGA.event({ category: 'Hotkey', action: key, label: 'Modal' });
case 's': // Stop
mopidyActions.stop();
uiActions.createNotification({ content: 'stop', type: 'shortcut' });
prevent = true;
if (allow_reporting) ReactGA.event({ category: 'Hotkey', action: key, label: 'Stop' });
break;
case 'b': // Seek backwards 30 sec
var new_position = play_time_position - 30000;
if (new_position < 0) {
new_position = 0;
}
mopidyActions.setTimePosition(new_position);
uiActions.createNotification({ content: 'fast_rewind', type: 'shortcut' });
prevent = true;
if (allow_reporting) ReactGA.event({ category: 'Hotkey', action: key, label: 'Rewind' });
break;
case 's':
history.push('/search');
case 'f': // Seek forwards 30 sec
mopidyActions.setTimePosition(play_time_position + 30000);
uiActions.createNotification({ content: 'fast_forward', type: 'shortcut' });
prevent = true;
if (allow_reporting) ReactGA.event({ category: 'Hotkey', action: key, label: 'Search' });
break;
case 'q':
history.push('/queue');
prevent = true;
if (allow_reporting) ReactGA.event({ category: 'Hotkey', action: key, label: 'Queue' });
break;
case 'k':
history.push('/kiosk-mode');
prevent = true;
if (allow_reporting) ReactGA.event({ category: 'Hotkey', action: key, label: 'Kiosk mode' });
if (allow_reporting) ReactGA.event({ category: 'Hotkey', action: key, label: 'Fastforward' });
break;
case ',':
window.history.back();
case '<': // Previous track
mopidyActions.previous();
uiActions.createNotification({ content: 'skip_previous', type: 'shortcut' });
prevent = true;
if (allow_reporting) ReactGA.event({ category: 'Hotkey', action: key, label: 'Back' });
if (allow_reporting) ReactGA.event({ category: 'Hotkey', action: key, label: 'Previous' });
break;
case '.':
window.history.forward();
case '>': // Next track
mopidyActions.next();
uiActions.createNotification({ content: 'skip_next', type: 'shortcut' });
prevent = true;
if (allow_reporting) ReactGA.event({ category: 'Hotkey', action: key, label: 'Forward' });
if (allow_reporting) ReactGA.event({ category: 'Hotkey', action: key, label: 'Next' });
break;
case '=':
case '+': // Volume up
if (volume !== 'false') {
volume += 5;
if (volume > 100) {
@ -124,7 +124,7 @@ class Hotkeys extends React.Component {
if (allow_reporting) ReactGA.event({ category: 'Hotkey', action: key, label: 'Volume up' });
break;
case '-':
case '-': // Volume down
if (volume !== 'false') {
volume -= 5;
if (volume < 0) {
@ -140,7 +140,7 @@ class Hotkeys extends React.Component {
if (allow_reporting) ReactGA.event({ category: 'Hotkey', action: key, label: 'Volume down' });
break;
case '0':
case '0': // Mute
if (mute) {
mopidyActions.setMute(false);
uiActions.createNotification({ content: 'volume_up', type: 'shortcut' });
@ -153,36 +153,34 @@ class Hotkeys extends React.Component {
prevent = true;
break;
case ';':
var new_position = play_time_position - 30000;
if (new_position < 0) {
new_position = 0;
case 'escape': // Cancel current action/context
if (dragging) {
uiActions.dragEnd();
prevent = true;
if (allow_reporting) ReactGA.event({ category: 'Hotkey', action: key, label: 'Dragging' });
} else if (modal) {
window.history.back();
prevent = true;
if (allow_reporting) ReactGA.event({ category: 'Hotkey', action: key, label: 'Modal' });
}
mopidyActions.setTimePosition(new_position);
uiActions.createNotification({ content: 'fast_rewind', type: 'shortcut' });
prevent = true;
if (allow_reporting) ReactGA.event({ category: 'Hotkey', action: key, label: 'Rewind' });
break;
case "'":
mopidyActions.setTimePosition(play_time_position + 30000);
uiActions.createNotification({ content: 'fast_forward', type: 'shortcut' });
case '1': // Navigation: Queue
history.push('/queue');
prevent = true;
if (allow_reporting) ReactGA.event({ category: 'Hotkey', action: key, label: 'Fastforward' });
if (allow_reporting) ReactGA.event({ category: 'Hotkey', action: key, label: 'Queue' });
break;
case '[':
mopidyActions.previous();
uiActions.createNotification({ content: 'skip_previous', type: 'shortcut' });
case '2': // Navigation: Search
history.push('/search');
prevent = true;
if (allow_reporting) ReactGA.event({ category: 'Hotkey', action: key, label: 'Previous' });
if (allow_reporting) ReactGA.event({ category: 'Hotkey', action: key, label: 'Search' });
break;
case ']':
mopidyActions.next();
uiActions.createNotification({ content: 'skip_next', type: 'shortcut' });
case '3': // Navigation: Kiosk mode
history.push('/kiosk-mode');
prevent = true;
if (allow_reporting) ReactGA.event({ category: 'Hotkey', action: key, label: 'Next' });
if (allow_reporting) ReactGA.event({ category: 'Hotkey', action: key, label: 'Kiosk mode' });
break;
default: