fix bad link to project page, fix improper action on invite-add-contact cancel

This commit is contained in:
2024-10-12 20:55:55 -06:00
parent 9c527b27f8
commit 6f880d0df1
12 changed files with 125 additions and 94 deletions

View File

@@ -42,22 +42,35 @@
<tr
v-for="invite in invites"
:key="invite.inviteIdentifier"
class="border-t"
class="border-t py-2"
>
<td
class="py-2 text-center text-blue-500 cursor-pointer"
@click="copyInviteAndNotify(invite.inviteIdentifier, invite.jwt)"
title="{{ inviteLink(invite.jwt) }}"
>
{{ getTruncatedInviteId(invite.inviteIdentifier) }}
<td>
<span
v-if="!invite.redeemedAt"
@click="
copyInviteAndNotify(invite.inviteIdentifier, invite.jwt)
"
class="text-center text-blue-500 cursor-pointer"
:title="inviteLink(invite.jwt)"
>
{{ getTruncatedInviteId(invite.inviteIdentifier) }}
</span>
<span
v-else
@click="showInvite(invite.inviteIdentifier)"
class="text-center text-slate-500 cursor-pointer"
:title="inviteLink(invite.jwt)"
>
{{ getTruncatedInviteId(invite.inviteIdentifier) }}
</span>
</td>
<td class="py-2 text-left" :data-testId="inviteLink(invite.jwt)">
<td class="text-left" :data-testId="inviteLink(invite.jwt)">
{{ invite.notes }}
</td>
<td class="py-2 text-center">
<td class="text-center">
{{ invite.expiresAt.substring(0, 10) }}
</td>
<td class="py-2 text-center">
<td class="text-center">
{{ invite.redeemedAt?.substring(0, 10) }}
<br />
{{ getTruncatedRedeemedBy(invite.redeemedBy) }}
@@ -159,7 +172,7 @@ export default class InviteOneView extends Vue {
getTruncatedInviteId(inviteId: string): string {
if (inviteId.length <= 9) return inviteId;
return `${inviteId.slice(0, 3)}...${inviteId.slice(-3)}`;
return `${inviteId.slice(0, 6)}...`;
}
getTruncatedRedeemedBy(redeemedBy: string | null): string {
@@ -174,6 +187,7 @@ export default class InviteOneView extends Vue {
inviteLink(jwt: string): string {
return APP_SERVER + "/contacts?inviteJwt=" + jwt;
}
copyInviteAndNotify(inviteId: string, jwt: string) {
useClipboard().copy(this.inviteLink(jwt));
this.$notify(
@@ -187,6 +201,19 @@ export default class InviteOneView extends Vue {
);
}
showInvite(inviteId: string) {
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}`,
},
5000,
);
}
lookForErrorAndNotify(error, title, defaultMessage) {
console.error(title, "-", error);
let message = defaultMessage;
@@ -258,25 +285,29 @@ export default class InviteOneView extends Vue {
}
addNewContact(did) {
(this.$refs.contactNameDialog as ContactNameDialog).open((name) => {
// the person obviously registered themselves and this user already granted visibility, so we just add them
const contact = {
did: did,
name: name,
registered: true,
};
db.contacts.add(contact);
this.contactsRedeemed[did] = contact;
this.$notify(
{
group: "alert",
type: "success",
title: "Contact Added",
text: `${name} has been added to your contacts.`,
},
3000,
);
});
(this.$refs.contactNameDialog as ContactNameDialog).open(
"Who Sent You The Invite?",
"Their name will be added to your contact list.",
(name) => {
// the person obviously registered themselves and this user already granted visibility, so we just add them
const contact = {
did: did,
name: name,
registered: true,
};
db.contacts.add(contact);
this.contactsRedeemed[did] = contact;
this.$notify(
{
group: "alert",
type: "success",
title: "Contact Added",
text: `${name} has been added to your contacts.`,
},
3000,
);
},
);
}
deleteInvite(inviteId: string, notes: string) {