forked from trent_larson/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:
@@ -54,6 +54,7 @@ import { generateEndorserJwtUrlForAccount } from "../libs/endorserServer";
|
||||
import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin";
|
||||
import { Settings } from "@/db/tables/settings";
|
||||
import { Account } from "@/db/tables/accounts";
|
||||
import { createNotifyHelpers, TIMEOUTS } from "@/utils/notify";
|
||||
|
||||
// Constants for magic numbers
|
||||
const NOTIFICATION_TIMEOUTS = {
|
||||
@@ -74,6 +75,8 @@ export default class ShareMyContactInfoView extends Vue {
|
||||
$notify!: (notification: NotificationIface, timeout?: number) => void;
|
||||
$router!: Router;
|
||||
|
||||
notify!: ReturnType<typeof createNotifyHelpers>;
|
||||
|
||||
// Component state
|
||||
isLoading = false;
|
||||
|
||||
@@ -81,6 +84,7 @@ export default class ShareMyContactInfoView extends Vue {
|
||||
* Main share functionality - orchestrates the contact sharing process
|
||||
*/
|
||||
async onClickShare(): Promise<void> {
|
||||
this.notify = createNotifyHelpers(this.$notify);
|
||||
this.isLoading = true;
|
||||
|
||||
try {
|
||||
@@ -149,27 +153,17 @@ export default class ShareMyContactInfoView extends Vue {
|
||||
* Show success notifications after copying
|
||||
*/
|
||||
private async showSuccessNotifications(): Promise<void> {
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
type: "info",
|
||||
title: "Copied",
|
||||
text: "Your contact info was copied to the clipboard. Have them click on it, or paste it in the box on their 'Contacts' screen.",
|
||||
},
|
||||
NOTIFICATION_TIMEOUTS.COPY_SUCCESS,
|
||||
this.notify.copied(
|
||||
"contact info",
|
||||
TIMEOUTS.LONG,
|
||||
);
|
||||
|
||||
const numContacts = await this.$contactCount();
|
||||
if (numContacts > 0) {
|
||||
setTimeout(() => {
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
type: "success",
|
||||
title: "Share Other Contacts",
|
||||
text: "You may want to share some of your contacts with them. Select them below to copy and send.",
|
||||
},
|
||||
NOTIFICATION_TIMEOUTS.SHARE_CONTACTS,
|
||||
this.notify.success(
|
||||
"You may want to share some of your contacts with them. Select them below to copy and send.",
|
||||
TIMEOUTS.VERY_LONG,
|
||||
);
|
||||
}, DELAYS.SHARE_CONTACTS_DELAY);
|
||||
}
|
||||
@@ -186,14 +180,9 @@ export default class ShareMyContactInfoView extends Vue {
|
||||
* Show account not found error
|
||||
*/
|
||||
private showAccountError(): void {
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
type: "error",
|
||||
title: "Error",
|
||||
text: "No account was found for the active DID.",
|
||||
},
|
||||
NOTIFICATION_TIMEOUTS.ERROR,
|
||||
this.notify.error(
|
||||
"No account was found for the active DID.",
|
||||
TIMEOUTS.LONG,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -201,14 +190,9 @@ export default class ShareMyContactInfoView extends Vue {
|
||||
* Show generic error notification
|
||||
*/
|
||||
private showGenericError(): void {
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
type: "error",
|
||||
title: "Error",
|
||||
text: "There was a problem sharing your contact information. Please try again.",
|
||||
},
|
||||
NOTIFICATION_TIMEOUTS.ERROR,
|
||||
this.notify.error(
|
||||
"There was a problem sharing your contact information. Please try again.",
|
||||
TIMEOUTS.LONG,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user