diff --git a/src/views/ContactsView.vue b/src/views/ContactsView.vue
index 9c67299..6500b80 100644
--- a/src/views/ContactsView.vue
+++ b/src/views/ContactsView.vue
@@ -96,7 +96,12 @@
{{ contact.name || "(no name)" }}
{{ contact.did }}
- {{ contact.publicKeyBase64 }}
+
+ Public Key (base 64): {{ contact.publicKeyBase64 }}
+
+
to: {{ givenByMeTotals[contact.did] || 0 }}
@@ -183,7 +188,11 @@ export default class ContactsView extends Vue {
if (this.showGiveTotals) {
this.loadGives();
}
- this.contacts = await db.contacts.toArray();
+ const allContacts = await db.contacts.toArray();
+ this.contacts = R.sort(
+ (a: Contact, b) => (a.name || "").localeCompare(b.name || ""),
+ allContacts
+ );
}
async onClickNewContact(): Promise {
@@ -206,7 +215,11 @@ export default class ContactsView extends Vue {
}
const newContact = { did, name, publicKeyBase64 };
await db.contacts.add(newContact);
- this.contacts = this.contacts.concat([newContact]);
+ const allContacts = this.contacts.concat([newContact]);
+ this.contacts = R.sort(
+ (a: Contact, b) => (a.name || "").localeCompare(b.name || ""),
+ allContacts
+ );
}
async loadGives() {
@@ -281,6 +294,22 @@ export default class ContactsView extends Vue {
}
}
+ async deleteContact(contact: Contact) {
+ if (
+ confirm(
+ "Are you sure you want to delete " +
+ this.nameForDid(this.contacts, contact.did) +
+ " with DID " +
+ contact.did +
+ "?"
+ )
+ ) {
+ await db.open();
+ await db.contacts.delete(contact.did);
+ this.contacts = R.without([contact], this.contacts);
+ }
+ }
+
// from https://stackoverflow.com/a/175787/845494
//
private isNumeric(str: string): boolean {