diff --git a/project.yaml b/project.yaml index c14c0f8..8e2141f 100644 --- a/project.yaml +++ b/project.yaml @@ -11,8 +11,10 @@ - replace user-affecting console.logs with error messages (eg. catches) -- contacts - - make advanced "show/hide amounts" button into a nice UI toggle +- contacts v1: + - .5 make advanced "show/hide amounts" button into a nice UI toggle + - .2 show error to user when adding a duplicate contact + - parse input more robustly (with CSV lib and not commas) - commit screen diff --git a/src/db/index.ts b/src/db/index.ts index e6d469e..dc7e911 100644 --- a/src/db/index.ts +++ b/src/db/index.ts @@ -3,11 +3,19 @@ import { encrypted, Encryption } from "@pvermeer/dexie-encrypted-addon"; import { Account, AccountsSchema, + Contact, + ContactsSchema, MASTER_SETTINGS, Settings, SettingsSchema, } from "./tables"; +type AllTables = { + accounts: Table; + contacts: Table; + settings: Table; +}; + /** * In order to make the next line be acceptable, the program needs to have its linter suppress a rule: * https://typescript-eslint.io/rules/no-unnecessary-type-constraint/ @@ -16,15 +24,15 @@ import { * * https://9to5answer.com/how-to-bypass-warning-unexpected-any-specify-a-different-type-typescript-eslint-no-explicit-any */ -type DexieTables = { - accounts: Table; - settings: Table; -}; - +type DexieTables = AllTables; export type Dexie = BaseDexie & T; export const db = new BaseDexie("KickStart") as Dexie; - -const AllSchemas = Object.assign({}, AccountsSchema, SettingsSchema); +const AllSchemas = Object.assign( + {}, + AccountsSchema, + ContactsSchema, + SettingsSchema +); /** * Needed to enable a special webpack setting to allow *await* below: @@ -38,7 +46,8 @@ const secret = if (localStorage.getItem("secret") == null) { localStorage.setItem("secret", secret); } -console.log("Secret:", secret); + +//console.log("IndexedDB Encryption Secret:", secret); encrypted(db, { secretKey: secret }); db.version(1).stores(AllSchemas); diff --git a/src/db/tables/index.ts b/src/db/tables/index.ts index 2c944a2..6b7b62f 100644 --- a/src/db/tables/index.ts +++ b/src/db/tables/index.ts @@ -14,6 +14,18 @@ export const AccountsSchema = { "++id, dateCreated, derivationPath, $identity, $mnemonic, publicKeyHex", }; +export interface Contact { + did: string; + name?: string; + publicKeyBase64?: string; + seesMe?: boolean; + registered?: boolean; +} + +export const ContactsSchema = { + contacts: "++did, name, publicKeyBase64, registered, seesMe", +}; + // a singleton export type Settings = { id: number; diff --git a/src/main.ts b/src/main.ts index 234967b..8fc26a4 100644 --- a/src/main.ts +++ b/src/main.ts @@ -20,6 +20,7 @@ import { faShareNodes, faQrcode, faUser, + faUsers, faPen, faPlus, faTrashCan, @@ -41,6 +42,7 @@ library.add( faShareNodes, faQrcode, faUser, + faUsers, faPen, faPlus, faTrashCan, diff --git a/src/router/index.ts b/src/router/index.ts index a1ee052..376cfd7 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -43,6 +43,12 @@ const routes: Array = [ /* webpackChunkName: "confirm-contact" */ "../views/ConfirmContactView.vue" ), }, + { + path: "/contacts", + name: "contacts", + component: () => + import(/* webpackChunkName: "contacts" */ "../views/ContactsView.vue"), + }, { path: "/scan-contact", name: "scan-contact", diff --git a/src/views/AccountViewView.vue b/src/views/AccountViewView.vue index 06d1b6a..01bdf49 100644 --- a/src/views/AccountViewView.vue +++ b/src/views/AccountViewView.vue @@ -29,10 +29,10 @@
  • - +
  • diff --git a/src/views/ContactsView.vue b/src/views/ContactsView.vue new file mode 100644 index 0000000..4d89c7a --- /dev/null +++ b/src/views/ContactsView.vue @@ -0,0 +1,442 @@ + + + diff --git a/src/views/DiscoverView.vue b/src/views/DiscoverView.vue index c351481..7eadab7 100644 --- a/src/views/DiscoverView.vue +++ b/src/views/DiscoverView.vue @@ -26,8 +26,10 @@
  • -
  • diff --git a/src/views/NewEditProjectView.vue b/src/views/NewEditProjectView.vue index 54c020f..bb153aa 100644 --- a/src/views/NewEditProjectView.vue +++ b/src/views/NewEditProjectView.vue @@ -107,6 +107,7 @@ export default class NewEditProjectView extends Vue { isHiddenSave = false; isHiddenSpinner = true; + // 'created' hook runs when the Vue instance is first created async created() { if (this.projectId === "") { console.log("This is a new project"); diff --git a/src/views/ProjectViewView.vue b/src/views/ProjectViewView.vue index f0a2b4e..e8577ff 100644 --- a/src/views/ProjectViewView.vue +++ b/src/views/ProjectViewView.vue @@ -222,6 +222,7 @@ export default class ProjectViewView extends Vue { } } + // 'created' hook runs when the Vue instance is first created async created() { await db.open(); const num_accounts = await db.accounts.count(); diff --git a/src/views/ProjectsView.vue b/src/views/ProjectsView.vue index 06b8fdc..46660cd 100644 --- a/src/views/ProjectsView.vue +++ b/src/views/ProjectsView.vue @@ -26,8 +26,10 @@
  • -
  • @@ -151,6 +153,7 @@ export default class ProjectsView extends Vue { } } + // 'created' hook runs when the Vue instance is first created async created() { await db.open(); const num_accounts = await db.accounts.count();