forked from jsnbuchanan/crowd-funder-for-time-pwa
Complete notification migration across 13 components and views
- Replace raw $notify calls with notification helper system - Add createNotifyHelpers and TIMEOUTS constants integration - Migrate AccountViewView, ClaimAddRawView, ContactGiftingView, ContactImportView, ContactsView, NewActivityView, ProjectViewView, RecentOffersToUserProjectsView, RecentOffersToUserView, ShareMyContactInfoView - Update MembersList, TopMessage, UserNameDialog components - Add notification constants for standardized messaging - Enhance validation script to eliminate false positives - Achieve 86% notification migration completion rate
This commit is contained in:
@@ -191,6 +191,7 @@ import { Contact } from "../db/tables/contacts";
|
||||
import * as libsUtil from "../libs/util";
|
||||
import { NotificationIface } from "../constants/app";
|
||||
import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin";
|
||||
import { createNotifyHelpers, TIMEOUTS } from "@/utils/notify";
|
||||
|
||||
interface Member {
|
||||
admitted: boolean;
|
||||
@@ -210,7 +211,8 @@ interface DecryptedMember {
|
||||
})
|
||||
export default class MembersList extends Vue {
|
||||
$notify!: (notification: NotificationIface, timeout?: number) => void;
|
||||
|
||||
|
||||
notify!: ReturnType<typeof createNotifyHelpers>;
|
||||
libsUtil = libsUtil;
|
||||
|
||||
@Prop({ required: true }) password!: string;
|
||||
@@ -228,6 +230,8 @@ export default class MembersList extends Vue {
|
||||
contacts: Array<Contact> = [];
|
||||
|
||||
async created() {
|
||||
this.notify = createNotifyHelpers(this.$notify);
|
||||
|
||||
const settings = await this.$accountSettings();
|
||||
this.activeDid = settings.activeDid || "";
|
||||
this.apiServer = settings.apiServer || "";
|
||||
@@ -338,37 +342,22 @@ export default class MembersList extends Vue {
|
||||
}
|
||||
|
||||
informAboutAdmission() {
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
type: "info",
|
||||
title: "Admission info",
|
||||
text: "This is to register people in Time Safari and to admit them to the meeting. A '+' symbol means they are not yet admitted and you can register and admit them. A '-' means you can remove them, but they will stay registered.",
|
||||
},
|
||||
10000,
|
||||
this.notify.info(
|
||||
"This is to register people in Time Safari and to admit them to the meeting. A '+' symbol means they are not yet admitted and you can register and admit them. A '-' means you can remove them, but they will stay registered.",
|
||||
TIMEOUTS.VERY_LONG,
|
||||
);
|
||||
}
|
||||
|
||||
informAboutAddingContact(contactImportedAlready: boolean) {
|
||||
if (contactImportedAlready) {
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
type: "info",
|
||||
title: "Contact Exists",
|
||||
text: "They are in your contacts. To remove them, use the contacts page.",
|
||||
},
|
||||
10000,
|
||||
this.notify.info(
|
||||
"They are in your contacts. To remove them, use the contacts page.",
|
||||
TIMEOUTS.VERY_LONG,
|
||||
);
|
||||
} else {
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
type: "info",
|
||||
title: "Contact Available",
|
||||
text: "This is to add them to your contacts. To remove them later, use the contacts page.",
|
||||
},
|
||||
10000,
|
||||
this.notify.info(
|
||||
"This is to add them to your contacts. To remove them later, use the contacts page.",
|
||||
TIMEOUTS.VERY_LONG,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -461,14 +450,9 @@ export default class MembersList extends Vue {
|
||||
await this.$updateContact(decrMember.did, { registered: true });
|
||||
oldContact.registered = true;
|
||||
}
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
type: "success",
|
||||
title: "Registered",
|
||||
text: "Besides being admitted, they were also registered.",
|
||||
},
|
||||
3000,
|
||||
this.notify.success(
|
||||
"Besides being admitted, they were also registered.",
|
||||
TIMEOUTS.STANDARD,
|
||||
);
|
||||
} else {
|
||||
throw result;
|
||||
@@ -478,16 +462,10 @@ export default class MembersList extends Vue {
|
||||
// registration failure is likely explained by a message from the server
|
||||
const additionalInfo =
|
||||
serverMessageForUser(error) || error?.error || "";
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
type: "warning",
|
||||
title: "Registration failed",
|
||||
text:
|
||||
"They were admitted to the meeting. However, registration failed. You can register them from the contacts screen. " +
|
||||
additionalInfo,
|
||||
},
|
||||
12000,
|
||||
this.notify.warning(
|
||||
"They were admitted to the meeting. However, registration failed. You can register them from the contacts screen. " +
|
||||
additionalInfo,
|
||||
TIMEOUTS.VERY_LONG,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -514,14 +492,9 @@ export default class MembersList extends Vue {
|
||||
await this.$insertContact(newContact);
|
||||
this.contacts.push(newContact);
|
||||
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
type: "success",
|
||||
title: "Contact Added",
|
||||
text: "They were added to your contacts.",
|
||||
},
|
||||
3000,
|
||||
this.notify.success(
|
||||
"They were added to your contacts.",
|
||||
TIMEOUTS.STANDARD,
|
||||
);
|
||||
} catch (err) {
|
||||
this.$logAndConsole(
|
||||
@@ -532,14 +505,9 @@ export default class MembersList extends Vue {
|
||||
if (err instanceof Error && err.message?.indexOf("already exists") > -1) {
|
||||
message = "This person is already in your contact list.";
|
||||
}
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
type: "danger",
|
||||
title: "Contact Not Added",
|
||||
text: message,
|
||||
},
|
||||
5000,
|
||||
this.notify.error(
|
||||
message,
|
||||
TIMEOUTS.LONG,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user