From 81a6d821c08174a667c0be8494ba86a5d16606ac Mon Sep 17 00:00:00 2001 From: Liyas Thomas Date: Mon, 14 Dec 2020 10:35:14 +0530 Subject: [PATCH] feat: confirm modal + chore(deps): bump --- components/collections/collection.vue | 10 ++- components/collections/folder.vue | 10 ++- components/collections/request.vue | 106 +++++++++++++----------- components/environments/environment.vue | 64 ++++++++------ components/ui/confirm-modal.vue | 71 ++++++++++++++++ components/ui/modal.vue | 1 + lang/en-US.json | 3 +- package-lock.json | 50 +++++------ package.json | 2 +- 9 files changed, 211 insertions(+), 106 deletions(-) create mode 100644 components/ui/confirm-modal.vue diff --git a/components/collections/collection.vue b/components/collections/collection.vue index 7ec938cf3..c76353a32 100644 --- a/components/collections/collection.vue +++ b/components/collections/collection.vue @@ -46,7 +46,7 @@
- @@ -103,6 +103,12 @@
+ @@ -121,6 +127,7 @@ export default { showChildren: false, dragging: false, selectedFolder: {}, + confirmRemove: false, } }, methods: { @@ -135,7 +142,6 @@ export default { this.showChildren = !this.showChildren }, removeCollection() { - if (!confirm(this.$t("are_you_sure_remove_collection"))) return this.$store.commit("postwoman/removeCollection", { collectionIndex: this.collectionIndex, }) diff --git a/components/collections/folder.vue b/components/collections/folder.vue index defe324df..4b8ba28e2 100644 --- a/components/collections/folder.vue +++ b/components/collections/folder.vue @@ -43,7 +43,7 @@
- @@ -93,6 +93,12 @@
+ @@ -113,6 +119,7 @@ export default { return { showChildren: false, dragging: false, + confirmRemove: false, } }, methods: { @@ -127,7 +134,6 @@ export default { this.showChildren = !this.showChildren }, removeFolder() { - if (!confirm(this.$t("are_you_sure_remove_folder"))) return this.$store.commit("postwoman/removeFolder", { collectionIndex: this.$props.collectionIndex, folderName: this.$props.folder.name, diff --git a/components/collections/request.vue b/components/collections/request.vue index 5c79fe67e..a05d37c98 100644 --- a/components/collections/request.vue +++ b/components/collections/request.vue @@ -1,53 +1,61 @@ @@ -73,6 +81,7 @@ export default { delete: "text-red-400", default: "text-gray-400", }, + confirmRemove: false, } }, methods: { @@ -94,7 +103,6 @@ export default { dataTransfer.setData("requestIndex", this.$props.requestIndex) }, removeRequest() { - if (!confirm(this.$t("are_you_sure_remove_request"))) return this.$store.commit("postwoman/removeRequest", { collectionIndex: this.$props.collectionIndex, folderName: this.$props.folderName, diff --git a/components/environments/environment.vue b/components/environments/environment.vue index 685338031..08b3fa8ba 100644 --- a/components/environments/environment.vue +++ b/components/environments/environment.vue @@ -1,30 +1,38 @@ @@ -36,6 +44,11 @@ export default { environment: Object, environmentIndex: Number, }, + data() { + return { + confirmRemove: false, + } + }, methods: { syncEnvironments() { if (fb.currentUser !== null) { @@ -45,7 +58,6 @@ export default { } }, removeEnvironment() { - if (!confirm(this.$t("are_you_sure_remove_environment"))) return this.$store.commit("postwoman/removeEnvironment", this.environmentIndex) this.$toast.error(this.$t("deleted"), { icon: "delete", diff --git a/components/ui/confirm-modal.vue b/components/ui/confirm-modal.vue new file mode 100644 index 000000000..f8c732784 --- /dev/null +++ b/components/ui/confirm-modal.vue @@ -0,0 +1,71 @@ + + + diff --git a/components/ui/modal.vue b/components/ui/modal.vue index 48c14f392..451c5abb3 100644 --- a/components/ui/modal.vue +++ b/components/ui/modal.vue @@ -19,6 +19,7 @@ +