From 174c37169f21e096764e7f47dbcaa05f1d0a154c Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Fri, 30 Aug 2024 20:37:36 -0600 Subject: [PATCH] jump from ideas directly into giving dialog choice --- src/components/GiftedDialog.vue | 21 ++-- src/components/GiftedPrompts.vue | 192 +++++++++++++++++-------------- src/libs/endorserServer.ts | 11 +- src/libs/util.ts | 5 + src/views/ClaimView.vue | 3 +- src/views/ContactGiftingView.vue | 11 +- src/views/ContactsView.vue | 5 +- src/views/HomeView.vue | 14 ++- src/views/ProjectViewView.vue | 5 +- 9 files changed, 149 insertions(+), 118 deletions(-) diff --git a/src/components/GiftedDialog.vue b/src/components/GiftedDialog.vue index b23400d3d..00256aa43 100644 --- a/src/components/GiftedDialog.vue +++ b/src/components/GiftedDialog.vue @@ -7,7 +7,7 @@
@@ -89,11 +89,7 @@ import { Vue, Component, Prop } from "vue-facing-decorator"; import { NotificationIface } from "@/constants/app"; -import { - createAndSubmitGive, - didInfo, - GiverReceiverInputInfo, -} from "@/libs/endorserServer"; +import { createAndSubmitGive, didInfo } from "@/libs/endorserServer"; import * as libsUtil from "@/libs/util"; import { accountsDB, db } from "@/db/index"; import { MASTER_SETTINGS_KEY, Settings } from "@/db/tables/settings"; @@ -114,25 +110,27 @@ export default class GiftedDialog extends Vue { callbackOnSuccess?: (amount: number) => void = () => {}; customTitle?: string; description = ""; - giver?: GiverReceiverInputInfo; // undefined means no identified giver agent + giver?: libsUtil.GiverReceiverInputInfo; // undefined means no identified giver agent isTrade = false; offerId = ""; - receiver?: GiverReceiverInputInfo; + prompt = ""; + receiver?: libsUtil.GiverReceiverInputInfo; unitCode = "HUR"; visible = false; libsUtil = libsUtil; async open( - giver?: GiverReceiverInputInfo, - receiver?: GiverReceiverInputInfo, + giver?: libsUtil.GiverReceiverInputInfo, + receiver?: libsUtil.GiverReceiverInputInfo, offerId?: string, customTitle?: string, + prompt?: string, callbackOnSuccess?: (amount: number) => void, ) { this.customTitle = customTitle; - this.description = ""; this.giver = giver; + this.prompt = prompt || ""; this.receiver = receiver; // if we show "given to user" selection, default checkbox to true this.amountInput = "0"; @@ -207,6 +205,7 @@ export default class GiftedDialog extends Vue { this.description = ""; this.giver = undefined; this.amountInput = "0"; + this.prompt = ""; this.unitCode = "HUR"; } diff --git a/src/components/GiftedPrompts.vue b/src/components/GiftedPrompts.vue index 798bbeece..626df71bc 100644 --- a/src/components/GiftedPrompts.vue +++ b/src/components/GiftedPrompts.vue @@ -19,12 +19,12 @@
- +

{{ IDEAS[currentIdeaIndex] }}

-
+

@@ -71,150 +71,168 @@ diff --git a/src/libs/endorserServer.ts b/src/libs/endorserServer.ts index 474740831..f230bdc99 100644 --- a/src/libs/endorserServer.ts +++ b/src/libs/endorserServer.ts @@ -8,7 +8,11 @@ import { DEFAULT_IMAGE_API_SERVER } from "@/constants/app"; import { Contact } from "@/db/tables/contacts"; import { accessToken, deriveAddress, nextDerivationPath } from "@/libs/crypto"; import { NonsensitiveDexie } from "@/db/index"; -import { getAccount, getPasskeyExpirationSeconds } from "@/libs/util"; +import { + getAccount, + getPasskeyExpirationSeconds, + GiverReceiverInputInfo, +} from "@/libs/util"; import { createEndorserJwtForKey, KeyMeta } from "@/libs/crypto/vc"; import { Account } from "@/db/tables/accounts"; @@ -32,11 +36,6 @@ export interface AgreeVerifiableCredential { object: Record; } -export interface GiverReceiverInputInfo { - did?: string; - name?: string; -} - export interface GiverOutputInfo { action: string; giver?: GiverReceiverInputInfo; diff --git a/src/libs/util.ts b/src/libs/util.ts index 9830ee78b..ada548e78 100644 --- a/src/libs/util.ts +++ b/src/libs/util.ts @@ -25,6 +25,11 @@ import { KeyMeta } from "@/libs/crypto/vc"; import { createPeerDid } from "@/libs/crypto/vc/didPeer"; import { registerCredential } from "@/libs/crypto/vc/passkeyDidPeer"; +export interface GiverReceiverInputInfo { + did?: string; + name?: string; +} + export const PRIVACY_MESSAGE = "The data you send will be visible to the world -- except: your IDs and the IDs of anyone you tag will stay private, only visible to them and others you explicitly allow."; export const SHARED_PHOTO_BASE64_KEY = "shared-photo-base64"; diff --git a/src/views/ClaimView.vue b/src/views/ClaimView.vue index 85bbb572f..9d317fb5f 100644 --- a/src/views/ClaimView.vue +++ b/src/views/ClaimView.vue @@ -463,7 +463,6 @@ import QuickNav from "@/components/QuickNav.vue"; import { Account } from "@/db/tables/accounts"; import { GenericCredWrapper, - GiverReceiverInputInfo, OfferVerifiableCredential, } from "@/libs/endorserServer"; @@ -811,7 +810,7 @@ export default class ClaimView extends Vue { } openFulfillGiftDialog() { - const giver: GiverReceiverInputInfo = { + const giver: libsUtil.GiverReceiverInputInfo = { did: libsUtil.offerGiverDid( this.veriClaim as GenericCredWrapper, ), diff --git a/src/views/ContactGiftingView.vue b/src/views/ContactGiftingView.vue index f96d97ec7..1c2abfe15 100644 --- a/src/views/ContactGiftingView.vue +++ b/src/views/ContactGiftingView.vue @@ -11,8 +11,7 @@ class="text-lg text-center px-2 py-1 absolute -left-2 -top-1" > - - Give to Contacts + Given by...

@@ -72,6 +71,7 @@