feat(tasks): add shortcut to focus last active task

This commit is contained in:
Johannes Millan 2018-11-23 18:09:35 +01:00
parent 15dee511d8
commit 7ea6ec3aba
5 changed files with 20 additions and 0 deletions

View file

@ -9,6 +9,7 @@ export type KeyboardConfig = Readonly<{
showHelp: string,
openProjectNotes: string,
openDistractionPanel: string,
focusLastActiveTask: string,
taskEditTitle: string,
taskToggleAdditionalInfoOpen: string,
taskOpenEstimationDialog: string,

View file

@ -40,6 +40,7 @@ export const DEFAULT_CFG: GlobalConfig = {
goToDailyAgenda: '',
goToFocusMode: 'F',
goToSettings: '',
focusLastActiveTask: 'f',
taskEditTitle: 'e',
taskToggleAdditionalInfoOpen: 'n',
taskOpenEstimationDialog: 't',

View file

@ -99,6 +99,13 @@ export const KEYBOARD_SETTINGS_FORM_CFG = {
label: 'Go to Settings',
},
},
{
key: 'focusLastActiveTask',
type: 'keyboard',
templateOptions: {
label: 'Focus last active task',
},
},
// TASKS
{
className: 'tpl',

View file

@ -7,6 +7,7 @@ import { IPC_REGISTER_GLOBAL_SHORTCUT_EVENT } from '../../../ipc-events.const';
import { ElectronService } from 'ngx-electron';
import { LayoutService } from '../layout/layout.service';
import { NoteService } from '../../note/note.service';
import { TaskService } from '../../tasks/task.service';
@Injectable({
@ -21,6 +22,7 @@ export class ShortcutService {
private _electronService: ElectronService,
private _layoutService: LayoutService,
private _noteService: NoteService,
private _taskService: TaskService,
private _activatedRoute: ActivatedRoute,
) {
// // Register electron shortcut(s)
@ -85,6 +87,10 @@ export class ShortcutService {
if (checkKeyCombo(ev, keys.goToFocusMode)) {
this._router.navigate(['/focus-view']);
}
if (checkKeyCombo(ev, keys.focusLastActiveTask)) {
this._router.navigate(['/work-view']);
this._taskService.focusLastActiveTask();
}
if (checkKeyCombo(ev, keys.addNewTask)) {
this._layoutService.toggleAddTaskBar();
ev.preventDefault();

View file

@ -9,6 +9,7 @@ import {
AddTask,
AddTimeSpent,
DeleteTask,
FocusLastActiveTask,
FocusTask,
LoadTaskState,
Move,
@ -218,6 +219,10 @@ export class TaskService {
this._store.dispatch(new FocusTask({id}));
}
focusLastActiveTask() {
this._store.dispatch(new FocusLastActiveTask());
}
moveToToday(id) {
this._store.dispatch(new MoveToToday({id}));
}