Browse Source

Propagated AlertMessage component

kb/add-usage-guide
Matthew Raymer 1 year ago
parent
commit
0af03227a6
  1. 41
      src/views/AccountViewView.vue
  2. 43
      src/views/ContactAmountsView.vue
  3. 37
      src/views/ContactQRScanShowView.vue
  4. 62
      src/views/ContactsView.vue
  5. 45
      src/views/DiscoverView.vue
  6. 46
      src/views/NewEditProjectView.vue
  7. 43
      src/views/ProjectViewView.vue
  8. 41
      src/views/SeedBackupView.vue
  9. 39
      src/views/StatisticsView.vue

41
src/views/AccountViewView.vue

@ -307,18 +307,10 @@
</router-link> </router-link>
</button> </button>
</div> </div>
<AlertMessage
<!-- This same popup code is in many files. --> :alertTitle="alertTitle"
<div v-bind:class="computedAlertClassNames()"> :alertMessage="alertMessage"
<button ></AlertMessage>
class="close-button bg-slate-200 w-8 leading-loose rounded-full absolute top-2 right-2"
@click="onClickClose()"
>
<fa icon="xmark"></fa>
</button>
<h4 class="font-bold pr-5">{{ alertTitle }}</h4>
<p>{{ alertMessage }}</p>
</div>
</section> </section>
</template> </template>
@ -334,6 +326,7 @@ import { db, accountsDB } from "@/db";
import { MASTER_SETTINGS_KEY } from "@/db/tables/settings"; import { MASTER_SETTINGS_KEY } from "@/db/tables/settings";
import { accessToken } from "@/libs/crypto"; import { accessToken } from "@/libs/crypto";
import { AxiosError } from "axios/index"; import { AxiosError } from "axios/index";
import AlertMessage from "@/components/AlertMessage";
// eslint-disable-next-line @typescript-eslint/no-var-requires // eslint-disable-next-line @typescript-eslint/no-var-requires
const Buffer = require("buffer/").Buffer; const Buffer = require("buffer/").Buffer;
@ -347,7 +340,7 @@ interface RateLimits {
nextWeekBeginDateTime: string; nextWeekBeginDateTime: string;
} }
@Component @Component({ components: { AlertMessage } })
export default class AccountViewView extends Vue { export default class AccountViewView extends Vue {
Constants = AppString; Constants = AppString;
@ -546,27 +539,5 @@ export default class AccountViewView extends Vue {
// This same popup code is in many files. // This same popup code is in many files.
alertMessage = ""; alertMessage = "";
alertTitle = ""; 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,
};
}
} }
</script> </script>

43
src/views/ContactAmountsView.vue

@ -109,25 +109,17 @@
</div> </div>
</div> </div>
</div> </div>
<AlertMessage
<!-- This same popup code is in many files. --> :alertTitle="alertTitle"
<div v-bind:class="computedAlertClassNames()"> :alertMessage="alertMessage"
<button ></AlertMessage>
class="close-button bg-slate-200 w-8 leading-loose rounded-full absolute top-2 right-2"
@click="onClickClose()"
>
<fa icon="xmark"></fa>
</button>
<h4 class="font-bold pr-5">{{ alertTitle }}</h4>
<p>{{ alertMessage }}</p>
</div>
</section> </section>
</template> </template>
<script lang="ts"> <script lang="ts">
import * as R from "ramda"; import * as R from "ramda";
import { Options, Vue } from "vue-class-component";
import { Component, Vue } from "vue-facing-decorator";
import { accountsDB, db } from "@/db"; import { accountsDB, db } from "@/db";
import { Contact } from "@/db/tables/contacts"; import { Contact } from "@/db/tables/contacts";
import { MASTER_SETTINGS_KEY } from "@/db/tables/settings"; import { MASTER_SETTINGS_KEY } from "@/db/tables/settings";
@ -140,8 +132,9 @@ import {
} from "@/libs/endorserServer"; } from "@/libs/endorserServer";
import * as didJwt from "did-jwt"; import * as didJwt from "did-jwt";
import { AxiosError } from "axios"; import { AxiosError } from "axios";
import AlertMessage from "@/components/AlertMessage";
@Options({}) @Component({ components: { AlertMessage } })
export default class ContactsView extends Vue { export default class ContactsView extends Vue {
activeDid = ""; activeDid = "";
apiServer = ""; apiServer = "";
@ -337,28 +330,6 @@ export default class ContactsView extends Vue {
// This same popup code is in many files. // This same popup code is in many files.
alertTitle = ""; alertTitle = "";
alertMessage = ""; alertMessage = "";
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,
};
}
} }
</script> </script>

37
src/views/ContactQRScanShowView.vue

@ -64,17 +64,10 @@
:dotsOptions="{ type: 'square' }" :dotsOptions="{ type: 'square' }"
class="flex justify-center" class="flex justify-center"
/> />
<AlertMessage
<!-- This same popup code is in many files. --> :alertTitle="alertTitle"
<div v-bind:class="computedAlertClassNames()"> :alertMessage="alertMessage"
<button ></AlertMessage>
class="close-button bg-slate-200 w-8 leading-loose rounded-full absolute top-2 right-2"
@click="onClickClose()"
>
<fa icon="xmark"></fa>
</button>
<p>{{ alertMessage }}</p>
</div>
</section> </section>
</template> </template>
@ -86,6 +79,7 @@ import { MASTER_SETTINGS_KEY } from "@/db/tables/settings";
import * as R from "ramda"; import * as R from "ramda";
import { SimpleSigner } from "@/libs/crypto"; import { SimpleSigner } from "@/libs/crypto";
import * as didJwt from "did-jwt"; import * as didJwt from "did-jwt";
import AlertMessage from "@/components/AlertMessage";
// eslint-disable-next-line @typescript-eslint/no-var-requires // eslint-disable-next-line @typescript-eslint/no-var-requires
const Buffer = require("buffer/").Buffer; const Buffer = require("buffer/").Buffer;
@ -93,6 +87,7 @@ const Buffer = require("buffer/").Buffer;
@Component({ @Component({
components: { components: {
QRCodeVue3, QRCodeVue3,
AlertMessage,
}, },
}) })
export default class ContactQRScanShow extends Vue { export default class ContactQRScanShow extends Vue {
@ -144,25 +139,7 @@ export default class ContactQRScanShow extends Vue {
} }
// This same popup code is in many files. // This same popup code is in many files.
alertTitle = "";
alertMessage = ""; 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,
};
}
} }
</script> </script>

62
src/views/ContactsView.vue

@ -230,19 +230,11 @@
</div> </div>
</li> </li>
</ul> </ul>
<AlertMessage
:alertTitle="alertTitle"
:alertMessage="alertMessage"
></AlertMessage>
</section> </section>
<!-- This same popup code is in many files. -->
<div v-bind:class="computedAlertClassNames()">
<button
class="close-button bg-slate-200 w-8 leading-loose rounded-full absolute top-2 right-2"
@click="onClickClose()"
>
<fa icon="xmark"></fa>
</button>
<h4 class="font-bold pr-5">{{ alertTitle }}</h4>
<p>{{ alertMessage }}</p>
</div>
</template> </template>
<script lang="ts"> <script lang="ts">
@ -250,8 +242,8 @@ import { AxiosError } from "axios";
import * as didJwt from "did-jwt"; import * as didJwt from "did-jwt";
import * as R from "ramda"; import * as R from "ramda";
import { IIdentifier } from "@veramo/core"; import { IIdentifier } from "@veramo/core";
import { Options, Vue } from "vue-class-component";
import { Component, Vue } from "vue-facing-decorator";
import { accountsDB, db } from "@/db"; import { accountsDB, db } from "@/db";
import { Contact } from "@/db/tables/contacts"; import { Contact } from "@/db/tables/contacts";
import { MASTER_SETTINGS_KEY } from "@/db/tables/settings"; import { MASTER_SETTINGS_KEY } from "@/db/tables/settings";
@ -266,8 +258,8 @@ import {
// eslint-disable-next-line @typescript-eslint/no-var-requires // eslint-disable-next-line @typescript-eslint/no-var-requires
const Buffer = require("buffer/").Buffer; const Buffer = require("buffer/").Buffer;
@Options({ @Component({
components: {}, components: { AlertMessage },
}) })
export default class ContactsView extends Vue { export default class ContactsView extends Vue {
activeDid = ""; activeDid = "";
@ -370,12 +362,10 @@ export default class ContactsView extends Vue {
this.alertTitle = "Error With Server"; this.alertTitle = "Error With Server";
this.alertMessage = this.alertMessage =
"Got an error retrieving your given time from the server."; "Got an error retrieving your given time from the server.";
this.isAlertVisible = true;
} }
} catch (error) { } catch (error) {
this.alertTitle = "Error With Server"; this.alertTitle = "Error With Server";
this.alertMessage = error as string; this.alertMessage = error as string;
this.isAlertVisible = true;
} }
// load all the time I have received // load all the time I have received
@ -424,12 +414,10 @@ export default class ContactsView extends Vue {
this.alertTitle = "Error With Server"; this.alertTitle = "Error With Server";
this.alertMessage = this.alertMessage =
"Got an error retrieving your received time from the server."; "Got an error retrieving your received time from the server.";
this.isAlertVisible = true;
} }
} catch (error) { } catch (error) {
this.alertTitle = "Error With Server"; this.alertTitle = "Error With Server";
this.alertMessage = error as string; this.alertMessage = error as string;
this.isAlertVisible = true;
} }
} }
@ -540,14 +528,12 @@ export default class ContactsView extends Vue {
message += " " + resp.data.success.embeddedRecordError; message += " " + resp.data.success.embeddedRecordError;
} }
this.alertMessage = message; this.alertMessage = message;
this.isAlertVisible = true;
} else if (resp.data?.success?.handleId) { } else if (resp.data?.success?.handleId) {
contact.registered = true; contact.registered = true;
db.contacts.update(contact.did, { registered: true }); db.contacts.update(contact.did, { registered: true });
this.alertTitle = "Registration Success"; this.alertTitle = "Registration Success";
this.alertMessage = contact.name + " has been registered."; this.alertMessage = contact.name + " has been registered.";
this.isAlertVisible = true;
} }
} catch (error) { } catch (error) {
let userMessage = "There was an error. See logs for more info."; let userMessage = "There was an error. See logs for more info.";
@ -564,7 +550,6 @@ export default class ContactsView extends Vue {
// Now set that error for the user to see. // Now set that error for the user to see.
this.alertTitle = "Error With Server"; this.alertTitle = "Error With Server";
this.alertMessage = userMessage; this.alertMessage = userMessage;
this.isAlertVisible = true;
} }
} }
} }
@ -603,12 +588,10 @@ export default class ContactsView extends Vue {
} else { } else {
this.alertMessage = "Bad server response of " + resp.status; this.alertMessage = "Bad server response of " + resp.status;
} }
this.isAlertVisible = true;
} }
} catch (err) { } catch (err) {
this.alertTitle = "Error With Server"; this.alertTitle = "Error With Server";
this.alertMessage = err as string; this.alertMessage = err as string;
this.isAlertVisible = true;
} }
} }
@ -644,7 +627,6 @@ export default class ContactsView extends Vue {
" can " + " can " +
(visibility ? "" : "not ") + (visibility ? "" : "not ") +
"see your activity."; "see your activity.";
this.isAlertVisible = true;
} else { } else {
this.alertTitle = "Error With Server"; this.alertTitle = "Error With Server";
if (resp.data.error?.message) { if (resp.data.error?.message) {
@ -652,12 +634,10 @@ export default class ContactsView extends Vue {
} else { } else {
this.alertMessage = "Bad server response of " + resp.status; this.alertMessage = "Bad server response of " + resp.status;
} }
this.isAlertVisible = true;
} }
} catch (err) { } catch (err) {
this.alertTitle = "Error With Server"; this.alertTitle = "Error With Server";
this.alertMessage = err as string; this.alertMessage = err as string;
this.isAlertVisible = true;
} }
} }
@ -705,15 +685,12 @@ export default class ContactsView extends Vue {
this.alertTitle = "Input Error"; this.alertTitle = "Input Error";
this.alertMessage = this.alertMessage =
"This is not a valid number of hours: " + this.hourInput; "This is not a valid number of hours: " + this.hourInput;
this.isAlertVisible = true;
} else if (!parseFloat(this.hourInput)) { } else if (!parseFloat(this.hourInput)) {
this.alertTitle = "Input Error"; this.alertTitle = "Input Error";
this.alertMessage = "Giving 0 hours does nothing."; this.alertMessage = "Giving 0 hours does nothing.";
this.isAlertVisible = true;
} else if (!identity) { } else if (!identity) {
this.alertTitle = "Status Error"; this.alertTitle = "Status Error";
this.alertMessage = "No identity is available."; this.alertMessage = "No identity is available.";
this.isAlertVisible = true;
} else { } else {
// ask to confirm amount // ask to confirm amount
let toFrom; let toFrom;
@ -804,7 +781,7 @@ export default class ContactsView extends Vue {
if (resp.data?.success?.handleId) { if (resp.data?.success?.handleId) {
this.alertTitle = "Done"; this.alertTitle = "Done";
this.alertMessage = "Successfully logged time to the server."; this.alertMessage = "Successfully logged time to the server.";
this.isAlertVisible = true;
if (fromDid === identity.did) { if (fromDid === identity.did) {
const newList = R.clone(this.givenByMeUnconfirmed); const newList = R.clone(this.givenByMeUnconfirmed);
newList[toDid] = (newList[toDid] || 0) + amount; newList[toDid] = (newList[toDid] || 0) + amount;
@ -830,7 +807,6 @@ export default class ContactsView extends Vue {
// Now set that error for the user to see. // Now set that error for the user to see.
this.alertTitle = "Error With Server"; this.alertTitle = "Error With Server";
this.alertMessage = userMessage; this.alertMessage = userMessage;
this.isAlertVisible = true;
} }
} }
} }
@ -851,28 +827,6 @@ export default class ContactsView extends Vue {
// This same popup code is in many files. // This same popup code is in many files.
alertTitle = ""; alertTitle = "";
alertMessage = ""; alertMessage = "";
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,
};
}
public showGiveAmountsClassNames() { public showGiveAmountsClassNames() {
return { return {

45
src/views/DiscoverView.vue

@ -153,30 +153,24 @@
</a> </a>
</li> </li>
</ul> </ul>
<AlertMessage
<!-- This same popup code is in many files. --> :alertTitle="alertTitle"
<div v-bind:class="computedAlertClassNames()"> :alertMessage="alertMessage"
<button ></AlertMessage>
class="close-button bg-slate-200 w-8 leading-loose rounded-full absolute top-2 right-2"
@click="onClickClose()"
>
<fa icon="xmark"></fa>
</button>
<h4 class="font-bold pr-5">{{ alertTitle }}</h4>
<p>{{ alertMessage }}</p>
</div>
</section> </section>
</template> </template>
<script lang="ts"> <script lang="ts">
import { Options, Vue } from "vue-class-component"; import { Component, Vue } from "vue-facing-decorator";
import { accountsDB, db } from "@/db"; import { accountsDB, db } from "@/db";
import { MASTER_SETTINGS_KEY } from "@/db/tables/settings"; import { MASTER_SETTINGS_KEY } from "@/db/tables/settings";
import * as R from "ramda"; import * as R from "ramda";
import { accessToken } from "@/libs/crypto"; import { accessToken } from "@/libs/crypto";
import AlertMessage from "@/components/AlertMessage";
@Options({ @Component({
components: {}, components: { AlertMessage },
}) })
export default class DiscoverView extends Vue { export default class DiscoverView extends Vue {
activeDid = ""; activeDid = "";
@ -237,28 +231,7 @@ export default class DiscoverView extends Vue {
}); });
} }
// This same popup code is in many files.
alertMessage = ""; alertMessage = "";
alertTitle = ""; 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,
};
}
} }
</script> </script>

46
src/views/NewEditProjectView.vue

@ -63,32 +63,25 @@
Cancel Cancel
</button> </button>
</div> </div>
<AlertMessage
:alertTitle="alertTitle"
:alertMessage="alertMessage"
></AlertMessage>
</section> </section>
<!-- This same popup code is in many files. -->
<div v-bind:class="computedAlertClassNames()">
<button
class="close-button bg-slate-200 w-8 leading-loose rounded-full absolute top-2 right-2"
@click="onClickClose()"
>
<fa icon="xmark"></fa>
</button>
<h4 class="font-bold pr-5">{{ alertTitle }}</h4>
<p>{{ alertMessage }}</p>
</div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { AxiosError } from "axios"; import { AxiosError } from "axios";
import * as didJwt from "did-jwt"; import * as didJwt from "did-jwt";
import * as R from "ramda"; import * as R from "ramda";
import { Options, Vue } from "vue-class-component"; import { Component, Vue } from "vue-facing-decorator";
import { accountsDB, db } from "@/db"; import { accountsDB, db } from "@/db";
import { MASTER_SETTINGS_KEY } from "@/db/tables/settings"; import { MASTER_SETTINGS_KEY } from "@/db/tables/settings";
import { accessToken, SimpleSigner } from "@/libs/crypto"; import { accessToken, SimpleSigner } from "@/libs/crypto";
import { useAppStore } from "@/store/app"; import { useAppStore } from "@/store/app";
import { IIdentifier } from "@veramo/core"; import { IIdentifier } from "@veramo/core";
import AlertMessage from "@/components/AlertMessage";
interface VerifiableCredential { interface VerifiableCredential {
"@context": string; "@context": string;
@ -98,8 +91,8 @@ interface VerifiableCredential {
identifier?: string; identifier?: string;
} }
@Options({ @Component({
components: {}, components: { AlertMessage },
}) })
export default class NewEditProjectView extends Vue { export default class NewEditProjectView extends Vue {
activeDid = ""; activeDid = "";
@ -229,7 +222,6 @@ export default class NewEditProjectView extends Vue {
let userMessage = "There was an error saving the project."; let userMessage = "There was an error saving the project.";
const serverError = error as AxiosError; const serverError = error as AxiosError;
if (serverError) { if (serverError) {
this.isAlertVisible = true;
if (Object.prototype.hasOwnProperty.call(serverError, "message")) { if (Object.prototype.hasOwnProperty.call(serverError, "message")) {
console.log(serverError); console.log(serverError);
this.alertTitle = "User Message"; this.alertTitle = "User Message";
@ -278,27 +270,5 @@ export default class NewEditProjectView extends Vue {
// This same popup code is in many files. // This same popup code is in many files.
alertTitle = ""; alertTitle = "";
alertMessage = ""; alertMessage = "";
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,
};
}
} }
</script> </script>

43
src/views/ProjectViewView.vue

@ -179,18 +179,10 @@
</ul> </ul>
</div> </div>
--> -->
<AlertMessage
<!-- This same popup code is in many files. --> :alertTitle="alertTitle"
<div v-bind:class="computedAlertClassNames()"> :alertMessage="alertMessage"
<button ></AlertMessage>
class="close-button bg-slate-200 w-8 leading-loose rounded-full absolute top-2 right-2"
@click="onClickClose()"
>
<fa icon="xmark"></fa>
</button>
<h4 class="font-bold pr-5">{{ alertTitle }}</h4>
<p>{{ alertMessage }}</p>
</div>
</section> </section>
</template> </template>
@ -198,7 +190,7 @@
import { AxiosError } from "axios"; import { AxiosError } from "axios";
import * as moment from "moment"; import * as moment from "moment";
import * as R from "ramda"; 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 GiftedDialog from "@/components/GiftedDialog.vue";
import { accountsDB, db } from "@/db"; import { accountsDB, db } from "@/db";
@ -207,9 +199,10 @@ import { MASTER_SETTINGS_KEY } from "@/db/tables/settings";
import { createAndSubmitGive } from "@/libs/endorserServer"; import { createAndSubmitGive } from "@/libs/endorserServer";
import { accessToken } from "@/libs/crypto"; import { accessToken } from "@/libs/crypto";
import { IIdentifier } from "@veramo/core"; import { IIdentifier } from "@veramo/core";
import AlertMessage from "@/components/AlertMessage";
@Options({ @Component({
components: { GiftedDialog }, components: { GiftedDialog, AlertMessage },
}) })
export default class ProjectViewView extends Vue { export default class ProjectViewView extends Vue {
activeDid = ""; activeDid = "";
@ -379,25 +372,5 @@ export default class ProjectViewView extends Vue {
// This same popup code is in many files. // This same popup code is in many files.
alertMessage = ""; alertMessage = "";
alertTitle = ""; 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,
};
}
} }
</script> </script>

41
src/views/SeedBackupView.vue

@ -85,18 +85,10 @@
<p v-if="showSeed">{{ activeAccount.mnemonic }}</p> <p v-if="showSeed">{{ activeAccount.mnemonic }}</p>
</div> </div>
<div v-else>You do not have an active identity.</div> <div v-else>You do not have an active identity.</div>
<AlertMessage
<!-- This same popup code is in many files. --> :alertTitle="alertTitle"
<div v-bind:class="computedAlertClassNames()"> :alertMessage="alertMessage"
<button ></AlertMessage>
class="close-button bg-slate-200 w-8 leading-loose rounded-full absolute top-2 right-2"
@click="onClickClose()"
>
<fa icon="xmark"></fa>
</button>
<h4 class="font-bold pr-5">{{ alertTitle }}</h4>
<p>{{ alertMessage }}</p>
</div>
</section> </section>
</template> </template>
@ -105,8 +97,9 @@ import { Component, Vue } from "vue-facing-decorator";
import { accountsDB, db } from "@/db"; import { accountsDB, db } from "@/db";
import * as R from "ramda"; import * as R from "ramda";
import { MASTER_SETTINGS_KEY } from "@/db/tables/settings"; import { MASTER_SETTINGS_KEY } from "@/db/tables/settings";
import AlertMessage from "@/components/AlertMessage";
@Component @Component({ components: [AlertMessage] })
export default class SeedBackupView extends Vue { export default class SeedBackupView extends Vue {
activeAccount = null; activeAccount = null;
showSeed = false; showSeed = false;
@ -136,27 +129,5 @@ export default class SeedBackupView extends Vue {
// This same popup code is in many files. // This same popup code is in many files.
alertMessage = ""; alertMessage = "";
alertTitle = ""; 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,
};
}
} }
</script> </script>

39
src/views/StatisticsView.vue

@ -79,22 +79,11 @@
{{ worldProperties.animationDurationSeconds }} seconds {{ worldProperties.animationDurationSeconds }} seconds
</div> </div>
</div> </div>
<button class="float-right" @click="captureGraphics()">Screenshot</button> <button class="float-right" @click="captureGraphics()">Screenshot</button>
<AlertMessage
<!-- Another place to play with the sizing is in Resizer.setSize --> :alertTitle="alertTitle"
<div id="scene-container" class="h-screen"></div> :alertMessage="alertMessage"
></AlertMessage>
<div v-bind:class="computedAlertClassNames()">
<button
class="close-button bg-slate-200 w-8 leading-loose rounded-full absolute top-2 right-2"
@click="onClickClose()"
>
<fa icon="xmark"></fa>
</button>
<h4 class="font-bold pr-5">{{ alertTitle }}</h4>
<p>{{ alertMessage }}</p>
</div>
</section> </section>
</template> </template>
@ -102,13 +91,14 @@
import { SVGRenderer } from "three/addons/renderers/SVGRenderer.js"; import { SVGRenderer } from "three/addons/renderers/SVGRenderer.js";
import { Component, Vue } from "vue-facing-decorator"; import { Component, Vue } from "vue-facing-decorator";
import { World } from "@/components/World/World.js"; import { World } from "@/components/World/World.js";
import AlertMessage from "@/components/AlertMessage";
interface WorldProperties { interface WorldProperties {
startTime?: string; startTime?: string;
endTime?: string; endTime?: string;
} }
@Component @Component({ components: { AlertMessage } })
export default class StatisticsView extends Vue { export default class StatisticsView extends Vue {
world: World; world: World;
worldProperties: WorldProperties = {}; worldProperties: WorldProperties = {};
@ -210,23 +200,6 @@ export default class StatisticsView extends Vue {
this.alertTitle = ""; this.alertTitle = "";
this.alertMessage = ""; 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) { function ExportToSVG(rendererSVG, filename) {

Loading…
Cancel
Save