From 7a2ef04ec31c3ff02de3d45c94afeb3da34c670b Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 14 Nov 2018 20:36:15 +0900 Subject: [PATCH] [Client] Improve UI --- .../app/common/views/components/note-menu.vue | 17 ++++++++++----- .../desktop/views/pages/user/user.profile.vue | 21 ++++++++++++------- .../app/mobile/views/pages/notifications.vue | 11 +++++++--- 3 files changed, 34 insertions(+), 15 deletions(-) diff --git a/src/client/app/common/views/components/note-menu.vue b/src/client/app/common/views/components/note-menu.vue index d45c9c8835..72063c8758 100644 --- a/src/client/app/common/views/components/note-menu.vue +++ b/src/client/app/common/views/components/note-menu.vue @@ -93,11 +93,18 @@ export default Vue.extend({ }, del() { - if (!window.confirm(this.$t('delete-confirm'))) return; - this.$root.api('notes/delete', { - noteId: this.note.id - }).then(() => { - this.destroyDom(); + this.$root.alert({ + type: 'warning', + text: this.$t('delete-confirm'), + showCancelButton: true + }).then(res => { + if (!res) return; + + this.$root.api('notes/delete', { + noteId: this.note.id + }).then(() => { + this.destroyDom(); + }); }); }, diff --git a/src/client/app/desktop/views/pages/user/user.profile.vue b/src/client/app/desktop/views/pages/user/user.profile.vue index eb430d1337..fcd4aebdac 100644 --- a/src/client/app/desktop/views/pages/user/user.profile.vue +++ b/src/client/app/desktop/views/pages/user/user.profile.vue @@ -73,13 +73,20 @@ export default Vue.extend({ }, block() { - if (!window.confirm(this.$t('block-confirm'))) return; - this.$root.api('blocking/create', { - userId: this.user.id - }).then(() => { - this.user.isBlocking = true; - }, () => { - alert('error'); + this.$root.alert({ + type: 'warning', + text: this.$t('block-confirm'), + showCancelButton: true + }).then(res => { + if (!res) return; + + this.$root.api('blocking/create', { + userId: this.user.id + }).then(() => { + this.user.isBlocking = true; + }, () => { + alert('error'); + }); }); }, diff --git a/src/client/app/mobile/views/pages/notifications.vue b/src/client/app/mobile/views/pages/notifications.vue index 97fe995535..b64e86d688 100644 --- a/src/client/app/mobile/views/pages/notifications.vue +++ b/src/client/app/mobile/views/pages/notifications.vue @@ -23,10 +23,15 @@ export default Vue.extend({ }, methods: { fn() { - const ok = window.confirm(this.$t('read-all')); - if (!ok) return; + this.$root.alert({ + type: 'warning', + text: this.$t('read-all'), + showCancelButton: true + }).then(res => { + if (!res) return; - this.$root.api('notifications/mark_all_as_read'); + this.$root.api('notifications/mark_all_as_read'); + }); }, onFetched() { Progress.done();