From ac6376243b6b75296b247367a262ce30e377bdf4 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Sun, 5 Nov 2023 17:30:23 -0700 Subject: [PATCH] refactor name setting and other small messaging & types --- src/views/AccountViewView.vue | 14 ++++++++++++-- src/views/ContactsView.vue | 11 ++++++----- src/views/IdentitySwitcherView.vue | 12 ++++++------ src/views/NewEditAccountView.vue | 8 ++++---- 4 files changed, 28 insertions(+), 17 deletions(-) diff --git a/src/views/AccountViewView.vue b/src/views/AccountViewView.vue index 722ef90..51aa76e 100644 --- a/src/views/AccountViewView.vue +++ b/src/views/AccountViewView.vue @@ -52,7 +52,17 @@
-

{{ givenName }}

+

+ {{ givenName }} +

+ + + (set name) + +
ID
@@ -113,7 +123,7 @@ Edit Identity diff --git a/src/views/ContactsView.vue b/src/views/ContactsView.vue index c144def..fc3d33f 100644 --- a/src/views/ContactsView.vue +++ b/src/views/ContactsView.vue @@ -256,7 +256,7 @@ import { NotificationIface } from "@/constants/app"; import { IIdentifier } from "@veramo/core"; import { accountsDB, db } from "@/db/index"; import { Contact } from "@/db/tables/contacts"; -import { MASTER_SETTINGS_KEY } from "@/db/tables/settings"; +import { MASTER_SETTINGS_KEY, Settings } from "@/db/tables/settings"; import { accessToken, getContactPayloadFromJwtUrl, @@ -271,6 +271,7 @@ import { import { Component, Vue } from "vue-facing-decorator"; import QuickNav from "@/components/QuickNav.vue"; import EntityIcon from "@/components/EntityIcon.vue"; +import { Account } from "@/db/tables/accounts"; // eslint-disable-next-line @typescript-eslint/no-var-requires const Buffer = require("buffer/").Buffer; @@ -308,7 +309,7 @@ export default class ContactsView extends Vue { async created() { await db.open(); - const settings = await db.settings.get(MASTER_SETTINGS_KEY); + const settings = (await db.settings.get(MASTER_SETTINGS_KEY)) as Settings; this.activeDid = settings?.activeDid || ""; this.apiServer = settings?.apiServer || ""; @@ -332,7 +333,7 @@ export default class ContactsView extends Vue { public async getIdentity(activeDid: string) { await accountsDB.open(); const accounts = await accountsDB.accounts.toArray(); - const account = R.find((acc) => acc.did === activeDid, accounts); + const account = R.find((acc) => acc.did === activeDid, accounts) as Account; const identity = JSON.parse(account?.identity || "null"); if (!identity) { @@ -765,8 +766,8 @@ export default class ContactsView extends Vue { -1, ); } else { - const message = - resp.data.error?.message || "Bad server response of " + resp.status; + console.log("Got bad server response when checking visibility: ", resp); + const message = resp.data.error?.message || "Got bad server response."; this.$notify( { group: "alert", diff --git a/src/views/IdentitySwitcherView.vue b/src/views/IdentitySwitcherView.vue index c4459c5..ecf7ba5 100644 --- a/src/views/IdentitySwitcherView.vue +++ b/src/views/IdentitySwitcherView.vue @@ -71,7 +71,7 @@ import { Component, Vue } from "vue-facing-decorator"; import { AppString } from "@/constants/app"; import { db, accountsDB } from "@/db/index"; import { AccountsSchema } from "@/db/tables/accounts"; -import { MASTER_SETTINGS_KEY } from "@/db/tables/settings"; +import { MASTER_SETTINGS_KEY, Settings } from "@/db/tables/settings"; import QuickNav from "@/components/QuickNav.vue"; interface Notification { @@ -107,12 +107,12 @@ export default class IdentitySwitcherView extends Vue { async created() { try { await db.open(); - const settings = await db.settings.get(MASTER_SETTINGS_KEY); - this.activeDid = (settings?.activeDid as string) || ""; - this.apiServer = (settings?.apiServer as string) || ""; - this.apiServerInput = (settings?.apiServer as string) || ""; + const settings = (await db.settings.get(MASTER_SETTINGS_KEY)) as Settings; + this.activeDid = settings?.activeDid || ""; + this.apiServer = settings?.apiServer || ""; + this.apiServerInput = settings?.apiServer || ""; this.givenName = - ((settings?.firstName as string) || "") + + (settings?.firstName || "") + (settings?.lastName ? ` ${settings.lastName}` : ""); // deprecated, pre v 0.1.3 this.showContactGives = !!settings?.showContactGivesInline; diff --git a/src/views/NewEditAccountView.vue b/src/views/NewEditAccountView.vue index 032937f..b416490 100644 --- a/src/views/NewEditAccountView.vue +++ b/src/views/NewEditAccountView.vue @@ -10,7 +10,7 @@ > - [New/Edit] Identity + Edit Identity
@@ -44,7 +44,7 @@