From 9b4e172ec0c54aeaa5f7a212f7c1ac8b7da1ace7 Mon Sep 17 00:00:00 2001 From: Dustin Davis Date: Fri, 3 Dec 2021 09:42:35 -0700 Subject: [PATCH 1/4] Taskslist (#2) Show current notes tasks only --- client/src/App.vue | 16 ++++++++- client/src/components/Editor.vue | 35 +++++++++++++++++++- client/src/components/Header.vue | 17 +++------- client/src/components/TaskItem.vue | 52 ++++++++++++++++++++++++++++++ client/src/components/Tasks.vue | 44 +++++++++++++++++++++++++ 5 files changed, 149 insertions(+), 15 deletions(-) create mode 100644 client/src/components/TaskItem.vue create mode 100644 client/src/components/Tasks.vue diff --git a/client/src/App.vue b/client/src/App.vue index b1820d4..a15f20a 100644 --- a/client/src/App.vue +++ b/client/src/App.vue @@ -13,8 +13,22 @@ export default { mounted: function() { SharedBuefy.notifications = this.$buefy.toast; SharedBuefy.dialog = this.$buefy.dialog; + }, + provide() { + const global = {}; + Object.defineProperty(global, "taskList", { + enumerable: true, + get: () => this.taskList + }); + return { global }; + }, + data() { + return { + global: {}, + taskList: [] + }; } -} +}; \ No newline at end of file + diff --git a/client/src/components/TaskItem.vue b/client/src/components/TaskItem.vue new file mode 100644 index 0000000..030cdc5 --- /dev/null +++ b/client/src/components/TaskItem.vue @@ -0,0 +1,52 @@ + + + + + diff --git a/client/src/components/Tasks.vue b/client/src/components/Tasks.vue new file mode 100644 index 0000000..b4da2c1 --- /dev/null +++ b/client/src/components/Tasks.vue @@ -0,0 +1,44 @@ + + + + + From 362c0e3a0affd210e926f930fda7599e6da308f0 Mon Sep 17 00:00:00 2001 From: Dustin Davis Date: Fri, 10 Dec 2021 12:56:57 -0700 Subject: [PATCH 2/4] Add default option to save changes on the unsaved changes dialog --- client/src/components/UnsavedForm.vue | 94 +++++++++++++++++++++++++++ client/src/views/Day.vue | 26 +++++--- client/src/views/NewNote.vue | 26 +++++--- 3 files changed, 130 insertions(+), 16 deletions(-) create mode 100644 client/src/components/UnsavedForm.vue diff --git a/client/src/components/UnsavedForm.vue b/client/src/components/UnsavedForm.vue new file mode 100644 index 0000000..11d4381 --- /dev/null +++ b/client/src/components/UnsavedForm.vue @@ -0,0 +1,94 @@ + + + diff --git a/client/src/views/Day.vue b/client/src/views/Day.vue index 1a37939..84b2781 100644 --- a/client/src/views/Day.vue +++ b/client/src/views/Day.vue @@ -25,6 +25,7 @@ import {INote} from '../interfaces'; import Editor from '@/components/Editor.vue'; import Header from '@/components/Header.vue'; +import UnsavedForm from '@/components/UnsavedForm.vue'; import {IHeaderOptions} from '../interfaces'; @@ -254,14 +255,23 @@ export default class Day extends Vue { } async unsavedDialog(next: Function) { - this.$buefy.dialog.confirm({ - title: "Unsaved Content", - message: "Are you sure you want to discard the unsaved content?", - confirmText: "Discard", - type: "is-warning", - hasIcon: true, - onConfirm: () => next(), - onCancel: () => next(false) + this.$buefy.modal.open({ + parent: this, + component: UnsavedForm, + hasModalCard: true, + trapFocus: true, + events: { + cancel: () => { + next(false); + }, + discard: () => { + next(); + }, + save: () => { + this.saveDay(); + next(); + } + } }); } } diff --git a/client/src/views/NewNote.vue b/client/src/views/NewNote.vue index 5a9302d..626432c 100644 --- a/client/src/views/NewNote.vue +++ b/client/src/views/NewNote.vue @@ -18,6 +18,7 @@ import {INote} from '../interfaces'; import Editor from '@/components/Editor.vue'; import Header from '@/components/Header.vue'; +import UnsavedForm from '@/components/UnsavedForm.vue'; import {IHeaderOptions} from '../interfaces'; @@ -90,14 +91,23 @@ export default class NewNote extends Vue { beforeRouteLeave(to: Route, from: Route, next: Function) { if (this.unsavedChanges) { - this.$buefy.dialog.confirm({ - title: "Unsaved Content", - message: "Are you sure you want to discard the unsaved content?", - confirmText: "Discard", - type: "is-warning", - hasIcon: true, - onConfirm: () => next(), - onCancel: () => next(false) + this.$buefy.modal.open({ + parent: this, + component: UnsavedForm, + hasModalCard: true, + trapFocus: true, + events: { + cancel: () => { + next(false); + }, + discard: () => { + next(); + }, + save: () => { + this.saveNote(); + next(); + } + } }); } else { next(); From 20d9426973dca70c7b0d3e729058eb9506321102 Mon Sep 17 00:00:00 2001 From: Dustin Davis Date: Fri, 10 Dec 2021 13:14:43 -0700 Subject: [PATCH 3/4] Fix typescript error --- client/src/components/UnsavedForm.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/UnsavedForm.vue b/client/src/components/UnsavedForm.vue index 11d4381..ce17285 100644 --- a/client/src/components/UnsavedForm.vue +++ b/client/src/components/UnsavedForm.vue @@ -70,7 +70,7 @@ export default class UnsavedForm extends Vue { } } - keyPress({ key }) { + keyPress({ key }: any) { if (key == "Enter") { this.save(); } From 67dae26b98aa34bd2a837e0073589f56d5ec44ad Mon Sep 17 00:00:00 2001 From: Dustin Davis Date: Fri, 28 Jan 2022 17:09:28 -0700 Subject: [PATCH 4/4] Fix auto-save glitch --- client/src/views/Day.vue | 4 +++- client/src/views/Note.vue | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/client/src/views/Day.vue b/client/src/views/Day.vue index 1a37939..49c84d3 100644 --- a/client/src/views/Day.vue +++ b/client/src/views/Day.vue @@ -159,7 +159,9 @@ export default class Day extends Vue { const updatedDay = Object.assign(this.day, {data: this.modifiedText}); try { const res = await NoteService.saveDay(updatedDay); - this.text = this.modifiedText; + if (!this.sidebar.autoSave) { + this.text = this.modifiedText; + } this.day.uuid = res.uuid; // Update the indicators diff --git a/client/src/views/Note.vue b/client/src/views/Note.vue index 13c03d0..8e075bd 100644 --- a/client/src/views/Note.vue +++ b/client/src/views/Note.vue @@ -126,7 +126,9 @@ export default class Note extends Vue { const updatedNote = Object.assign(this.note, {data: this.modifiedText}); try { this.note = await NoteService.saveNote(updatedNote); - this.text = this.modifiedText; + if (!this.sidebar.autoSave) { + this.text = this.modifiedText; + } this.headerOptions.title = this.note.title || ''; // Update the indicators