From c388cc8cfeb859d749e178d5b5c4713a89c16a8d Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Sun, 5 Nov 2023 16:34:18 -0700 Subject: [PATCH] remove lastName and just have a single name field --- package.json | 2 +- project.task.yaml | 3 +-- src/db/tables/settings.ts | 2 +- src/views/AccountViewView.vue | 20 +++++++++--------- src/views/ContactQRScanShowView.vue | 4 +++- src/views/IdentitySwitcherView.vue | 18 ++++++++-------- src/views/NewEditAccountView.vue | 32 +++++++++-------------------- 7 files changed, 35 insertions(+), 46 deletions(-) diff --git a/package.json b/package.json index 5ef417d..11b7f81 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "kickstart-for-time-pwa", - "version": "0.1.2", + "version": "0.1.3", "private": true, "scripts": { "serve": "vue-cli-service serve", diff --git a/project.task.yaml b/project.task.yaml index ce7734d..8a7b276 100644 --- a/project.task.yaml +++ b/project.task.yaml @@ -6,8 +6,6 @@ tasks: - 40 notifications : - push, where we trigger a ServiceWorker(?) in the app to reach out and check for new data assignee:matthew -- .1 test - make sure that a registration failure (including network failure) doesn't give a success message (which may have happened during board meeting) - - .1 don't allow to even see the claim actions if they're not registered - 01 Replace Gifted/Give in ContactsView with GiftedDialog assignee:matthew @@ -57,6 +55,7 @@ tasks: - .5 Display a more appealing confirmation on the map when erasing the marker assignee-group:ui - .5 make a VC details page - .1 Add units or different icon to the coins (to distinguish $, BTC, hours, etc) +- .1 remove firstName (& lastName) from localStorage - contacts v+ : - 01 Import all the non-sensitive data (ie. contacts & settings). diff --git a/src/db/tables/settings.ts b/src/db/tables/settings.ts index 8298dfe..dac9094 100644 --- a/src/db/tables/settings.ts +++ b/src/db/tables/settings.ts @@ -12,7 +12,7 @@ export type Settings = { activeDid?: string; apiServer?: string; firstName?: string; - lastName?: string; + lastName?: string; // deprecated, pre v 0.1.3 lastViewedClaimId?: string; searchBoxes?: Array<{ name: string; diff --git a/src/views/AccountViewView.vue b/src/views/AccountViewView.vue index c15141b..1ef6d8a 100644 --- a/src/views/AccountViewView.vue +++ b/src/views/AccountViewView.vue @@ -52,7 +52,7 @@
-

{{ firstName }} {{ lastName }}

+

{{ givenName }}

ID
@@ -372,7 +372,7 @@ interface SettingsType { activeDid?: string; apiServer?: string; firstName?: string; - lastName?: string; + lastName?: string; // deprecated, pre v 0.1.3 showContactGivesInline?: boolean; } @@ -386,8 +386,7 @@ export default class AccountViewView extends Vue { apiServer = ""; apiServerInput = ""; derivationPath = ""; - firstName = ""; - lastName = ""; + givenName = ""; numAccounts = 0; publicHex = ""; publicBase64 = ""; @@ -510,11 +509,12 @@ export default class AccountViewView extends Vue { * @param {SettingsType} settings - Object containing settings from the database. */ initializeState(settings: SettingsType | undefined) { - this.activeDid = settings?.activeDid || ""; - this.apiServer = settings?.apiServer || ""; - this.apiServerInput = settings?.apiServer || ""; - this.firstName = settings?.firstName || ""; - this.lastName = settings?.lastName || ""; + this.activeDid = (settings?.activeDid as string) || ""; + this.apiServer = (settings?.apiServer as string) || ""; + this.apiServerInput = (settings?.apiServer as string) || ""; + this.givenName = + (settings?.firstName || "") + + (settings?.lastName ? ` ${settings.lastName}` : ""); // pre v 0.1.3 this.showContactGives = !!settings?.showContactGivesInline; } @@ -531,7 +531,7 @@ export default class AccountViewView extends Vue { ) { this.publicHex = identity.keys[0].publicKeyHex; this.publicBase64 = Buffer.from(this.publicHex, "hex").toString("base64"); - this.derivationPath = identity.keys[0].meta.derivationPath; + this.derivationPath = identity.keys[0].meta.derivationPath as string; db.settings.update(MASTER_SETTINGS_KEY, { activeDid: identity.did, diff --git a/src/views/ContactQRScanShowView.vue b/src/views/ContactQRScanShowView.vue index 282f472..21a924e 100644 --- a/src/views/ContactQRScanShowView.vue +++ b/src/views/ContactQRScanShowView.vue @@ -108,7 +108,9 @@ export default class ContactQRScanShow extends Vue { iat: Date.now(), iss: this.activeDid, own: { - name: (settings?.firstName || "") + " " + (settings?.lastName || ""), + name: + (settings?.firstName || "") + + (settings?.lastName ? ` ${settings.lastName}` : ""), // deprecated, pre v 0.1.3 publicEncKey, }, }; diff --git a/src/views/IdentitySwitcherView.vue b/src/views/IdentitySwitcherView.vue index f0ed07b..c4459c5 100644 --- a/src/views/IdentitySwitcherView.vue +++ b/src/views/IdentitySwitcherView.vue @@ -22,7 +22,7 @@

- {{ firstName }} {{ lastName }} + {{ givenName }}

ID: {{ activeDid }} @@ -90,8 +90,7 @@ export default class IdentitySwitcherView extends Vue { public activeDid = ""; public apiServer = ""; public apiServerInput = ""; - public firstName = ""; - public lastName = ""; + public givenName = ""; public otherIdentities: Array<{ did: string }> = []; public showContactGives = false; @@ -101,7 +100,7 @@ export default class IdentitySwitcherView extends Vue { .where("did") .equals(activeDid) .first(); - const identity = JSON.parse(account?.identity || "null"); + const identity = JSON.parse((account?.identity as string) || "null"); return identity; } @@ -109,11 +108,12 @@ export default class IdentitySwitcherView extends Vue { try { await db.open(); const settings = await db.settings.get(MASTER_SETTINGS_KEY); - this.activeDid = settings?.activeDid || ""; - this.apiServer = settings?.apiServer || ""; - this.apiServerInput = settings?.apiServer || ""; - this.firstName = settings?.firstName || "No"; - this.lastName = settings?.lastName || "Name"; + this.activeDid = (settings?.activeDid as string) || ""; + this.apiServer = (settings?.apiServer as string) || ""; + this.apiServerInput = (settings?.apiServer as string) || ""; + this.givenName = + ((settings?.firstName as string) || "") + + (settings?.lastName ? ` ${settings.lastName}` : ""); // deprecated, pre v 0.1.3 this.showContactGives = !!settings?.showContactGivesInline; const identity = await this.getIdentity(this.activeDid); diff --git a/src/views/NewEditAccountView.vue b/src/views/NewEditAccountView.vue index 0fb5a7c..032937f 100644 --- a/src/views/NewEditAccountView.vue +++ b/src/views/NewEditAccountView.vue @@ -16,15 +16,9 @@ -
@@ -56,30 +50,24 @@ import { MASTER_SETTINGS_KEY } from "@/db/tables/settings"; components: {}, }) export default class NewEditAccountView extends Vue { - firstName = - localStorage.getItem("firstName") === null - ? "--" - : localStorage.getItem("firstName"); - lastName = - localStorage.getItem("lastName") === null - ? "--" - : localStorage.getItem("lastName"); + givenName = ""; // 'created' hook runs when the Vue instance is first created async created() { await db.open(); const settings = await db.settings.get(MASTER_SETTINGS_KEY); - this.firstName = settings?.firstName || ""; - this.lastName = settings?.lastName || ""; + this.givenName = + ((settings?.firstName as string) || "") + + (settings?.lastName ? ` ${settings.lastName}` : ""); // deprecated, pre v 0.1.3 } onClickSaveChanges() { db.settings.update(MASTER_SETTINGS_KEY, { - firstName: this.firstName, - lastName: this.lastName, + firstName: this.givenName, + lastName: "", // deprecated, pre v 0.1.3 }); - localStorage.setItem("firstName", this.firstName as string); - localStorage.setItem("lastName", this.lastName as string); + localStorage.setItem("firstName", this.givenName as string); + localStorage.setItem("lastName", ""); // deprecated, pre v 0.1.3 this.$router.push({ name: "account" }); }