forked from jsnbuchanan/crowd-funder-for-time-pwa
Refactor ContactsView.vue to use notification constants
- Extracted all inline notification and danger messages to src/constants/notifications.ts - Added 20+ new notification constants and 2 template functions for dynamic messages - Replaced all notify and danger calls with references to new constants/templates - Updated imports for notification constants/templates and removed unused imports - Fixed all linter errors - all notification messages now use single source of truth - All $notify calls now use constants (remaining 3 are complex modals requiring raw calls)
This commit is contained in:
@@ -123,6 +123,17 @@ export const NOTIFY_UNCONFIRMED_HOURS = {
|
||||
message: "Would you like to confirm some of those hours?",
|
||||
};
|
||||
|
||||
// Dynamic message template for unconfirmed hours (used in ContactsView.vue)
|
||||
export const NOTIFY_UNCONFIRMED_HOURS_DYNAMIC = {
|
||||
title: "Unconfirmed Hours",
|
||||
// Template: "There {is/are} {count} unconfirmed {hour/hours} from them. Would you like to confirm some of those hours?"
|
||||
getMessage: (count: number): string => {
|
||||
const isAre = count === 1 ? "is" : "are";
|
||||
const hours = count === 1 ? "hour" : "hours";
|
||||
return `There ${isAre} ${count} unconfirmed ${hours} from them. Would you like to confirm some of those hours?`;
|
||||
},
|
||||
};
|
||||
|
||||
// Complex modal constants (for raw $notify calls with advanced features)
|
||||
// MembersList.vue complex modals
|
||||
export const NOTIFY_ADD_CONTACT_FIRST = {
|
||||
@@ -284,3 +295,143 @@ export const NOTIFY_PHOTO_PROCESSING_ERROR = {
|
||||
title: "Processing Error",
|
||||
message: "Failed to process image. Please try again.",
|
||||
};
|
||||
|
||||
// OnboardMeetingSetupView.vue constants
|
||||
export const NOTIFY_MEETING_INVALID_TIME = {
|
||||
title: "Invalid Time",
|
||||
message: "Select a future time for the meeting expiration.",
|
||||
};
|
||||
|
||||
export const NOTIFY_MEETING_NAME_REQUIRED = {
|
||||
title: "Invalid Name",
|
||||
message: "Please enter your name.",
|
||||
};
|
||||
|
||||
export const NOTIFY_MEETING_PASSWORD_REQUIRED = {
|
||||
title: "Invalid Password",
|
||||
message: "Please enter a password.",
|
||||
};
|
||||
|
||||
export const NOTIFY_MEETING_CREATED = {
|
||||
title: "Success",
|
||||
message: "Meeting created.",
|
||||
};
|
||||
|
||||
export const NOTIFY_MEETING_DELETED = {
|
||||
title: "Success",
|
||||
message: "Meeting deleted successfully.",
|
||||
};
|
||||
|
||||
export const NOTIFY_MEETING_LINK_COPIED = {
|
||||
title: "Copied",
|
||||
message: "The member link is copied to the clipboard.",
|
||||
};
|
||||
|
||||
// ContactsView.vue extracted notification messages
|
||||
export const NOTIFY_CONTACT_NO_INFO = {
|
||||
title: "No Contact Info",
|
||||
message: "There was no contact info to add. Try the other green buttons.",
|
||||
};
|
||||
|
||||
export const NOTIFY_CONTACT_INVALID_URL = {
|
||||
title: "Invalid URL",
|
||||
message: "Invalid contact URL format.",
|
||||
};
|
||||
|
||||
export const NOTIFY_CONTACTS_ADDED_CSV = {
|
||||
title: "Contacts Added",
|
||||
message: "Each contact was added. Nothing was sent to the server.",
|
||||
};
|
||||
|
||||
export const NOTIFY_CONTACTS_ADD_ERROR = {
|
||||
title: "Add Contacts Error",
|
||||
message: "An error occurred. Some contacts may have been added.",
|
||||
};
|
||||
|
||||
export const NOTIFY_CONTACT_INPUT_PARSE_ERROR = {
|
||||
title: "Invalid Contact List",
|
||||
message: "The input could not be parsed.",
|
||||
};
|
||||
|
||||
export const NOTIFY_CONTACT_NO_CONTACT_FOUND = {
|
||||
title: "No Contact Info",
|
||||
message: "No contact info was found in that input.",
|
||||
};
|
||||
|
||||
export const NOTIFY_CONTACT_NO_DID = {
|
||||
title: "Incomplete Contact",
|
||||
message: "Cannot add a contact without a DID.",
|
||||
};
|
||||
|
||||
export const NOTIFY_CONTACT_INVALID_DID = {
|
||||
title: "Invalid DID",
|
||||
message: "The DID must begin with 'did:'",
|
||||
};
|
||||
|
||||
export const NOTIFY_CONTACT_IMPORT_ERROR = {
|
||||
title: "Contact Not Added",
|
||||
message: "An error prevented this import.",
|
||||
};
|
||||
|
||||
export const NOTIFY_CONTACT_IMPORT_CONFLICT = {
|
||||
title: "Contact Not Added",
|
||||
message:
|
||||
"A contact with that DID is already in your contact list. Edit them directly below.",
|
||||
};
|
||||
|
||||
export const NOTIFY_CONTACT_IMPORT_CONSTRAINT = {
|
||||
title: "Contact Not Added",
|
||||
message: "Check that the contact doesn't conflict with any you already have.",
|
||||
};
|
||||
|
||||
export const NOTIFY_GIVES_LOAD_ERROR = {
|
||||
title: "Gives Load Error",
|
||||
message: "Got an error loading your gives.",
|
||||
};
|
||||
|
||||
export const NOTIFY_CONTACT_SETTING_SAVE_ERROR = {
|
||||
title: "Setting Save Error",
|
||||
message:
|
||||
"The setting may not have saved. Try again, maybe after restarting the app.",
|
||||
};
|
||||
|
||||
export const NOTIFY_MEETING_STATUS_ERROR = {
|
||||
title: "Meeting Error",
|
||||
message: "There was an error checking your meeting status.",
|
||||
};
|
||||
|
||||
export const NOTIFY_CONTACTS_ADDED_VISIBLE = {
|
||||
title: "Contact Added",
|
||||
message: "They were added, and your activity is visible to them.",
|
||||
};
|
||||
|
||||
export const NOTIFY_CONTACTS_ADDED = {
|
||||
title: "Contact Added",
|
||||
message: "They were added.",
|
||||
};
|
||||
|
||||
export const NOTIFY_CONTACT_INFO_COPY = {
|
||||
title: "Info",
|
||||
message: "Contact info will include name, ID, profile image, and public key.",
|
||||
};
|
||||
|
||||
export const NOTIFY_CONTACTS_SELECT_TO_COPY = {
|
||||
title: "Select Contacts",
|
||||
message: "You must select contacts to copy.",
|
||||
};
|
||||
|
||||
export const NOTIFY_CONTACT_LINK_COPIED = {
|
||||
title: "Copied",
|
||||
message: "contact link",
|
||||
};
|
||||
|
||||
// Template for registration success message
|
||||
export const getRegisterPersonSuccessMessage = (name?: string): string =>
|
||||
`${name || "That unnamed person"} ${NOTIFY_REGISTER_PERSON_SUCCESS.message}`;
|
||||
|
||||
// Template for visibility success message
|
||||
export const getVisibilitySuccessMessage = (
|
||||
name?: string,
|
||||
visible = true,
|
||||
): string =>
|
||||
`${name || "That user"} can ${visible ? "" : "not "}see your activity.`;
|
||||
|
||||
Reference in New Issue
Block a user