diff --git a/project.task.yaml b/project.task.yaml
index b489cd3..ecb71d1 100644
--- a/project.task.yaml
+++ b/project.task.yaml
@@ -1,6 +1,7 @@
tasks:
+- figure out why a give directly on the project doesn't show in that project afterward
- in endorser-push-server - mount folder for persistent sqlite DB outside of container
- test alerts on all pages -- or refactor to new "notify" (since AlertMessage refactoring may require a change, et. ContactQRScanShowView)
- 40 notifications :
@@ -27,7 +28,7 @@ tasks:
- 24 Move to Vite assignee:matthew
-- .2 fit more icons on home screen, with a "more" button to contacts page if there is more than 2 rows
+- .2 fit more than 8 icons on home & project view screens, with a "more" button to contacts page if there are more than 2 rows
- .1 Remove notification alert visuals on home page
- .5 Add infinite scroll to gifts on the home page
- .5 bug - search for "Safari" does not find the project, but if already on the "Anywhere" tab it shows all
@@ -57,7 +58,7 @@ tasks:
- 01 Would it look better to shrink the buttons on many pages so they don't expand to the width of the screen? assignee-group:ui
- .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, etc)
+- .1 Add units or different icon to the coins (to distinguish $, BTC, hours, etc)
- contacts v+ :
- 01 Import all the non-sensitive data (ie. contacts & settings).
diff --git a/src/components/GiftedDialog.vue b/src/components/GiftedDialog.vue
index d06d334..08adbe9 100644
--- a/src/components/GiftedDialog.vue
+++ b/src/components/GiftedDialog.vue
@@ -52,17 +52,62 @@
diff --git a/src/router/index.ts b/src/router/index.ts
index efb4cd0..fa0e035 100644
--- a/src/router/index.ts
+++ b/src/router/index.ts
@@ -196,9 +196,7 @@ const routes: Array = [
path: "/test",
name: "test",
component: () =>
- import(
- /* webpackChunkName: "test" */ "../views/TestView.vue"
- ),
+ import(/* webpackChunkName: "test" */ "../views/TestView.vue"),
},
];
diff --git a/src/views/ContactGiftingView.vue b/src/views/ContactGiftingView.vue
index cd8a9de..516afdb 100644
--- a/src/views/ContactGiftingView.vue
+++ b/src/views/ContactGiftingView.vue
@@ -16,10 +16,6 @@
-
-
-
-
-
@@ -83,16 +79,10 @@
import { Component, Vue } from "vue-facing-decorator";
import GiftedDialog from "@/components/GiftedDialog.vue";
import { db, accountsDB } from "@/db/index";
-import { AccountsSchema } from "@/db/tables/accounts";
-import { MASTER_SETTINGS_KEY } from "@/db/tables/settings";
+import { Account, AccountsSchema } from "@/db/tables/accounts";
+import { MASTER_SETTINGS_KEY, Settings } from "@/db/tables/settings";
import { accessToken } from "@/libs/crypto";
-import {
- createAndSubmitGive,
- CreateAndSubmitGiveResult,
- ErrorResult,
- GiverInputInfo,
- GiverOutputInfo,
-} from "@/libs/endorserServer";
+import { GiverInputInfo } from "@/libs/endorserServer";
import { Contact } from "@/db/tables/contacts";
import QuickNav from "@/components/QuickNav.vue";
import EntityIcon from "@/components/EntityIcon.vue";
@@ -124,10 +114,10 @@ export default class ContactGiftingView extends Vue {
public async getIdentity(activeDid: string) {
await accountsDB.open();
- const account = await accountsDB.accounts
+ const account = (await accountsDB.accounts
.where("did")
.equals(activeDid)
- .first();
+ .first()) as Account;
const identity = JSON.parse(account?.identity || "null");
if (!identity) {
@@ -150,7 +140,7 @@ export default class ContactGiftingView extends Vue {
async created() {
try {
await db.open();
- const settings = await db.settings.get(MASTER_SETTINGS_KEY);
+ const settings = (await db.settings.get(MASTER_SETTINGS_KEY)) as Settings;
this.apiServer = settings?.apiServer || "";
this.activeDid = settings?.activeDid || "";
this.allContacts = await db.contacts.toArray();
@@ -173,123 +163,5 @@ export default class ContactGiftingView extends Vue {
openDialog(giver: GiverInputInfo) {
(this.$refs.customDialog as GiftedDialog).open(giver);
}
-
- handleDialogResult(result: GiverOutputInfo) {
- if (result.action === "confirm") {
- return new Promise((resolve) => {
- this.recordGive(
- result.giver?.did,
- result.description,
- result.hours,
- ).then(() => {
- resolve(null);
- });
- });
- } else {
- // action was "cancel" so do nothing
- }
- }
-
- /**
- *
- * @param giverDid may be null
- * @param description may be an empty string
- * @param hours may be 0
- */
- public async recordGive(
- giverDid?: string,
- description?: string,
- hours?: number,
- ) {
- if (!this.activeDid) {
- this.$notify(
- {
- group: "alert",
- type: "danger",
- title: "Error",
- text: "You must select an identity before you can record a give.",
- },
- -1,
- );
- return;
- }
-
- if (!description && !hours) {
- this.$notify(
- {
- group: "alert",
- type: "danger",
- title: "Error",
- text: "You must enter a description or some number of hours.",
- },
- -1,
- );
- return;
- }
-
- try {
- const identity = await this.getIdentity(this.activeDid);
- const result = await createAndSubmitGive(
- this.axios,
- this.apiServer,
- identity,
- giverDid,
- this.activeDid,
- description,
- hours,
- );
-
- if (this.isGiveCreationError(result)) {
- const errorMessage = this.getGiveCreationErrorMessage(result);
- console.log("Error with give result:", result);
- this.$notify(
- {
- group: "alert",
- type: "danger",
- title: "Error",
- text: errorMessage || "There was an error recording the give.",
- },
- -1,
- );
- } else {
- this.$notify(
- {
- group: "alert",
- type: "success",
- title: "Success",
- text: "That gift was recorded.",
- },
- -1,
- );
- }
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- } catch (error: any) {
- console.log("Error with give caught:", error);
-
- const message =
- error.userMessage ||
- error.response?.data?.error?.message ||
- "There was an error recording the Give.";
- this.$notify(
- {
- group: "alert",
- type: "danger",
- title: "Error",
- text: message,
- },
- -1,
- );
- }
- }
-
- // Helper functions for readability
-
- isGiveCreationError(result: CreateAndSubmitGiveResult) {
- return result.type == "error";
- }
-
- getGiveCreationErrorMessage(result: CreateAndSubmitGiveResult) {
- return (result as ErrorResult).error?.userMessage;
- }
}
diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue
index 73a62ed..f9d6075 100644
--- a/src/views/HomeView.vue
+++ b/src/views/HomeView.vue
@@ -42,7 +42,7 @@
@@ -99,19 +99,18 @@
import { Component, Vue } from "vue-facing-decorator";
import GiftedDialog from "@/components/GiftedDialog.vue";
import { db, accountsDB } from "@/db/index";
-import { MASTER_SETTINGS_KEY } from "@/db/tables/settings";
+import { MASTER_SETTINGS_KEY, Settings } from "@/db/tables/settings";
import { accessToken } from "@/libs/crypto";
import {
- createAndSubmitGive,
didInfo,
GiverInputInfo,
- GiverOutputInfo,
GiveServerRecord,
} from "@/libs/endorserServer";
import { Contact } from "@/db/tables/contacts";
import QuickNav from "@/components/QuickNav.vue";
import EntityIcon from "@/components/EntityIcon.vue";
import { IIdentifier } from "@veramo/core";
+import { Account } from "@/db/tables/accounts";
interface Notification {
group: string;
@@ -144,10 +143,10 @@ export default class HomeView extends Vue {
public async getIdentity(activeDid: string) {
await accountsDB.open();
- const account = await accountsDB.accounts
+ const account = (await accountsDB.accounts
.where("did")
.equals(activeDid)
- .first();
+ .first()) as Account;
const identity = JSON.parse(account?.identity || "null");
if (!identity) {
@@ -174,7 +173,7 @@ export default class HomeView extends Vue {
this.allMyDids = allAccounts.map((acc) => acc.did);
await db.open();
- const settings = await db.settings.get(MASTER_SETTINGS_KEY);
+ const settings = (await db.settings.get(MASTER_SETTINGS_KEY)) as Settings;
this.apiServer = settings?.apiServer || "";
this.activeDid = settings?.activeDid || "";
this.allContacts = await db.contacts.toArray();
@@ -204,7 +203,9 @@ export default class HomeView extends Vue {
if (this.activeDid) {
await accountsDB.open();
const allAccounts = await accountsDB.accounts.toArray();
- const account = allAccounts.find((acc) => acc.did === this.activeDid);
+ const account = allAccounts.find(
+ (acc) => acc.did === this.activeDid,
+ ) as Account;
const identity = JSON.parse(account?.identity || "null");
if (!identity) {
@@ -333,139 +334,5 @@ export default class HomeView extends Vue {
openDialog(giver: GiverInputInfo) {
(this.$refs.customDialog as GiftedDialog).open(giver);
}
-
- handleDialogResult(result: GiverOutputInfo) {
- if (result.action === "confirm") {
- return new Promise((resolve) => {
- this.recordGive(
- result.giver?.did,
- result.description,
- result.hours,
- ).then(() => {
- resolve(null);
- });
- });
- } else {
- // action was "cancel" so do nothing
- }
- }
-
- /**
- *
- * @param giverDid may be null
- * @param description may be an empty string
- * @param hours may be 0
- */
- public async recordGive(
- giverDid?: string,
- description?: string,
- hours?: number,
- ) {
- if (!this.activeDid) {
- this.$notify(
- {
- group: "alert",
- type: "danger",
- title: "Error",
- text: "You must select an identity before you can record a give.",
- },
- -1,
- );
- return;
- }
-
- if (!description && !hours) {
- this.$notify(
- {
- group: "alert",
- type: "danger",
- title: "Error",
- text: "You must enter a description or some number of hours.",
- },
- -1,
- );
- return;
- }
-
- try {
- const identity = await this.getIdentity(this.activeDid);
- const result = await createAndSubmitGive(
- this.axios,
- this.apiServer,
- identity,
- giverDid,
- this.activeDid,
- description,
- hours,
- );
-
- if (
- result.type === "error" ||
- this.isGiveCreationError(result.response)
- ) {
- const errorMessage = this.getGiveCreationErrorMessage(result);
- console.log("Error with give creation result:", result);
- this.$notify(
- {
- group: "alert",
- type: "danger",
- title: "Error",
- text: errorMessage || "There was an error creating the give.",
- },
- -1,
- );
- } else {
- this.$notify(
- {
- group: "alert",
- type: "success",
- title: "Success",
- text: "That gift was recorded.",
- },
- -1,
- );
- }
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- } catch (error: any) {
- console.log("Error with give recordation caught:", error);
- const message =
- error.userMessage ||
- error.response?.data?.error?.message ||
- "There was an error recording the give.";
- this.$notify(
- {
- group: "alert",
- type: "danger",
- title: "Error",
- text: message,
- },
- -1,
- );
- }
- }
-
- // Helper functions for readability
-
- /**
- * @param result response "data" from the server
- * @returns true if the result indicates an error
- */
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- isGiveCreationError(result: any) {
- return result.status !== 201 || result.data?.error;
- }
-
- /**
- * @param result direct response eg. ErrorResult or SuccessResult (potentially with embedded "data")
- * @returns best guess at an error message
- */
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- getGiveCreationErrorMessage(result: any) {
- return (
- result.error?.userMessage ||
- result.error?.error ||
- result.response?.data?.error?.message
- );
- }
}
diff --git a/src/views/ProjectViewView.vue b/src/views/ProjectViewView.vue
index c97b75b..a256bbd 100644
--- a/src/views/ProjectViewView.vue
+++ b/src/views/ProjectViewView.vue
@@ -125,7 +125,7 @@
@@ -212,18 +212,16 @@ import { Component, Vue } from "vue-facing-decorator";
import GiftedDialog from "@/components/GiftedDialog.vue";
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 } from "@/libs/crypto";
import {
- createAndSubmitGive,
didInfo,
GiverInputInfo,
- GiverOutputInfo,
GiveServerRecord,
- ResultWithType,
} from "@/libs/endorserServer";
import QuickNav from "@/components/QuickNav.vue";
import EntityIcon from "@/components/EntityIcon.vue";
+import { Account } from "@/db/tables/accounts";
interface Notification {
group: string;
@@ -257,7 +255,7 @@ export default class ProjectViewView 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 || "";
this.allContacts = await db.contacts.toArray();
@@ -266,17 +264,17 @@ export default class ProjectViewView extends Vue {
const accounts = accountsDB.accounts;
const accountsArr = await accounts?.toArray();
this.allMyDids = accountsArr.map((acc) => acc.did);
- const account = accountsArr?.find((acc) => acc.did === this.activeDid);
+ const account = accountsArr.find((acc) => acc.did === this.activeDid);
const identity = JSON.parse(account?.identity || "null");
this.LoadProject(identity);
}
public async getIdentity(activeDid: string) {
await accountsDB.open();
- const account = await accountsDB.accounts
+ const account = (await accountsDB.accounts
.where("did")
.equals(activeDid)
- .first();
+ .first()) as Account;
const identity = JSON.parse(account?.identity || "null");
if (!identity) {
@@ -461,11 +459,6 @@ export default class ProjectViewView extends Vue {
}
}
- openDialog(contact: GiverInputInfo) {
- const dialog: GiftedDialog = this.$refs.customDialog as GiftedDialog;
- dialog.open(contact);
- }
-
getOpenStreetMapUrl() {
// Google URL is https://maps.google.com/?q=LAT,LONG
return (
@@ -480,96 +473,8 @@ export default class ProjectViewView extends Vue {
);
}
- handleDialogResult(result: GiverOutputInfo) {
- if (result.action === "confirm") {
- return new Promise((resolve) => {
- this.recordGive(
- result.giver?.did,
- result.description,
- result.hours,
- ).then(() => {
- resolve(null);
- });
- });
- } else {
- // action was not "confirm" so do nothing
- }
- }
-
- /**
- *
- * @param giverDid may be null
- * @param description may be an empty string
- * @param hours may be 0
- */
- async recordGive(giverDid?: string, description?: string, hours?: number) {
- if (!this.activeDid) {
- this.$notify(
- {
- group: "alert",
- type: "danger",
- title: "Error",
- text: "You must select an identity before you can record a give.",
- },
- -1,
- );
- return;
- }
-
- if (!description && !hours) {
- this.$notify(
- {
- group: "alert",
- type: "danger",
- title: "Error",
- text: "You must enter a description or some number of hours.",
- },
- -1,
- );
- } else {
- const identity = await this.getIdentity(this.activeDid);
- const result = await createAndSubmitGive(
- this.axios,
- this.apiServer,
- identity,
- giverDid,
- this.activeDid,
- description,
- hours,
- this.projectId,
- );
- if (result.type == "success") {
- this.$notify(
- {
- group: "alert",
- type: "success",
- title: "Success",
- text: "That gift was recorded.",
- },
- -1,
- );
- } else {
- console.log("Error with give creation:", result);
- if (result.type != "error") {
- console.log(
- "... and it has an unexpected result type of",
- (result as ResultWithType).type,
- );
- }
- const message =
- result?.error?.userMessage ||
- "There was an error recording the Give.";
- this.$notify(
- {
- group: "alert",
- type: "danger",
- title: "Error",
- text: message,
- },
- -1,
- );
- }
- }
+ openDialog(contact: GiverInputInfo) {
+ (this.$refs.customDialog as GiftedDialog).open(contact);
}
}