diff --git a/src/components/AlertMessage.vue b/src/components/AlertMessage.vue new file mode 100644 index 00000000..6f3ea5b1 --- /dev/null +++ b/src/components/AlertMessage.vue @@ -0,0 +1,47 @@ + + + + + + diff --git a/src/components/World/components/objects/landmarks.js b/src/components/World/components/objects/landmarks.js index 3c6dbfaf..a4603376 100644 --- a/src/components/World/components/objects/landmarks.js +++ b/src/components/World/components/objects/landmarks.js @@ -23,6 +23,9 @@ export async function loadLandmarks(vue, world, scene, loop) { const accounts = await accountsDB.accounts.toArray(); const account = R.find((acc) => acc.did === activeDid, accounts); const identity = JSON.parse(account?.identity || "undefined"); + if (!identity) { + throw new Error("No identity found."); + } const token = await accessToken(identity); const url = apiServer + "/api/v2/report/claims?claimType=GiveAction"; diff --git a/src/views/AccountViewView.vue b/src/views/AccountViewView.vue index 17e6e2de..ed2c7df0 100644 --- a/src/views/AccountViewView.vue +++ b/src/views/AccountViewView.vue @@ -307,25 +307,16 @@ - - -
- -

{{ alertTitle }}

-

{{ alertMessage }}

-
+ diff --git a/src/views/ContactAmountsView.vue b/src/views/ContactAmountsView.vue index b05099f0..3912731c 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 0cdf6c5e..871dd254 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 c2a4143f..0425b802 100644 --- a/src/views/ContactsView.vue +++ b/src/views/ContactsView.vue @@ -230,19 +230,11 @@ + - - -
- -

{{ alertTitle }}

-

{{ alertMessage }}

-
diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index 3056d921..4f3ba8e2 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -106,18 +106,10 @@ - - -
- -

{{ alertTitle }}

-

{{ alertMessage }}

-
+ diff --git a/src/views/NewEditProjectView.vue b/src/views/NewEditProjectView.vue index cee4e502..06698ce2 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 dc9c5a90..89c54fc7 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/ProjectsView.vue b/src/views/ProjectsView.vue index a0dbe958..99596414 100644 --- a/src/views/ProjectsView.vue +++ b/src/views/ProjectsView.vue @@ -107,18 +107,22 @@ + diff --git a/src/views/StatisticsView.vue b/src/views/StatisticsView.vue index 2913b209..36684b80 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 = {}; @@ -197,36 +187,6 @@ export default class StatisticsView extends Vue { alertTitle = ""; alertMessage = ""; - isAlertVisible = false; - - public setAlert(title, message) { - this.alertTitle = title; - this.alertMessage = message; - this.isAlertVisible = true; - } - - 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, - }; - } } function ExportToSVG(rendererSVG, filename) {