fix bad link to project page, fix improper action on invite-add-contact cancel
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "TimeSafari",
|
||||
"version": "0.3.29",
|
||||
"version": "0.3.30-beta",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"serve": "vite preview",
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
<template>
|
||||
<div v-if="visible" class="dialog-overlay">
|
||||
<div class="dialog">
|
||||
<h1 class="text-xl font-bold text-center mb-4">Contact Name</h1>
|
||||
<h1 class="text-xl font-bold text-center mb-4">{{ title }}</h1>
|
||||
{{ message }}
|
||||
Note that their name is only stored on this device.
|
||||
<input
|
||||
type="text"
|
||||
@@ -38,23 +39,38 @@ import { Vue, Component } from "vue-facing-decorator";
|
||||
|
||||
@Component
|
||||
export default class ContactNameDialog extends Vue {
|
||||
callback: (name?: string) => void = () => {};
|
||||
cancelCallback: () => void = () => {};
|
||||
saveCallback: (name?: string) => void = () => {};
|
||||
message = "";
|
||||
newText = "";
|
||||
title = "Contact Name";
|
||||
visible = false;
|
||||
|
||||
async open(aCallback?: (name?: string) => void) {
|
||||
this.callback = aCallback || this.callback;
|
||||
async open(
|
||||
title?: string,
|
||||
message?: string,
|
||||
saveCallback?: (name: string) => void,
|
||||
cancelCallback?: () => void,
|
||||
) {
|
||||
this.cancelCallback = cancelCallback || this.cancelCallback;
|
||||
this.saveCallback = saveCallback || this.saveCallback;
|
||||
this.message = message ?? this.message;
|
||||
this.title = title ?? this.title;
|
||||
this.visible = true;
|
||||
}
|
||||
|
||||
async onClickSaveChanges() {
|
||||
this.visible = false;
|
||||
this.callback(this.newText);
|
||||
if (this.saveCallback) {
|
||||
this.saveCallback(this.newText);
|
||||
}
|
||||
}
|
||||
|
||||
onClickCancel() {
|
||||
this.visible = false;
|
||||
this.callback();
|
||||
if (this.cancelCallback) {
|
||||
this.cancelCallback();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1135,16 +1135,16 @@ export default class AccountViewView extends Vue {
|
||||
* @param {Error} error - The error object.
|
||||
*/
|
||||
private handleExportError(error: unknown) {
|
||||
console.error("Export Error:", error);
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
type: "danger",
|
||||
title: "Export Error",
|
||||
text: "See console logs for more info.",
|
||||
text: "There was an error exporting the data.",
|
||||
},
|
||||
-1,
|
||||
);
|
||||
console.error("Export Error:", error);
|
||||
}
|
||||
|
||||
async uploadImportFile(event: Event) {
|
||||
|
||||
@@ -87,7 +87,7 @@ export default class ClaimAddRawView extends Vue {
|
||||
group: "alert",
|
||||
type: "danger",
|
||||
title: "Error",
|
||||
text: "There was a problem submitting the claim. See logs for more info.",
|
||||
text: "There was a problem submitting the claim.",
|
||||
},
|
||||
-1,
|
||||
);
|
||||
|
||||
@@ -36,21 +36,6 @@
|
||||
</button>
|
||||
</h2>
|
||||
<div class="text-sm">
|
||||
<div>
|
||||
{{ veriClaim.id }}
|
||||
<button
|
||||
@click="
|
||||
libsUtil.doCopyTwoSecRedo(
|
||||
veriClaim.id as string,
|
||||
() => (showIdCopy = !showIdCopy),
|
||||
)
|
||||
"
|
||||
class="ml-2 mr-2"
|
||||
>
|
||||
<fa icon="copy" class="text-slate-400 fa-fw" />
|
||||
</button>
|
||||
<span v-show="showIdCopy">Copied ID</span>
|
||||
</div>
|
||||
<div data-testId="description">
|
||||
<fa icon="message" class="fa-fw text-slate-400" />
|
||||
{{
|
||||
@@ -88,7 +73,7 @@
|
||||
|
||||
<div v-if="veriClaim.claimType === 'PlanAction'" class="mt-4">
|
||||
<router-link
|
||||
:to="'/project/' + encodeURIComponent(veriClaim.id)"
|
||||
:to="'/project/' + encodeURIComponent(veriClaim.handleId)"
|
||||
class="text-blue-500 mt-2"
|
||||
>
|
||||
Go to Project page
|
||||
@@ -788,7 +773,7 @@ export default class ClaimView extends Vue {
|
||||
group: "alert",
|
||||
type: "danger",
|
||||
title: "Error",
|
||||
text: "There was a problem getting that claim. See logs for more info.",
|
||||
text: "There was a problem getting that claim.",
|
||||
},
|
||||
-1,
|
||||
);
|
||||
@@ -810,7 +795,7 @@ export default class ClaimView extends Vue {
|
||||
group: "alert",
|
||||
type: "danger",
|
||||
title: "Error",
|
||||
text: "Something went wrong retrieving that claim. See logs for more info.",
|
||||
text: "Something went wrong retrieving that claim.",
|
||||
},
|
||||
-1,
|
||||
);
|
||||
@@ -873,7 +858,7 @@ export default class ClaimView extends Vue {
|
||||
group: "alert",
|
||||
type: "danger",
|
||||
title: "Error",
|
||||
text: "There was a problem submitting the confirmation. See logs for more info.",
|
||||
text: "There was a problem submitting the confirmation.",
|
||||
},
|
||||
-1,
|
||||
);
|
||||
|
||||
@@ -762,7 +762,7 @@ export default class ClaimView extends Vue {
|
||||
group: "alert",
|
||||
type: "danger",
|
||||
title: "Error",
|
||||
text: "There was a problem submitting the confirmation. See logs for more info.",
|
||||
text: "There was a problem submitting the confirmation.",
|
||||
},
|
||||
5000,
|
||||
);
|
||||
|
||||
@@ -278,7 +278,7 @@ export default class ContactAmountssView extends Vue {
|
||||
(origClaim.object?.amountOfThisGood as number) || 1;
|
||||
}
|
||||
} catch (error) {
|
||||
let userMessage = "There was an error. See logs for more info.";
|
||||
let userMessage = "There was an error.";
|
||||
const serverError = error as AxiosError;
|
||||
if (serverError) {
|
||||
if (serverError.message) {
|
||||
|
||||
@@ -362,7 +362,7 @@ export default class ContactQRScanShow extends Vue {
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error when registering:", error);
|
||||
let userMessage = "There was an error. See logs for more info.";
|
||||
let userMessage = "There was an error.";
|
||||
const serverError = error as AxiosError;
|
||||
if (serverError) {
|
||||
if (serverError.response?.data?.error?.message) {
|
||||
|
||||
@@ -453,12 +453,23 @@ export default class ContactsView extends Vue {
|
||||
const payload: JWTPayload =
|
||||
decodeEndorserJwt(importedInviteJwt).payload;
|
||||
const registration = payload as VerifiableCredential;
|
||||
(this.$refs.contactNameDialog as ContactNameDialog).open((name) =>
|
||||
this.addContact({
|
||||
did: registration.vc.credentialSubject.agent.identifier,
|
||||
name: name, // may be undefined if they cancel
|
||||
registered: true,
|
||||
}),
|
||||
(this.$refs.contactNameDialog as ContactNameDialog).open(
|
||||
"Contact Name",
|
||||
"",
|
||||
(name) => {
|
||||
this.addContact({
|
||||
did: registration.vc.credentialSubject.agent.identifier,
|
||||
name: name,
|
||||
registered: true,
|
||||
});
|
||||
},
|
||||
() => {
|
||||
this.addContact({
|
||||
did: registration.vc.credentialSubject.agent.identifier,
|
||||
name: "(person who invited you)",
|
||||
registered: true,
|
||||
});
|
||||
},
|
||||
);
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (error: any) {
|
||||
@@ -945,7 +956,7 @@ export default class ContactsView extends Vue {
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error when registering:", error);
|
||||
let userMessage = "There was an error. See logs for more info.";
|
||||
let userMessage = "There was an error.";
|
||||
const serverError = error as AxiosError;
|
||||
if (serverError.isAxiosError) {
|
||||
if (
|
||||
|
||||
@@ -163,6 +163,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Edit Name Dialog, maybe should be replaced by ContactNameDialog -->
|
||||
<div v-if="contactEdit" class="dialog-overlay">
|
||||
<div class="dialog">
|
||||
<h1 class="text-xl font-bold text-center mb-4">Edit Name</h1>
|
||||
@@ -439,7 +440,7 @@ export default class DIDView extends Vue {
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error when registering:", error);
|
||||
let userMessage = "There was an error. See logs for more info.";
|
||||
let userMessage = "There was an error.";
|
||||
const serverError = error as AxiosError;
|
||||
if (serverError) {
|
||||
if (serverError.response?.data?.error?.message) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -566,35 +566,22 @@ export default class ProjectViewView extends Vue {
|
||||
group: "alert",
|
||||
type: "danger",
|
||||
title: "Error",
|
||||
text: "There was a problem getting that project. See logs for more info.",
|
||||
text: "There was a problem getting that project.",
|
||||
},
|
||||
5000,
|
||||
);
|
||||
}
|
||||
} catch (error: unknown) {
|
||||
console.error("Error retrieving project:", error);
|
||||
const serverError = error as AxiosError;
|
||||
if (serverError.response?.status === 404) {
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
type: "danger",
|
||||
title: "Error",
|
||||
text: "That project does not exist.",
|
||||
},
|
||||
5000,
|
||||
);
|
||||
} else {
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
type: "danger",
|
||||
title: "Error",
|
||||
text: "Something went wrong retrieving that project. See logs for more info.",
|
||||
},
|
||||
5000,
|
||||
);
|
||||
}
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
type: "danger",
|
||||
title: "Error",
|
||||
text: "Something went wrong retrieving that project.",
|
||||
},
|
||||
5000,
|
||||
);
|
||||
}
|
||||
|
||||
this.loadGives();
|
||||
@@ -1011,7 +998,7 @@ export default class ProjectViewView extends Vue {
|
||||
console.error("Got error submitting the confirmation:", result);
|
||||
const message =
|
||||
(result.error?.error as string) ||
|
||||
"There was a problem submitting the confirmation. See logs for more info.";
|
||||
"There was a problem submitting the confirmation.";
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
|
||||
Reference in New Issue
Block a user