From 94b5389ce911b78b7bac5e16b4b7b4f643d1ec63 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Wed, 24 Apr 2024 20:11:38 -0600 Subject: [PATCH] change remainder of "confirm" calls to better UX --- src/views/AccountViewView.vue | 34 ++++++---- src/views/ClaimView.vue | 97 +++++++++++++++------------ src/views/ContactsView.vue | 22 +++---- src/views/NewEditProjectView.vue | 27 ++++++-- src/views/ProjectViewView.vue | 108 +++++++++++++++++-------------- 5 files changed, 169 insertions(+), 119 deletions(-) diff --git a/src/views/AccountViewView.vue b/src/views/AccountViewView.vue index 3f6c83d1b..f6c3d9a20 100644 --- a/src/views/AccountViewView.vue +++ b/src/views/AccountViewView.vue @@ -562,7 +562,7 @@
@@ -451,12 +451,25 @@ export default class NewEditProjectView extends Vue { } } - public maybeEraseLatLong() { - if (window.confirm("Are you sure you don't want to mark a location?")) { - this.latitude = 0; - this.longitude = 0; - this.includeLocation = false; - } + confirmEraseLatLong() { + this.$notify( + { + group: "modal", + type: "confirm", + title: "Erase Marker", + text: "Are you sure you don't want to mark a location? This will erase the current location.", + onYes: async () => { + this.eraseLatLong(); + }, + }, + -1, + ); + } + + public eraseLatLong() { + this.latitude = 0; + this.longitude = 0; + this.includeLocation = false; } public onCancelClick() { diff --git a/src/views/ProjectViewView.vue b/src/views/ProjectViewView.vue index 6734da746..064fff925 100644 --- a/src/views/ProjectViewView.vue +++ b/src/views/ProjectViewView.vue @@ -69,8 +69,9 @@
- {{ domainForWebsite(this.url) }} + + {{ domainForWebsite(this.url) }} +
@@ -289,7 +290,7 @@ - + @@ -787,55 +788,68 @@ export default class ProjectViewView extends Vue { return libsUtil.isGiveRecordTheUserCanConfirm(giveDetails, this.activeDid); } + confirmConfirmClaim(give: GiveSummaryRecord) { + this.$notify( + { + group: "modal", + type: "confirm", + title: "Confirm", + text: "Do you personally confirm that this is true?", + onYes: async () => { + await this.confirmClaim(give); + }, + }, + -1, + ); + } + // similar code is found in ClaimView async confirmClaim(give: GiveSummaryRecord) { - if (confirm("Do you personally confirm that this is true?")) { - // similar logic is found in endorser-mobile - const goodClaim = serverUtil.removeSchemaContext( - serverUtil.removeVisibleToDids( - serverUtil.addLastClaimOrHandleAsIdIfMissing( - give.fullClaim, - give.jwtId, - give.handleId, - ), + // similar logic is found in endorser-mobile + const goodClaim = serverUtil.removeSchemaContext( + serverUtil.removeVisibleToDids( + serverUtil.addLastClaimOrHandleAsIdIfMissing( + give.fullClaim, + give.jwtId, + give.handleId, ), + ), + ); + const confirmationClaim: serverUtil.GenericVerifiableCredential = { + "@context": "https://schema.org", + "@type": "AgreeAction", + object: goodClaim, + }; + const result = await serverUtil.createAndSubmitClaim( + confirmationClaim, + await this.getIdentity(this.activeDid), + this.apiServer, + this.axios, + ); + if (result.type === "success") { + this.$notify( + { + group: "alert", + type: "success", + title: "Success", + text: "Confirmation submitted.", + }, + 5000, ); - const confirmationClaim: serverUtil.GenericVerifiableCredential = { - "@context": "https://schema.org", - "@type": "AgreeAction", - object: goodClaim, - }; - const result = await serverUtil.createAndSubmitClaim( - confirmationClaim, - await this.getIdentity(this.activeDid), - this.apiServer, - this.axios, + } else { + console.error("Got error submitting the confirmation:", result); + const message = + (result.error?.error as string) || + "There was a problem submitting the confirmation. See logs for more info."; + this.$notify( + { + group: "alert", + type: "danger", + title: "Error", + text: message, + }, + -1, ); - if (result.type === "success") { - this.$notify( - { - group: "alert", - type: "success", - title: "Success", - text: "Confirmation submitted.", - }, - 5000, - ); - } else { - console.error("Got error submitting the confirmation:", result); - const message = - (result.error?.error as string) || - "There was a problem submitting the confirmation. See logs for more info."; - this.$notify( - { - group: "alert", - type: "danger", - title: "Error", - text: message, - }, - -1, - ); - } } } }