From 87cfead094d14bbea5d931d84f30a54a8e8e9476 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Thu, 20 Jul 2023 18:22:45 -0600 Subject: [PATCH 1/3] fix display of gives on contact screen; adjust give UI for project --- project.task.yaml | 1 + src/views/ContactsView.vue | 2 +- src/views/ProjectViewView.vue | 8 +++++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/project.task.yaml b/project.task.yaml index c13535c..cec1585 100644 --- a/project.task.yaml +++ b/project.task.yaml @@ -24,6 +24,7 @@ tasks: - 24 Move to Vite +- .5 add link to further project / people when a project pays ahead - .5 add project ID to the URL, to make a project publicly-accessible - .5 remove edit from project page for projects owned by others - .5 fix where user 0 sees no txns from user 1 on contacts page but sees them on list page diff --git a/src/views/ContactsView.vue b/src/views/ContactsView.vue index e3f3c6c..865beec 100644 --- a/src/views/ContactsView.vue +++ b/src/views/ContactsView.vue @@ -135,7 +135,7 @@ -
+
-

... and from this Project

+

... and paid forward from this Project

@@ -108,7 +108,8 @@ }}
- + + {{ give.amount }}
@@ -130,7 +131,8 @@ }}
- + + {{ give.amount }}
From e48a4ed05b069ca7d5fe46dcfbc7fb8440e0c908 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Thu, 20 Jul 2023 18:35:27 -0600 Subject: [PATCH 2/3] fix to use the real project name, and add creator --- src/views/DiscoverView.vue | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/views/DiscoverView.vue b/src/views/DiscoverView.vue index a223f72..260f13a 100644 --- a/src/views/DiscoverView.vue +++ b/src/views/DiscoverView.vue @@ -90,10 +90,10 @@
-

Canyon cleanup

+

{{ project.name }}

- {{ project.name }} + {{ didInfo(project.issuer, activeDid, allMyDids, allContacts) }}
@@ -111,8 +111,10 @@ import { Component, Vue } from "vue-facing-decorator"; import { accountsDB, db } from "@/db"; +import { Contact } from "@/db/tables/contacts"; import { MASTER_SETTINGS_KEY } from "@/db/tables/settings"; import { accessToken } from "@/libs/crypto"; +import { didInfo } from "@/libs/endorserServer"; import AlertMessage from "@/components/AlertMessage"; import QuickNav from "@/components/QuickNav"; import InfiniteScroll from "@/components/InfiniteScroll"; @@ -122,6 +124,8 @@ import InfiniteScroll from "@/components/InfiniteScroll"; }) export default class DiscoverView extends Vue { activeDid = ""; + allContacts: Array = []; + allMyDids: Array = []; apiServer = ""; searchTerms = ""; alertMessage = ""; @@ -133,11 +137,20 @@ export default class DiscoverView extends Vue { remoteCount = 0; isLoading = false; + // make this function available to the Vue template + didInfo = didInfo; + async mounted() { await db.open(); const settings = await db.settings.get(MASTER_SETTINGS_KEY); this.activeDid = settings?.activeDid || ""; this.apiServer = settings?.apiServer || ""; + this.allContacts = await db.contacts.toArray(); + + await accountsDB.open(); + const allAccounts = await accountsDB.accounts.toArray(); + this.allMyDids = allAccounts.map((acc) => acc.did); + this.searchLocal(); } @@ -166,7 +179,6 @@ export default class DiscoverView extends Vue { public async search(beforeId?: string) { let queryParams = "claimContents=" + encodeURIComponent(this.searchTerms); - console.log(beforeId); if (beforeId) { queryParams = queryParams + `&beforeId=${beforeId}`; } @@ -195,7 +207,6 @@ export default class DiscoverView extends Vue { if (plans) { for (const plan of plans) { const { name, description, handleId = plan.handleId, rowid } = plan; - console.log("here"); this.projects.push({ name, description, handleId, rowid }); } this.remoteCount = this.projects.length; @@ -278,8 +289,6 @@ export default class DiscoverView extends Vue { async loadMoreData(payload: boolean) { if (this.projects.length > 0 && payload) { const latestProject = this.projects[this.projects.length - 1]; - console.log("rowid", latestProject, payload); - console.log(Object.keys(latestProject)); if (this.isLocalActive) { this.searchLocal(latestProject["rowid"]); } else if (this.isRemoteActive) { From 4866416aae27794243bec0f427481c0affe6d401 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Thu, 20 Jul 2023 19:02:18 -0600 Subject: [PATCH 3/3] fix didInfo logic, and add to project lists --- src/libs/endorserServer.ts | 11 ++++++++--- src/views/DiscoverView.vue | 8 +++++--- src/views/ProjectViewView.vue | 12 ++++++++++-- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/libs/endorserServer.ts b/src/libs/endorserServer.ts index 60455fb..b351ff9 100644 --- a/src/libs/endorserServer.ts +++ b/src/libs/endorserServer.ts @@ -82,10 +82,15 @@ export function isHiddenDid(did) { /** always returns text, maybe UNNAMED_VISIBLE or UNKNOWN_ENTITY **/ -export function didInfo(did, activeDid, allMyDids, contacts) { - const myId: string | undefined = R.find(R.identity, allMyDids); +export function didInfo( + did: string, + activeDid: string, + allMyDids: Array, + contacts: Array, +): string { + const myId: string | undefined = R.find(R.equals(did), allMyDids, did); if (myId) { - return "You" + (myId.did !== activeDid ? " (Alt ID)" : ""); + return "You" + (myId !== activeDid ? " (Alt ID)" : ""); } else { const contact: Contact | undefined = R.find((c) => c.did === did, contacts); if (contact) { diff --git a/src/views/DiscoverView.vue b/src/views/DiscoverView.vue index 260f13a..45c316d 100644 --- a/src/views/DiscoverView.vue +++ b/src/views/DiscoverView.vue @@ -93,7 +93,9 @@

{{ project.name }}

- {{ didInfo(project.issuer, activeDid, allMyDids, allContacts) }} + {{ + didInfo(project.issuerDid, activeDid, allMyDids, allContacts) + }}
@@ -206,8 +208,8 @@ export default class DiscoverView extends Vue { const plans: ProjectData[] = results.data; if (plans) { for (const plan of plans) { - const { name, description, handleId = plan.handleId, rowid } = plan; - this.projects.push({ name, description, handleId, rowid }); + const { name, description, handleId, rowid, issuerDid } = plan; + this.projects.push({ name, description, handleId, rowid, issuerDid }); } this.remoteCount = this.projects.length; } else { diff --git a/src/views/ProjectViewView.vue b/src/views/ProjectViewView.vue index 7dc8c24..00f54d9 100644 --- a/src/views/ProjectViewView.vue +++ b/src/views/ProjectViewView.vue @@ -108,7 +108,11 @@ }}
- + {{ give.amount }}
@@ -131,7 +135,11 @@ }}
- + {{ give.amount }}