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 @@ + + + + {{ this.task.name }} + + + + + + + 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 @@ + + + + + + + + + + No tasks found + + + + + + + diff --git a/client/src/components/UnsavedForm.vue b/client/src/components/UnsavedForm.vue new file mode 100644 index 0000000..ce17285 --- /dev/null +++ b/client/src/components/UnsavedForm.vue @@ -0,0 +1,94 @@ + + + + + + + Unsaved Content + + + + + + + + + + + + You have unsaved changes changes. What would you like to do? + + + + + + + + + + + + + + diff --git a/client/src/views/Day.vue b/client/src/views/Day.vue index 1a37939..e987c94 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'; @@ -159,7 +160,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 @@ -254,14 +257,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(); 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
Unsaved Content
+ + + You have unsaved changes changes. What would you like to do? + + +