From 51149ebb049d02ca23884bd48a241e9501441818 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Thu, 24 Oct 2024 20:04:08 -0600 Subject: [PATCH] suggest new user going to the front page --- src/components/InviteDialog.vue | 2 +- src/views/ContactsView.vue | 21 ++++++++++++++++++++- src/views/InviteOneView.vue | 25 ++++++++++++++++++++----- test-playwright/00-noid-tests.spec.ts | 2 +- 4 files changed, 42 insertions(+), 8 deletions(-) diff --git a/src/components/InviteDialog.vue b/src/components/InviteDialog.vue index a9a4eba..b2bca57 100644 --- a/src/components/InviteDialog.vue +++ b/src/components/InviteDialog.vue @@ -58,7 +58,7 @@ export default class InviteDialog extends Vue { inviteIdentifier = ""; text = ""; visible = false; - expiresAt = new Date(Date.now() + 1000 * 60 * 60 * 24 * 30 * 3) + expiresAt = new Date(Date.now() + 1000 * 60 * 60 * 24 * 7) .toISOString() .substring(0, 10); diff --git a/src/views/ContactsView.vue b/src/views/ContactsView.vue index b3f63b4..5fc815d 100644 --- a/src/views/ContactsView.vue +++ b/src/views/ContactsView.vue @@ -454,21 +454,25 @@ export default class ContactsView extends Vue { decodeEndorserJwt(importedInviteJwt).payload; const registration = payload as VerifiableCredential; (this.$refs.contactNameDialog as ContactNameDialog).open( - "Contact Name", + "Who Invited You?", "", (name) => { + // not doing await on purpose, so that they always see the onboarding this.addContact({ did: registration.vc.credentialSubject.agent.identifier, name: name, registered: true, }); + this.showOnboardingInfo(); }, () => { + // not doing await on purpose, so that they always see the onboarding this.addContact({ did: registration.vc.credentialSubject.agent.identifier, name: "(person who invited you)", registered: true, }); + this.showOnboardingInfo(); }, ); // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -513,6 +517,21 @@ export default class ContactsView extends Vue { ); } + private showOnboardingInfo() { + this.$notify( + { + group: "modal", + type: "confirm", + title: "They're Added To Your List", + text: "Would you like to go to the main page now?", + onYes: async () => { + (this.$router as Router).push({ name: "home" }); + }, + }, + -1, + ); + } + private filteredContacts() { return this.showGiveNumbers ? this.contactsSelected.length === 0 diff --git a/src/views/InviteOneView.vue b/src/views/InviteOneView.vue index b123c97..55faa6c 100644 --- a/src/views/InviteOneView.vue +++ b/src/views/InviteOneView.vue @@ -46,7 +46,10 @@ > @@ -201,20 +210,26 @@ export default class InviteOneView extends Vue { ); } - showInvite(inviteId: string) { + showInvite(inviteId: string, redeemed: boolean, expired: boolean) { + let message = `Your clipboard now contains the invite ID ${inviteId}`; + if (redeemed) { + message += " (This invite has been used.)"; + } else if (expired) { + message += " (This invite has expired.)"; + } useClipboard().copy(inviteId); this.$notify( { group: "alert", type: "success", title: "Copied", - text: `The link has been used, but your clipboard now contains the invite ID ${inviteId}`, + text: message, }, 5000, ); } - lookForErrorAndNotify(error, title, defaultMessage) { + lookForErrorAndNotify(error, title: string, defaultMessage: string) { console.error(title, "-", error); let message = defaultMessage; if (error.response && error.response.data && error.response.data.error) { diff --git a/test-playwright/00-noid-tests.spec.ts b/test-playwright/00-noid-tests.spec.ts index 23419e7..2e518a8 100644 --- a/test-playwright/00-noid-tests.spec.ts +++ b/test-playwright/00-noid-tests.spec.ts @@ -1,7 +1,7 @@ import { test, expect } from '@playwright/test'; import { deleteContact, generateAndRegisterEthrUser, importUser } from './testUtils'; -test('Check activity feed', async ({ page }) => { +test('Check activity feed - check that server is running', async ({ page }) => { // Load app homepage await page.goto('./'); await page.getByTestId('closeOnboardingAndFinish').click();