From 0af03227a652f36953a87de7d32bbe07939f4d33 Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Mon, 3 Jul 2023 21:04:53 +0800 Subject: [PATCH] Propagated AlertMessage component --- src/views/AccountViewView.vue | 41 +++---------------- src/views/ContactAmountsView.vue | 43 ++++---------------- src/views/ContactQRScanShowView.vue | 37 ++++------------- src/views/ContactsView.vue | 62 ++++------------------------- src/views/DiscoverView.vue | 45 +++++---------------- src/views/NewEditProjectView.vue | 46 ++++----------------- src/views/ProjectViewView.vue | 43 ++++---------------- src/views/SeedBackupView.vue | 41 +++---------------- src/views/StatisticsView.vue | 39 +++--------------- 9 files changed, 65 insertions(+), 332 deletions(-) diff --git a/src/views/AccountViewView.vue b/src/views/AccountViewView.vue index d268dde75..69569e281 100644 --- a/src/views/AccountViewView.vue +++ b/src/views/AccountViewView.vue @@ -307,18 +307,10 @@ - - -
- -

{{ alertTitle }}

-

{{ alertMessage }}

-
+ @@ -334,6 +326,7 @@ import { db, accountsDB } from "@/db"; import { MASTER_SETTINGS_KEY } from "@/db/tables/settings"; import { accessToken } from "@/libs/crypto"; import { AxiosError } from "axios/index"; +import AlertMessage from "@/components/AlertMessage"; // eslint-disable-next-line @typescript-eslint/no-var-requires const Buffer = require("buffer/").Buffer; @@ -347,7 +340,7 @@ interface RateLimits { nextWeekBeginDateTime: string; } -@Component +@Component({ components: { AlertMessage } }) export default class AccountViewView extends Vue { Constants = AppString; @@ -546,27 +539,5 @@ export default class AccountViewView extends Vue { // This same popup code is in many files. alertMessage = ""; alertTitle = ""; - isAlertVisible = false; - public onClickClose() { - this.isAlertVisible = false; - this.alertTitle = ""; - this.alertMessage = ""; - } - public computedAlertClassNames() { - return { - hidden: !this.isAlertVisible, - "dismissable-alert": true, - "bg-slate-100": true, - "p-5": true, - rounded: true, - "drop-shadow-lg": true, - fixed: true, - "top-3": true, - "inset-x-3": true, - "transition-transform": true, - "ease-in": true, - "duration-300": true, - }; - } } diff --git a/src/views/ContactAmountsView.vue b/src/views/ContactAmountsView.vue index 1b1b46fb1..d086b35bf 100644 --- a/src/views/ContactAmountsView.vue +++ b/src/views/ContactAmountsView.vue @@ -109,25 +109,17 @@ - - -
- -

{{ alertTitle }}

-

{{ alertMessage }}

-
+ diff --git a/src/views/ContactQRScanShowView.vue b/src/views/ContactQRScanShowView.vue index 0cdf6c5e6..871dd254f 100644 --- a/src/views/ContactQRScanShowView.vue +++ b/src/views/ContactQRScanShowView.vue @@ -64,17 +64,10 @@ :dotsOptions="{ type: 'square' }" class="flex justify-center" /> - - -
- -

{{ alertMessage }}

-
+ @@ -86,6 +79,7 @@ import { MASTER_SETTINGS_KEY } from "@/db/tables/settings"; import * as R from "ramda"; import { SimpleSigner } from "@/libs/crypto"; import * as didJwt from "did-jwt"; +import AlertMessage from "@/components/AlertMessage"; // eslint-disable-next-line @typescript-eslint/no-var-requires const Buffer = require("buffer/").Buffer; @@ -93,6 +87,7 @@ const Buffer = require("buffer/").Buffer; @Component({ components: { QRCodeVue3, + AlertMessage, }, }) export default class ContactQRScanShow extends Vue { @@ -144,25 +139,7 @@ export default class ContactQRScanShow extends Vue { } // This same popup code is in many files. + alertTitle = ""; alertMessage = ""; - public onClickClose() { - this.alertMessage = ""; - } - public computedAlertClassNames() { - return { - hidden: !this.alertMessage, - "dismissable-alert": true, - "bg-slate-100": true, - "p-5": true, - rounded: true, - "drop-shadow-lg": true, - fixed: true, - "top-3": true, - "inset-x-3": true, - "transition-transform": true, - "ease-in": true, - "duration-300": true, - }; - } } diff --git a/src/views/ContactsView.vue b/src/views/ContactsView.vue index c2a4143f9..0425b8023 100644 --- a/src/views/ContactsView.vue +++ b/src/views/ContactsView.vue @@ -230,19 +230,11 @@ + - - -
- -

{{ alertTitle }}

-

{{ alertMessage }}

-
diff --git a/src/views/NewEditProjectView.vue b/src/views/NewEditProjectView.vue index cee4e502d..06698ce2f 100644 --- a/src/views/NewEditProjectView.vue +++ b/src/views/NewEditProjectView.vue @@ -63,32 +63,25 @@ Cancel + - - -
- -

{{ alertTitle }}

-

{{ alertMessage }}

-
diff --git a/src/views/ProjectViewView.vue b/src/views/ProjectViewView.vue index dc9c5a90b..89c54fc7d 100644 --- a/src/views/ProjectViewView.vue +++ b/src/views/ProjectViewView.vue @@ -179,18 +179,10 @@ --> - - -
- -

{{ alertTitle }}

-

{{ alertMessage }}

-
+ @@ -198,7 +190,7 @@ import { AxiosError } from "axios"; import * as moment from "moment"; import * as R from "ramda"; -import { Options, Vue } from "vue-class-component"; +import { Component, Vue } from "vue-facing-decorator"; import GiftedDialog from "@/components/GiftedDialog.vue"; import { accountsDB, db } from "@/db"; @@ -207,9 +199,10 @@ import { MASTER_SETTINGS_KEY } from "@/db/tables/settings"; import { createAndSubmitGive } from "@/libs/endorserServer"; import { accessToken } from "@/libs/crypto"; import { IIdentifier } from "@veramo/core"; +import AlertMessage from "@/components/AlertMessage"; -@Options({ - components: { GiftedDialog }, +@Component({ + components: { GiftedDialog, AlertMessage }, }) export default class ProjectViewView extends Vue { activeDid = ""; @@ -379,25 +372,5 @@ export default class ProjectViewView extends Vue { // This same popup code is in many files. alertMessage = ""; alertTitle = ""; - public onClickClose() { - this.alertTitle = ""; - this.alertMessage = ""; - } - public computedAlertClassNames() { - return { - hidden: !this.alertMessage, - "dismissable-alert": true, - "bg-slate-100": true, - "p-5": true, - rounded: true, - "drop-shadow-lg": true, - fixed: true, - "top-3": true, - "inset-x-3": true, - "transition-transform": true, - "ease-in": true, - "duration-300": true, - }; - } } diff --git a/src/views/SeedBackupView.vue b/src/views/SeedBackupView.vue index 9ad683dcb..7aa06552c 100644 --- a/src/views/SeedBackupView.vue +++ b/src/views/SeedBackupView.vue @@ -85,18 +85,10 @@

{{ activeAccount.mnemonic }}

You do not have an active identity.
- - -
- -

{{ alertTitle }}

-

{{ alertMessage }}

-
+ @@ -105,8 +97,9 @@ import { Component, Vue } from "vue-facing-decorator"; import { accountsDB, db } from "@/db"; import * as R from "ramda"; import { MASTER_SETTINGS_KEY } from "@/db/tables/settings"; +import AlertMessage from "@/components/AlertMessage"; -@Component +@Component({ components: [AlertMessage] }) export default class SeedBackupView extends Vue { activeAccount = null; showSeed = false; @@ -136,27 +129,5 @@ export default class SeedBackupView extends Vue { // This same popup code is in many files. alertMessage = ""; alertTitle = ""; - isAlertVisible = false; - public onClickClose() { - this.isAlertVisible = false; - this.alertTitle = ""; - this.alertMessage = ""; - } - public computedAlertClassNames() { - return { - hidden: !this.isAlertVisible, - "dismissable-alert": true, - "bg-slate-100": true, - "p-5": true, - rounded: true, - "drop-shadow-lg": true, - fixed: true, - "top-3": true, - "inset-x-3": true, - "transition-transform": true, - "ease-in": true, - "duration-300": true, - }; - } } diff --git a/src/views/StatisticsView.vue b/src/views/StatisticsView.vue index 2913b2090..af9797baf 100644 --- a/src/views/StatisticsView.vue +++ b/src/views/StatisticsView.vue @@ -79,22 +79,11 @@ {{ worldProperties.animationDurationSeconds }} seconds - - - -
- -
- -

{{ alertTitle }}

-

{{ alertMessage }}

-
+ @@ -102,13 +91,14 @@ import { SVGRenderer } from "three/addons/renderers/SVGRenderer.js"; import { Component, Vue } from "vue-facing-decorator"; import { World } from "@/components/World/World.js"; +import AlertMessage from "@/components/AlertMessage"; interface WorldProperties { startTime?: string; endTime?: string; } -@Component +@Component({ components: { AlertMessage } }) export default class StatisticsView extends Vue { world: World; worldProperties: WorldProperties = {}; @@ -210,23 +200,6 @@ export default class StatisticsView extends Vue { this.alertTitle = ""; this.alertMessage = ""; } - - public computedAlertClassNames() { - return { - hidden: !this.isAlertVisible, - "dismissable-alert": true, - "bg-slate-100": true, - "p-5": true, - rounded: true, - "drop-shadow-lg": true, - fixed: true, - "top-3": true, - "inset-x-3": true, - "transition-transform": true, - "ease-in": true, - "duration-300": true, - }; - } } function ExportToSVG(rendererSVG, filename) {