From 5747404fd6b2d151d1a8e116256d4b72c16382a6 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Fri, 23 Jun 2023 20:17:54 -0600 Subject: [PATCH] add marker in feed to show where they've seen claims, plus other small clean-up --- project.task.yaml | 29 ++++++++++++++------- src/db/tables/settings.ts | 2 ++ src/router/index.ts | 1 + src/views/AccountViewView.vue | 27 +++++++++++++------- src/views/ContactAmountsView.vue | 10 ++++++-- src/views/ContactQRScanShowView.vue | 5 +++- src/views/ContactsView.vue | 22 ++++++++++++---- src/views/HomeView.vue | 39 +++++++++++++++++++++++------ src/views/NewEditProjectView.vue | 10 ++++++-- src/views/ProjectViewView.vue | 5 +++- src/views/ProjectsView.vue | 5 +++- src/views/StatisticsView.vue | 2 +- 12 files changed, 119 insertions(+), 38 deletions(-) diff --git a/project.task.yaml b/project.task.yaml index 13cd4c9..9e443f4 100644 --- a/project.task.yaml +++ b/project.task.yaml @@ -4,13 +4,14 @@ - add infinite scroll assignee:matthew blocks: ref:https://raw.githubusercontent.com/trentlarson/lives-of-gifts/master/project.yaml#kickstarter%20for%20time -- allow type annotations in World.js & landmarks.js (since we get this error: "Types are not supported by current JavaScript version") +- allow type annotations in World.js & landmarks.js (since we get this error - "Types are not supported by current JavaScript version") - replace user-affecting console.log & console.error with error messages (eg. catches) +- if there's no identity, handle it on pages which expect an identity (eg. project -- look for JSON.parse identity calls) -- stats v1 : - - 01 show numeric stats - - 01 link to world for specific stats - - .5 don't load another instance of a bush if it already exists +- show project activity : + - Save IDs of special projects of interest + - allow to give where a project is the provider + - allow to see activity where a project is provider - contacts v1 : - 01 Import contact info a la QR code. @@ -29,19 +30,26 @@ - show pop-up confirming that settings & contacts have been downloaded -- Ensure each action sent to the server has a confirmation. +- Ensure each action sent to the server has a confirmation - registration -- Home Feed & Quick Give screen +- Home Feed & Quick Give screen : - 01 save the feed-viewed status in settings storage ("afterQuery") - 01 quick action - send action, maybe choose via canvas tool https://github.com/konvajs/vue-konva - .5 customize favicon - .5 make advanced features harder to access; advanced build? -- 40 notifications - - pull, w/ scheduled runs +- 40 notifications : - push +- stats v1 : + - 01 show numeric stats + - 01 link to world for specific stats + - .5 don't load another instance of a bush if it already exists + +- Do we want split first name & last name? +- remove 'about' page + - Release Minimum Viable Product : - Turn off stats-world or ensure it's usable (eg. cannot zoom out too far and lose world, cannot screenshot). - Add disclaimers. @@ -51,6 +59,9 @@ - Ensure public server has limits that work for group adoption. - Test PWA features on Android and iOS. +- 40 notifications v+ : + - pull, w/ scheduled runs + - Stats : - 01 point out user's location on the world - 01 present a credential selected from the stats diff --git a/src/db/tables/settings.ts b/src/db/tables/settings.ts index a7671c2..02f7ba7 100644 --- a/src/db/tables/settings.ts +++ b/src/db/tables/settings.ts @@ -1,10 +1,12 @@ // a singleton export type Settings = { id: number; // there's only one entry: MASTER_SETTINGS_KEY + activeDid?: string; apiServer?: string; firstName?: string; lastName?: string; + lastViewedClaimId?: string; showContactGivesInline?: boolean; }; diff --git a/src/router/index.ts b/src/router/index.ts index 28db091..80f354c 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -132,6 +132,7 @@ const routes: Array = [ name: "projects", component: () => import(/* webpackChunkName: "projects" */ "../views/ProjectsView.vue"), + beforeEnter: enterOrStart, }, { path: "/seed-backup", diff --git a/src/views/AccountViewView.vue b/src/views/AccountViewView.vue index 2b34be2..3898552 100644 --- a/src/views/AccountViewView.vue +++ b/src/views/AccountViewView.vue @@ -289,10 +289,10 @@
- or -
@@ -85,8 +85,14 @@
  • +
    + You've seen all claims below. +
    {{ this.giveDescription(record) }}
  • @@ -129,8 +135,8 @@ export default class HomeView extends Vue { feedAllLoaded = false; feedData = []; feedPreviousOldestId = null; + feedLastViewedId = null; isHiddenSpinner = true; - showInput = false; // 'created' hook runs when the Vue instance is first created async created() { @@ -140,6 +146,7 @@ export default class HomeView extends Vue { const settings = await db.settings.get(MASTER_SETTINGS_KEY); this.activeDid = settings?.activeDid || ""; this.allContacts = await db.contacts.toArray(); + this.feedLastViewedId = settings?.lastViewedClaimId; } // 'mounted' hook runs after initial render @@ -168,7 +175,19 @@ export default class HomeView extends Vue { this.feedData = this.feedData.concat(results.data); //console.log("Feed data:", this.feedData); this.feedAllLoaded = results.hitLimit; - this.feedPreviousOldestId = results.data[results.data.length - 1].id; + this.feedPreviousOldestId = + results.data[results.data.length - 1].jwtId; + if ( + this.feedLastViewedId == null || + this.feedLastViewedId < results.data[0].jwtId + ) { + // save it to storage + await db.open(); + db.settings.update(MASTER_SETTINGS_KEY, { + lastViewedClaimId: results.data[0].jwtId, + }); + // but not for this page because we need to remember what it was before + } } }) .catch((e) => { @@ -190,7 +209,10 @@ export default class HomeView extends Vue { this.allAccounts ); //console.log("about to parse from", this.activeDid, account?.identity); - const identity = JSON.parse(account?.identity || "undefined"); + const identity = JSON.parse(account?.identity || "null"); + if (!identity) { + throw new Error("No identity found."); + } const token = await accessToken(identity); headers["Authorization"] = "Bearer " + token; } else { @@ -278,7 +300,10 @@ export default class HomeView extends Vue { this.allAccounts ); //console.log("about to parse from", this.activeDid, account?.identity); - const identity = JSON.parse(account?.identity || "undefined"); + const identity = JSON.parse(account?.identity || "null"); + if (!identity) { + throw new Error("No identity found."); + } createAndSubmitGive( this.axios, this.apiServer, diff --git a/src/views/NewEditProjectView.vue b/src/views/NewEditProjectView.vue index af86bc8..72079a8 100644 --- a/src/views/NewEditProjectView.vue +++ b/src/views/NewEditProjectView.vue @@ -127,7 +127,10 @@ export default class NewEditProjectView extends Vue { } else { const accounts = await accountsDB.accounts.toArray(); const account = R.find((acc) => acc.did === this.activeDid, accounts); - const identity = JSON.parse(account?.identity || "undefined"); + const identity = JSON.parse(account?.identity || "null"); + if (!identity) { + throw new Error("No identity found."); + } this.LoadProject(identity); } } @@ -259,7 +262,10 @@ export default class NewEditProjectView extends Vue { } else { const accounts = await accountsDB.accounts.toArray(); const account = R.find((acc) => acc.did === this.activeDid, accounts); - const identity = JSON.parse(account?.identity || "undefined"); + const identity = JSON.parse(account?.identity || "null"); + if (!identity) { + throw new Error("No identity found."); + } this.SaveProject(identity); } } diff --git a/src/views/ProjectViewView.vue b/src/views/ProjectViewView.vue index 5af2fdf..37fd059 100644 --- a/src/views/ProjectViewView.vue +++ b/src/views/ProjectViewView.vue @@ -240,7 +240,10 @@ export default class ProjectViewView extends Vue { } else { const accounts = await accountsDB.accounts.toArray(); const account = R.find((acc) => acc.did === activeDid, accounts); - const identity = JSON.parse(account?.identity || "undefined"); + const identity = JSON.parse(account?.identity || "null"); + if (!identity) { + throw new Error("No identity found."); + } this.LoadProject(identity); } } diff --git a/src/views/ProjectsView.vue b/src/views/ProjectsView.vue index f9dee84..b497eb2 100644 --- a/src/views/ProjectsView.vue +++ b/src/views/ProjectsView.vue @@ -167,7 +167,10 @@ export default class ProjectsView extends Vue { } else { const accounts = await accountsDB.accounts.toArray(); const account = R.find((acc) => acc.did === activeDid, accounts); - const identity = JSON.parse(account?.identity || "undefined"); + const identity = JSON.parse(account?.identity || "null"); + if (!identity) { + throw new Error("No identity found."); + } this.LoadProjects(identity); } } diff --git a/src/views/StatisticsView.vue b/src/views/StatisticsView.vue index 0276704..2913b20 100644 --- a/src/views/StatisticsView.vue +++ b/src/views/StatisticsView.vue @@ -61,7 +61,7 @@
  • Each will show at their time of appearance relative to all others.
  • Note that the ones on the left and right edges are randomized - because not all their positional data is visible to you. + because their data isn't all visible to you.