From a77d20b572d554f6af61f74a600fc7e1329adf43 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Tue, 5 Dec 2023 17:58:46 -0700 Subject: [PATCH 1/4] show appropriate icon next to amount numbers (and some docs) --- README.md | 4 ++++ project.task.yaml | 4 +++- src/main.ts | 6 +++++ src/views/AccountViewView.vue | 16 ++++++------- src/views/ContactsView.vue | 1 + src/views/HelpView.vue | 15 +++++++++++++ src/views/ProjectViewView.vue | 42 ++++++++++++++++++++++++++++------- 7 files changed, 71 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index b27c591d..f23c3211 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,10 @@ Under the "Your Identity" screen, click "Advanced", click "Switch Identity / No For your own web-push tests, change the 'vapid' URL in App.vue, and install apps on the same domain. +### Icons + +To add an icon, add to main.ts and reference with `fa` element and `icon` attribute with the hyphenated name. + ### Manual walk-through - Clear the browser cache for localhost for a new user. diff --git a/project.task.yaml b/project.task.yaml index f36b06fd..c0bc9f84 100644 --- a/project.task.yaml +++ b/project.task.yaml @@ -13,8 +13,10 @@ tasks: - Discuss whether the remaining tasks are worthwhile before MVP release. -- .1 Add units or different icon to the coins (to distinguish $, BTC, hours, etc) +- .5 If notifications are not enabled, add message to front page with link/button to enable + - .5 make a VC details page, or link to endorser.ch (including confirmations) +- .3 Add URL for project - 01 allow download of each VC (& confirmations, to show that they actually own their data) - .3 check that Android shows "back" buttons on screens without bottom tray - .1 Make give description text box into something that expands as they type? diff --git a/src/main.ts b/src/main.ts index 7bcaade6..de867e15 100644 --- a/src/main.ts +++ b/src/main.ts @@ -14,6 +14,7 @@ import { faArrowLeft, faArrowRight, faBan, + faBitcoinSign, faBurst, faCalendar, faChevronLeft, @@ -27,6 +28,7 @@ import { faCoins, faComment, faCopy, + faDollar, faEllipsisVertical, faEye, faEyeSlash, @@ -44,6 +46,7 @@ import { faPersonCircleCheck, faPersonCircleQuestion, faPlus, + faQuestion, faQrcode, faRotate, faShareNodes, @@ -61,6 +64,7 @@ library.add( faArrowLeft, faArrowRight, faBan, + faBitcoinSign, faBurst, faCalendar, faChevronLeft, @@ -74,6 +78,7 @@ library.add( faCoins, faComment, faCopy, + faDollar, faEllipsisVertical, faEye, faEyeSlash, @@ -92,6 +97,7 @@ library.add( faPersonCircleQuestion, faPlus, faQrcode, + faQuestion, faRotate, faShareNodes, faSpinner, diff --git a/src/views/AccountViewView.vue b/src/views/AccountViewView.vue index e33d0d2e..cdd8d1e6 100644 --- a/src/views/AccountViewView.vue +++ b/src/views/AccountViewView.vue @@ -288,6 +288,14 @@ +
+ +
+
-
- -
-

Claim Server

+

+ How do I access even more functionality? +

+

+ There is an "Advanced" section at the bottom of the Account + page. +

+

+ There is a even more functionality in a mobile app (and more + documentation) at + + EndorserSearch.com + +

+

What is your privacy policy?

See diff --git a/src/views/ProjectViewView.vue b/src/views/ProjectViewView.vue index b58f7542..62325924 100644 --- a/src/views/ProjectViewView.vue +++ b/src/views/ProjectViewView.vue @@ -56,8 +56,11 @@

{{ truncatedDesc }} - Read More... Read More
@@ -65,7 +68,7 @@ Read Less- Read Less
@@ -167,8 +170,10 @@ {{ didInfo(offer.agentDid, activeDid, allMyDids, allContacts) }} - - {{ offer.amount }} + {{ offer.amount }}
@@ -195,9 +200,11 @@ > {{ didInfo(give.agentDid, activeDid, allMyDids, allContacts) }} - - {{ give.amount }} + + {{ give.amount }}
@@ -625,5 +632,24 @@ export default class ProjectViewView extends Vue { openOfferDialog() { (this.$refs.customOfferDialog as OfferDialog).open(); } + + UNIT_CODES: Record> = { + BTC: { + name: "Bitcoin", + faIcon: "bitcoin-sign", + }, + HUR: { + name: "hours", + faIcon: "clock", + }, + USD: { + name: "US Dollars", + faIcon: "dollar", + }, + }; + + iconForUnitCode(unitCode: string) { + return this.UNIT_CODES[unitCode]?.faIcon || "question"; + } } From 3f436476a2183400af2d1868941be9b1a0c46627 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Tue, 5 Dec 2023 18:47:56 -0700 Subject: [PATCH 2/4] fix project loading & saving to include all the claim data --- project.task.yaml | 1 + src/views/NewEditProjectView.vue | 35 ++++++++++++++++---------------- src/views/ProjectViewView.vue | 2 +- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/project.task.yaml b/project.task.yaml index c0bc9f84..828b3404 100644 --- a/project.task.yaml +++ b/project.task.yaml @@ -17,6 +17,7 @@ tasks: - .5 make a VC details page, or link to endorser.ch (including confirmations) - .3 Add URL for project +- .5 Add start date to project - 01 allow download of each VC (& confirmations, to show that they actually own their data) - .3 check that Android shows "back" buttons on screens without bottom tray - .1 Make give description text box into something that expands as they type? diff --git a/src/views/NewEditProjectView.vue b/src/views/NewEditProjectView.vue index 62d5c710..ec8f56e3 100644 --- a/src/views/NewEditProjectView.vue +++ b/src/views/NewEditProjectView.vue @@ -26,18 +26,18 @@ type="text" placeholder="Idea Name" class="block w-full rounded border border-slate-400 mb-4 px-3 py-2" - v-model="projectName" + v-model="fullClaim.name" />
- {{ description.length }}/5000 max. characters + {{ fullClaim.description.length }}/5000 max. characters
@@ -72,7 +72,7 @@ name="OpenStreetMap" /> @@ -136,13 +136,17 @@ export default class NewEditProjectView extends Vue { activeDid = ""; apiServer = ""; - description = ""; errorMessage = ""; + fullClaim: PlanVerifiableCredential = { + "@context": "https://schema.org", + "@type": "PlanAction", + name: "", + description: "", + }; includeLocation = false; latitude = 0; longitude = 0; numAccounts = 0; - projectName = ""; zoom = 2; async beforeCreate() { @@ -214,9 +218,12 @@ export default class NewEditProjectView extends Vue { try { const resp = await this.axios.get(url, { headers }); if (resp.status === 200) { - const claim = resp.data.claim; - this.projectName = claim.name; - this.description = claim.description; + this.fullClaim = resp.data.claim; + if (this.fullClaim?.location) { + this.includeLocation = true; + this.latitude = this.fullClaim.location.geo.latitude; + this.longitude = this.fullClaim.location.geo.longitude; + } } } catch (error) { console.error("Got error retrieving that project", error); @@ -225,13 +232,7 @@ export default class NewEditProjectView extends Vue { private async SaveProject(identity: IIdentifier) { // Make a claim - const vcClaim: PlanVerifiableCredential = { - "@context": "https://schema.org", - "@type": "PlanAction", - name: this.projectName, - description: this.description, - identifier: this.projectId || undefined, - }; + const vcClaim: PlanVerifiableCredential = this.fullClaim; if (this.projectId) { vcClaim.identifier = this.projectId; } @@ -314,8 +315,8 @@ export default class NewEditProjectView extends Vue { error?: { message?: string }; }>; if (serverError) { + console.log("Got error from server", serverError); if (Object.prototype.hasOwnProperty.call(serverError, "message")) { - console.log(serverError); userMessage = serverError.response?.data?.error?.message || ""; // This is info for the user. this.$notify( { diff --git a/src/views/ProjectViewView.vue b/src/views/ProjectViewView.vue index 62325924..8226f248 100644 --- a/src/views/ProjectViewView.vue +++ b/src/views/ProjectViewView.vue @@ -35,7 +35,7 @@ {{ issuer }}
-
+
{{ timeSince }}
From bb122be3194d3d77221d5aa3a29c88261fa19c9a Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Tue, 5 Dec 2023 19:55:44 -0700 Subject: [PATCH 3/4] add URL for plans --- project.task.yaml | 4 ++-- src/libs/endorserServer.ts | 6 +++++ src/libs/util.ts | 3 +++ src/main.ts | 2 ++ src/views/NewEditProjectView.vue | 8 ++++++- src/views/ProjectViewView.vue | 41 ++++++++++++++++++++++++++++++-- 6 files changed, 59 insertions(+), 5 deletions(-) create mode 100644 src/libs/util.ts diff --git a/project.task.yaml b/project.task.yaml index 828b3404..5e892183 100644 --- a/project.task.yaml +++ b/project.task.yaml @@ -11,10 +11,10 @@ tasks: - .5 Add infinite scroll to gifts on the home page -- Discuss whether the remaining tasks are worthwhile before MVP release. - - .5 If notifications are not enabled, add message to front page with link/button to enable +- Discuss whether the remaining tasks are worthwhile before MVP release. + - .5 make a VC details page, or link to endorser.ch (including confirmations) - .3 Add URL for project - .5 Add start date to project diff --git a/src/libs/endorserServer.ts b/src/libs/endorserServer.ts index 8db51eb8..792eab2d 100644 --- a/src/libs/endorserServer.ts +++ b/src/libs/endorserServer.ts @@ -69,6 +69,8 @@ export interface OfferServerRecord { validThrough: string; } +// Note that previous VCs may have additional fields. +// https://endorser.ch/doc/html/transactions.html#id4 export interface GiveVerifiableCredential { "@context"?: string; // optional when embedded, eg. in an Agree "@type": "GiveAction"; @@ -80,6 +82,8 @@ export interface GiveVerifiableCredential { recipient?: { identifier: string }; } +// Note that previous VCs may have additional fields. +// https://endorser.ch/doc/html/transactions.html#id8 export interface OfferVerifiableCredential { "@context"?: string; // optional when embedded, eg. in an Agree "@type": "Offer"; @@ -93,6 +97,8 @@ export interface OfferVerifiableCredential { validThrough?: string; } +// Note that previous VCs may have additional fields. +// https://endorser.ch/doc/html/transactions.html#id7 export interface PlanVerifiableCredential { "@context": "https://schema.org"; "@type": "PlanAction"; diff --git a/src/libs/util.ts b/src/libs/util.ts new file mode 100644 index 00000000..693a3312 --- /dev/null +++ b/src/libs/util.ts @@ -0,0 +1,3 @@ +export const isGlobalUri = (uri: string) => { + return uri && uri.match(new RegExp(/^[A-Za-z][A-Za-z0-9+.-]+:/)); +}; diff --git a/src/main.ts b/src/main.ts index de867e15..997d5720 100644 --- a/src/main.ts +++ b/src/main.ts @@ -36,6 +36,7 @@ import { faFloppyDisk, faFolderOpen, faGift, + faGlobe, faHand, faHouseChimney, faLocationDot, @@ -86,6 +87,7 @@ library.add( faFloppyDisk, faFolderOpen, faGift, + faGlobe, faHand, faHouseChimney, faLocationDot, diff --git a/src/views/NewEditProjectView.vue b/src/views/NewEditProjectView.vue index ec8f56e3..eaff9b00 100644 --- a/src/views/NewEditProjectView.vue +++ b/src/views/NewEditProjectView.vue @@ -40,6 +40,12 @@ {{ fullClaim.description.length }}/5000 max. characters
+ +
- Map View + >Map View + +
+
+ + {{ domainForWebsite(this.url) }}
@@ -272,6 +277,7 @@ import { accountsDB, db } from "@/db/index"; import { Contact } from "@/db/tables/contacts"; import { MASTER_SETTINGS_KEY, Settings } from "@/db/tables/settings"; import { accessToken } from "@/libs/crypto"; +import { isGlobalUri } from "@/libs/util"; import { didInfo, GiverInputInfo, @@ -314,6 +320,7 @@ export default class ProjectViewView extends Vue { timeSince = ""; truncatedDesc = ""; truncateLength = 40; + url = ""; async created() { await db.open(); @@ -415,6 +422,7 @@ export default class ProjectViewView extends Vue { this.truncatedDesc = this.description.slice(0, this.truncateLength); this.latitude = resp.data.claim?.location?.geo?.latitude || 0; this.longitude = resp.data.claim?.location?.geo?.longitude || 0; + this.url = resp.data.claim?.url || ""; } else if (resp.status === 404) { // actually, axios throws an error so we never get here this.$notify( @@ -651,5 +659,34 @@ export default class ProjectViewView extends Vue { iconForUnitCode(unitCode: string) { return this.UNIT_CODES[unitCode]?.faIcon || "question"; } + + // return an HTTPS URL if it's not a global URL + addScheme(url: string) { + if (!isGlobalUri(url)) { + return "https://" + url; + } + return url; + } + + // return just the domain for display, if possible + domainForWebsite(url: string) { + try { + const hostname = new URL(url).hostname; + console.log("hostname", hostname); + if (!hostname) { + // happens for non-http URLs + return url; + } else if (url.endsWith(hostname)) { + // it's just the domain + return hostname; + } else { + // there's more, but don't bother displaying the whole thing + return hostname + "..."; + } + } catch (error: unknown) { + // must not be a valid URL + return url; + } + } } From c6e10bfdad80d5e08d3c21897ca6413ed7a80220 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Tue, 5 Dec 2023 20:03:19 -0700 Subject: [PATCH 4/4] update tasks --- project.task.yaml | 40 +++++++++++++++++------------------ src/views/ProjectViewView.vue | 1 - 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/project.task.yaml b/project.task.yaml index 5e892183..3080bad9 100644 --- a/project.task.yaml +++ b/project.task.yaml @@ -13,15 +13,30 @@ tasks: - .5 If notifications are not enabled, add message to front page with link/button to enable -- Discuss whether the remaining tasks are worthwhile before MVP release. +- show VC details... somehow: + - .5 make a VC details page, or link to endorser.ch (including confirmations) + - 01 allow download of each VC (& confirmations, to show that they actually own their data) + - 04 allow user to download VCs, mine + ones I can see about me from others + - add VC confirmation? -- .5 make a VC details page, or link to endorser.ch (including confirmations) -- .3 Add URL for project +- Release Minimum Viable Product : + - generate new webpush.db entries, data/webpush.db private_key_hex & subscription_info & vapid_claims email + - .5 deploy endorser.ch server above Dec 1 (to get plan searches by names as well as descriptions) + - 08 thorough testing for errors & edge cases + - 01 ensure ability to recover server remotely, and add redundant access + - Turn off stats-world or ensure it's usable (eg. cannot zoom out too far and lose world, cannot screenshot). + - Add disclaimers. + - Switch default server to the public server. + - Deploy to a server. + - Ensure public server has limits that work for group adoption. + - Test PWA features on Android and iOS. + blocks: ref:https://raw.githubusercontent.com/trentlarson/lives-of-gifts/master/project.yaml#kickstarter%20for%20time + +- make identicons for contacts into more-memorable faces (and maybe change project identicons, too) +- allow some gives even if they aren't registered - .5 Add start date to project -- 01 allow download of each VC (& confirmations, to show that they actually own their data) - .3 check that Android shows "back" buttons on screens without bottom tray - .1 Make give description text box into something that expands as they type? -- 04 allow user to download claims, mine + ones I can see about me from others - .5 customize favicon assignee-group:ui - .2 Show a warning if both giver and recipient are the same (but still allow?) - 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 @@ -29,8 +44,6 @@ tasks: - .5 include the hash of the latest commit on help page next to version (maybe Trent's git-hash branch) - .5 remove references to localStorage for projectId (now that it's pulling from the path) - bug (that is hard to reproduce) - on the second 'give' recorded on prod it showed me as the agent -- make identicons for contacts into more-memorable faces (and maybe change project identicons, too) -- allow some gives even if they aren't registered - switch some checks for activeDid to check for isRegistered - .2 in SeedBackupView, don't load the mnemonic and keep it in memory; only load it when they click "show" - .5 fix cert generation on server (since it didn't happen automatically for Nov 30) @@ -46,19 +59,6 @@ tasks: - maybe - allow type annotations in World.js & landmarks.js (since we get this error - "Types are not supported by current JavaScript version") - 08 convert to cleaner implementation (maybe Drie -- https://github.com/janvorisek/drie) -- Release Minimum Viable Product : - - generate new webpush.db entries, data/webpush.db private_key_hex & subscription_info & vapid_claims email - - .5 deploy endorser.ch server above Dec 1 (to get plan searches by names as well as descriptions) - - 08 thorough testing for errors & edge cases - - 01 ensure ability to recover server remotely, and add redundant access - - Turn off stats-world or ensure it's usable (eg. cannot zoom out too far and lose world, cannot screenshot). - - Add disclaimers. - - Switch default server to the public server. - - Deploy to a server. - - Ensure public server has limits that work for group adoption. - - Test PWA features on Android and iOS. - blocks: ref:https://raw.githubusercontent.com/trentlarson/lives-of-gifts/master/project.yaml#kickstarter%20for%20time - - .5 show seed phrase in a QR code for transfer to another device - .5 on DiscoverView, switch to a filter UI (eg. just from friend - .5 don't show "Offer" on project screen if they aren't registered diff --git a/src/views/ProjectViewView.vue b/src/views/ProjectViewView.vue index 1087fa73..a72ff9d0 100644 --- a/src/views/ProjectViewView.vue +++ b/src/views/ProjectViewView.vue @@ -672,7 +672,6 @@ export default class ProjectViewView extends Vue { domainForWebsite(url: string) { try { const hostname = new URL(url).hostname; - console.log("hostname", hostname); if (!hostname) { // happens for non-http URLs return url;