Skip to content

Commit

Permalink
New keyboard shortcuts (#6), update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
leclercb committed Dec 26, 2019
1 parent d309ad3 commit 02635e4
Show file tree
Hide file tree
Showing 8 changed files with 345 additions and 202 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* Escape clears search value (#78)
* Set selected category to added task (#79)
* Improve sort order of default filters (#84)
* New keyboard shortcuts (#6)

## Bug Fixes

Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"@fortawesome/fontawesome-svg-core": "^1.2.26",
"@fortawesome/free-solid-svg-icons": "^5.12.0",
"@fortawesome/react-fontawesome": "^0.1.8",
"antd": "^3.26.3",
"aws-amplify": "^2.2.0",
"antd": "^3.26.4",
"aws-amplify": "^2.2.1",
"axios": "^0.19.0",
"craco-antd": "^1.14.1",
"electron-is-dev": "^1.1.0",
Expand Down Expand Up @@ -50,27 +50,27 @@
"react-stripe-elements": "^6.0.1",
"react-virtualized": "^9.21.2",
"reduce-reducers": "^1.0.4",
"redux": "^4.0.4",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0",
"reselect": "^4.0.0",
"rrule": "^2.6.3",
"rrule": "^2.6.4",
"uuid": "^3.3.3"
},
"devDependencies": {
"babel-eslint": "^10.0.3",
"babel-jest": "^24.9.0",
"electron": "^7.1.6",
"electron": "^7.1.7",
"electron-builder": "^22.2.0",
"electron-devtools-installer": "^2.2.4",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.15.1",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"enzyme-to-json": "^3.4.3",
"eslint": "^6.7.2",
"eslint": "^6.8.0",
"eslint-plugin-react": "^7.17.0",
"eslint-plugin-react-hooks": "^2.3.0",
"husky": "^3.1.0",
"react-test-renderer": "^16.12.0",
"typescript": "^3.7.3"
"typescript": "^3.7.4"
},
"build": {
"appId": "com.bl-it.taskunifier",
Expand Down
12 changes: 4 additions & 8 deletions public/electronMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,16 @@ const template = [
},
{
label: 'Batch Add Tasks',
accelerator: process.platform === 'darwin' ? 'Cmd+Alt+B' : 'Ctrl+Shift+B',
click: async () => {
BrowserWindow.getFocusedWindow().webContents.send('menu-batch-add-tasks');
}
},
{
label: 'Edit Task',
label: 'Edit Task(s)',
accelerator: process.platform === 'darwin' ? 'Cmd+Alt+E' : 'Ctrl+Shift+E',
click: async () => {
BrowserWindow.getFocusedWindow().webContents.send('menu-edit-task');
}
},
{
label: 'Batch Edit Tasks',
click: async () => {
BrowserWindow.getFocusedWindow().webContents.send('menu-batch-edit-tasks');
BrowserWindow.getFocusedWindow().webContents.send('menu-edit-tasks');
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/components/tasks/batch/BatchAddTasksManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function BatchAddTasksManager({ form, onSuccess }) {
}
]
})(
<Input.TextArea autosize={{ minRows: 5 }} />
<Input.TextArea autoSize={{ minRows: 5 }} />
)}
</Form.Item>
<Form.Item label="Task Template">
Expand Down
2 changes: 1 addition & 1 deletion src/data/DataFieldComponents.js
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ export function getFieldComponents(type, options) {
input: props => (
<Input.TextArea
onBlur={props.onCommit}
autosize={true}
autoSize={true}
{...removeExtraProps(props)} />
)
};
Expand Down
8 changes: 7 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ import 'index.css';
initializeShortcuts();

window.addEventListener('error', function (e) {
console.error(e);

if (e.message === 'ResizeObserver loop limit exceeded') {
return false;
}

notification.error({
message: 'An error occurred',
description: e.error.message
description: e.error ? e.error.toString() : e.message
});

return false;
Expand Down
48 changes: 22 additions & 26 deletions src/shortcuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,8 @@ export function initializeShortcuts() {
await executeBatchAddTasks();
});

ipcRenderer.on('menu-edit-task', async () => {
await executeEditTask();
});

ipcRenderer.on('menu-batch-edit-tasks', async () => {
await executeBatchEditTasks();
ipcRenderer.on('menu-edit-tasks', async () => {
await executeEditTasks();
});

ipcRenderer.on('menu-remove-tasks', async () => {
Expand Down Expand Up @@ -135,6 +131,16 @@ export function initializeShortcuts() {
await executeAddTask();
return false;
});

Mousetrap.bind(['command+alt+b', 'ctrl+shift+b'], async () => {
await executeBatchAddTasks();
return false;
});

Mousetrap.bind(['command+alt+e', 'ctrl+shift+e'], async () => {
await executeEditTasks();
return false;
});
}
}

Expand Down Expand Up @@ -191,29 +197,19 @@ async function executeBatchAddTasks() {
await store.dispatch(setBatchAddTasksManagerOptions({ visible: true }));
}

async function executeEditTask() {
async function executeEditTasks() {
const selectedTaskIds = getSelectedTaskIds(store.getState());

if (selectedTaskIds.length !== 1) {
message.error('Please select a task');
return;
}

await store.dispatch(setTaskEditionManagerOptions({
visible: true,
taskId: selectedTaskIds[0]
}));
}

async function executeBatchEditTasks() {
const selectedTaskIds = getSelectedTaskIds(store.getState());

if (selectedTaskIds.length <= 1 || selectedTaskIds.length > 50) {
message.error('Please select two or more tasks (maximum 50)');
return;
if (selectedTaskIds.length === 1) {
await store.dispatch(setTaskEditionManagerOptions({
visible: true,
taskId: selectedTaskIds[0]
}));
} else if (selectedTaskIds.length > 1 && selectedTaskIds.length <= 50) {
await store.dispatch(setBatchEditTasksManagerOptions({ visible: true }));
} else {
message.error('Please select one or more tasks (maximum 50)');
}

await store.dispatch(setBatchEditTasksManagerOptions({ visible: true }));
}

async function executeRemoveTasks() {
Expand Down
Loading

0 comments on commit 02635e4

Please sign in to comment.