From 2bec218cc584ce7ed93794090f6d8ccb9f128358 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Thu, 2 Nov 2023 20:50:33 -0600 Subject: [PATCH] allow edit of a contact's name --- project.task.yaml | 1 - src/views/ContactsView.vue | 55 +++++++++++++++++++++++++++++++++++++- 2 files changed, 54 insertions(+), 2 deletions(-) diff --git a/project.task.yaml b/project.task.yaml index af2801c..f29d34b 100644 --- a/project.task.yaml +++ b/project.task.yaml @@ -31,7 +31,6 @@ tasks: - .1 Remove notification alert visuals on home page - .5 Add infinite scroll to gifts on the home page -- .5 Allow edit of a contact name (but not the DID) - .5 bug - search for "Safari" does not find the project, but if already on the "Anywhere" tab it shows all - .2 figure out why endorser-mobile search doesn't find recently created PlanAction - .1 when creating a plan, select location and then make sure you can deselect on Android diff --git a/src/views/ContactsView.vue b/src/views/ContactsView.vue index 3bcfa0f..baac46f 100644 --- a/src/views/ContactsView.vue +++ b/src/views/ContactsView.vue @@ -93,6 +93,13 @@ class="inline-block align-text-bottom border border-slate-300 rounded" > {{ contact.name || "(no name)" }} +
{{ contact.did }}
@@ -209,6 +216,24 @@

This identity has no contacts.

+ +
+
+

Edit Name

+ + +
+
@@ -251,6 +276,8 @@ export default class ContactsView extends Vue { contacts: Array = []; contactEndorserUrl = localStorage.getItem("contactEndorserUrl") || ""; contactInput = ""; + contactEdit: Contact | null = null; + contactNewName = ""; // { "did:...": concatenated-descriptions } entry for each contact givenByMeDescriptions: Record = {}; // { "did:...": amount } entry for each contact @@ -961,6 +988,13 @@ export default class ContactsView extends Vue { } } + private async onClickSaveName(contact: Contact, newName: string) { + contact.name = newName; + return db.contacts + .update(contact.did, { name: newName }) + .then(() => (this.contactEdit = null)); + } + public toggleShowGiveTotals() { if (this.showGiveTotals) { this.showGiveTotals = false; @@ -985,6 +1019,26 @@ export default class ContactsView extends Vue {