Skip to content

Commit

Permalink
Moving terminal left / right + switching to terminal on the left and …
Browse files Browse the repository at this point in the history
…on the right is now ported
  • Loading branch information
darekg11 committed Feb 6, 2019
1 parent 8121892 commit 16eb789
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions src/app/actions/TerminalActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ const deleteTerminalInstance = terminalUUID => ({
terminalUUID,
});

const moveRightTerminalInstance = terminalUUID => ({
const moveRightTerminalInstance = terminalId => ({
type: TerminalActionTypes.MOVE_RIGHT_TERMINAL_INSTANCE,
terminalUUID,
terminalId,
});

const moveLeftTerminalInstance = terminalUUID => ({
const moveLeftTerminalInstance = terminalId => ({
type: TerminalActionTypes.MOVE_LEFT_TERMINAL_INSTANCE,
terminalUUID,
terminalId,
});

const stopTerminalInstance = terminalUUID => ({
Expand Down
16 changes: 8 additions & 8 deletions src/app/reducers/TerminalReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ export default function terminalReducer(state = initialState, action) {
};
}
case TerminalActionTypes.MOVE_RIGHT_TERMINAL_INSTANCE: {
const { terminalUUID } = action;
const { terminalId } = action;
const copiedTerminalsArray = [...state.terminals];
const terminalInstanceToMoveIndex = copiedTerminalsArray.findIndex(
singleTermianl => singleTermianl.uuid === terminalUUID,
singleTermianl => singleTermianl.id === terminalId,
);
if (terminalInstanceToMoveIndex === -1 || terminalInstanceToMoveIndex === copiedTerminalsArray.length - 1) {
return state;
Expand All @@ -133,10 +133,10 @@ export default function terminalReducer(state = initialState, action) {
};
}
case TerminalActionTypes.MOVE_LEFT_TERMINAL_INSTANCE: {
const { terminalUUID } = action;
const { terminalId } = action;
const copiedTerminalsArray = [...state.terminals];
const terminalInstanceToMoveIndex = copiedTerminalsArray.findIndex(
singleTermianl => singleTermianl.uuid === terminalUUID,
singleTermianl => singleTermianl.id === terminalId,
);
if (terminalInstanceToMoveIndex === -1 || terminalInstanceToMoveIndex === 0) {
return state;
Expand Down Expand Up @@ -165,7 +165,7 @@ export default function terminalReducer(state = initialState, action) {
case TerminalActionTypes.GO_TO_NEXT_TERMINAL_INSTANCE: {
const currentlySelectedTerminalInstance = state.selectedTerminal;
const currentlySelectedTerminalInstanceIndex = state.terminals.findIndex(
singleTerminal => singleTerminal.uuid === currentlySelectedTerminalInstance,
singleTerminal => singleTerminal.id === currentlySelectedTerminalInstance,
);
if (
currentlySelectedTerminalInstanceIndex === -1
Expand All @@ -177,13 +177,13 @@ export default function terminalReducer(state = initialState, action) {
const terminalInstanceToSelect = state.terminals[nextInOrderTerminalInstanceIndex];
return {
...state,
selectedTerminal: terminalInstanceToSelect.uuid,
selectedTerminal: terminalInstanceToSelect.id,
};
}
case TerminalActionTypes.GO_TO_PREVIOUS_TERMINAL_INSTANCE: {
const currentlySelectedTerminalInstance = state.selectedTerminal;
const currentlySelectedTerminalInstanceIndex = state.terminals.findIndex(
singleTerminal => singleTerminal.uuid === currentlySelectedTerminalInstance,
singleTerminal => singleTerminal.id === currentlySelectedTerminalInstance,
);
if (currentlySelectedTerminalInstanceIndex === -1 || currentlySelectedTerminalInstanceIndex === 0) {
return state;
Expand All @@ -192,7 +192,7 @@ export default function terminalReducer(state = initialState, action) {
const terminalInstanceToSelect = state.terminals[previousInOrderTerminalInstanceIndex];
return {
...state,
selectedTerminal: terminalInstanceToSelect.uuid,
selectedTerminal: terminalInstanceToSelect.id,
};
}
default:
Expand Down
2 changes: 1 addition & 1 deletion src/app/services/KeyboardShortcutsService.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const initializeDefaults = (reduxStore) => {
Mousetrap.bind(['alt+e'], () => {
const { selectedTerminal, terminals } = reduxStore.getState().TerminalsReducer;
if (selectedTerminal !== '') {
const selectedTerminalInstnace = terminals.find(singleTerminal => singleTerminal.uuid === selectedTerminal);
const selectedTerminalInstnace = terminals.find(singleTerminal => singleTerminal.id === selectedTerminal);
reduxStore.dispatch(TerminalAddEditWindowActions.showEditExistingTerminalWindow(selectedTerminalInstnace));
}
return false;
Expand Down

0 comments on commit 16eb789

Please sign in to comment.