Browse Source

suggest new user going to the front page

Trent Larson 4 weeks ago
parent
commit
51149ebb04
  1. 2
      src/components/InviteDialog.vue
  2. 21
      src/views/ContactsView.vue
  3. 25
      src/views/InviteOneView.vue
  4. 2
      test-playwright/00-noid-tests.spec.ts

2
src/components/InviteDialog.vue

@ -58,7 +58,7 @@ export default class InviteDialog extends Vue {
inviteIdentifier = ""; inviteIdentifier = "";
text = ""; text = "";
visible = false; visible = false;
expiresAt = new Date(Date.now() + 1000 * 60 * 60 * 24 * 30 * 3) expiresAt = new Date(Date.now() + 1000 * 60 * 60 * 24 * 7)
.toISOString() .toISOString()
.substring(0, 10); .substring(0, 10);

21
src/views/ContactsView.vue

@ -454,21 +454,25 @@ export default class ContactsView extends Vue {
decodeEndorserJwt(importedInviteJwt).payload; decodeEndorserJwt(importedInviteJwt).payload;
const registration = payload as VerifiableCredential; const registration = payload as VerifiableCredential;
(this.$refs.contactNameDialog as ContactNameDialog).open( (this.$refs.contactNameDialog as ContactNameDialog).open(
"Contact Name", "Who Invited You?",
"", "",
(name) => { (name) => {
// not doing await on purpose, so that they always see the onboarding
this.addContact({ this.addContact({
did: registration.vc.credentialSubject.agent.identifier, did: registration.vc.credentialSubject.agent.identifier,
name: name, name: name,
registered: true, registered: true,
}); });
this.showOnboardingInfo();
}, },
() => { () => {
// not doing await on purpose, so that they always see the onboarding
this.addContact({ this.addContact({
did: registration.vc.credentialSubject.agent.identifier, did: registration.vc.credentialSubject.agent.identifier,
name: "(person who invited you)", name: "(person who invited you)",
registered: true, registered: true,
}); });
this.showOnboardingInfo();
}, },
); );
// eslint-disable-next-line @typescript-eslint/no-explicit-any // 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() { private filteredContacts() {
return this.showGiveNumbers return this.showGiveNumbers
? this.contactsSelected.length === 0 ? this.contactsSelected.length === 0

25
src/views/InviteOneView.vue

@ -46,7 +46,10 @@
> >
<td> <td>
<span <span
v-if="!invite.redeemedAt" v-if="
!invite.redeemedAt &&
invite.expiresAt > new Date().toISOString()
"
@click=" @click="
copyInviteAndNotify(invite.inviteIdentifier, invite.jwt) copyInviteAndNotify(invite.inviteIdentifier, invite.jwt)
" "
@ -57,7 +60,13 @@
</span> </span>
<span <span
v-else v-else
@click="showInvite(invite.inviteIdentifier)" @click="
showInvite(
invite.inviteIdentifier,
!!invite.redeemedAt,
invite.expiresAt < new Date().toISOString(),
)
"
class="text-center text-slate-500 cursor-pointer" class="text-center text-slate-500 cursor-pointer"
:title="inviteLink(invite.jwt)" :title="inviteLink(invite.jwt)"
> >
@ -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); useClipboard().copy(inviteId);
this.$notify( this.$notify(
{ {
group: "alert", group: "alert",
type: "success", type: "success",
title: "Copied", title: "Copied",
text: `The link has been used, but your clipboard now contains the invite ID ${inviteId}`, text: message,
}, },
5000, 5000,
); );
} }
lookForErrorAndNotify(error, title, defaultMessage) { lookForErrorAndNotify(error, title: string, defaultMessage: string) {
console.error(title, "-", error); console.error(title, "-", error);
let message = defaultMessage; let message = defaultMessage;
if (error.response && error.response.data && error.response.data.error) { if (error.response && error.response.data && error.response.data.error) {

2
test-playwright/00-noid-tests.spec.ts

@ -1,7 +1,7 @@
import { test, expect } from '@playwright/test'; import { test, expect } from '@playwright/test';
import { deleteContact, generateAndRegisterEthrUser, importUser } from './testUtils'; 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 // Load app homepage
await page.goto('./'); await page.goto('./');
await page.getByTestId('closeOnboardingAndFinish').click(); await page.getByTestId('closeOnboardingAndFinish').click();

Loading…
Cancel
Save