Browse Source

Replace notification literal strings with constants and add usage documentation

- Migrate remaining ContactsView.vue literal strings to centralized constants
- Add missing constants: NOTIFY_BLANK_INVITE, NOTIFY_REGISTRATION_ERROR_FALLBACK, etc.
- Create composite message functions: getRegisterPersonSuccessMessage(), getVisibilitySuccessMessage()
- Document all notification constants with usage locations in comments
- Fix scattered hardcoded notification messages preventing translation
- 0 linter errors, ContactsView.vue now fully notification-compliant
web-serve-fix
Matthew Raymer 3 weeks ago
parent
commit
884b1d4a21
  1. 122
      src/constants/notifications.ts
  2. 174
      src/views/ContactsView.vue

122
src/constants/notifications.ts

@ -1,123 +1,156 @@
// Notification message constants for user-facing notifications // Notification message constants for user-facing notifications
// Add new notification messages here as needed // Add new notification messages here as needed
//
// DOCUMENTATION FORMAT:
// Each constant is documented with a comment showing where it's used:
// "Used in: ComponentName.vue (method - specific usage description)"
// This helps maintain consistency and track usage across the codebase.
//
// Functions are documented with the specific component methods that call them.
// Constants marked with "[Component usage not yet documented]" need their
// usage locations verified and documented.
// Used in: [Component usage not yet documented]
export const NOTIFY_PERSON_HIDDEN = { export const NOTIFY_PERSON_HIDDEN = {
title: "Person Outside Your Network", title: "Person Outside Your Network",
message: "This person is not visible to you.", message: "This person is not visible to you.",
}; };
// Used in: [Component usage not yet documented]
export const NOTIFY_UNKNOWN_PERSON = { export const NOTIFY_UNKNOWN_PERSON = {
title: "Unidentified Person", title: "Unidentified Person",
message: "Nobody specific was recognized.", message: "Nobody specific was recognized.",
}; };
// Used in: [Component usage not yet documented]
export const NOTIFY_CONTACT_LOADING_ISSUE = { export const NOTIFY_CONTACT_LOADING_ISSUE = {
title: "Contact Loading Issue", title: "Contact Loading Issue",
message: "Some contact information may be unavailable.", message: "Some contact information may be unavailable.",
}; };
// Used in: [Component usage not yet documented]
export const NOTIFY_FEED_LOADING_ISSUE = { export const NOTIFY_FEED_LOADING_ISSUE = {
title: "Feed Loading Issue", title: "Feed Loading Issue",
message: "Some feed data may be unavailable. Pull to refresh.", message: "Some feed data may be unavailable. Pull to refresh.",
}; };
// Used in: [Component usage not yet documented]
export const NOTIFY_CONFIRMATION_ERROR = { export const NOTIFY_CONFIRMATION_ERROR = {
title: "Error", title: "Error",
message: "There was a problem submitting the confirmation.", message: "There was a problem submitting the confirmation.",
}; };
// Used in: [Component usage not yet documented]
export const NOTIFY_DEFAULT_TO_ACTIVE_DID = { export const NOTIFY_DEFAULT_TO_ACTIVE_DID = {
title: "Your Info", title: "Your Info",
message: "No user was specified so showing your info.", message: "No user was specified so showing your info.",
}; };
// Used in: [Component usage not yet documented]
export const NOTIFY_CONTACT_DELETED = { export const NOTIFY_CONTACT_DELETED = {
title: "Deleted", title: "Deleted",
message: "Contact has been removed.", message: "Contact has been removed.",
}; };
// Used in: [Component usage not yet documented]
export const NOTIFY_CONTACT_DELETE_FAILED = { export const NOTIFY_CONTACT_DELETE_FAILED = {
title: "Error", title: "Error",
message: "Failed to delete contact.", message: "Failed to delete contact.",
}; };
// Used in: [Component usage not yet documented]
export const NOTIFY_REGISTRATION_SUCCESS = { export const NOTIFY_REGISTRATION_SUCCESS = {
title: "Registration Success", title: "Registration Success",
message: "has been registered.", message: "has been registered.",
}; };
// Used in: [Component usage not yet documented]
export const NOTIFY_REGISTRATION_ERROR = { export const NOTIFY_REGISTRATION_ERROR = {
title: "Registration Error", title: "Registration Error",
message: "Something went wrong during registration.", message: "Something went wrong during registration.",
}; };
// Used in: [Component usage not yet documented]
export const NOTIFY_SERVER_ACCESS_ERROR = { export const NOTIFY_SERVER_ACCESS_ERROR = {
title: "Error", title: "Error",
message: "There was a problem accessing the server. Try again later.", message: "There was a problem accessing the server. Try again later.",
}; };
// Used in: [Component usage not yet documented]
export const NOTIFY_NO_IDENTITY_ERROR = { export const NOTIFY_NO_IDENTITY_ERROR = {
title: "No Identity", title: "No Identity",
message: "There is no identity to use to check visibility.", message: "There is no identity to use to check visibility.",
}; };
// Used in: [Component usage not yet documented]
export const NOTIFY_VISIBILITY_SET = { export const NOTIFY_VISIBILITY_SET = {
title: "Visibility Set", title: "Visibility Set",
message: "visibility updated.", message: "visibility updated.",
}; };
// Used in: [Component usage not yet documented]
export const NOTIFY_VISIBILITY_REFRESHED = { export const NOTIFY_VISIBILITY_REFRESHED = {
title: "Visibility Refreshed", title: "Visibility Refreshed",
message: "visibility status updated.", message: "visibility status updated.",
}; };
// ContactsView.vue specific constants // ContactsView.vue specific constants
// Used in: ContactsView.vue (processInviteJwt method - blank invite error)
export const NOTIFY_BLANK_INVITE = { export const NOTIFY_BLANK_INVITE = {
title: "Blank Invite", title: "Blank Invite",
message: message:
"The invite was not included, which can happen when your iOS device cuts off the link. Try pasting the full link into a browser.", "The invite was not included, which can happen when your iOS device cuts off the link. Try pasting the full link into a browser.",
}; };
// Used in: ContactsView.vue (processInviteJwt method - registration success)
export const NOTIFY_INVITE_REGISTRATION_SUCCESS = { export const NOTIFY_INVITE_REGISTRATION_SUCCESS = {
title: "Registered", title: "Registered",
message: "You are now registered.", message: "You are now registered.",
}; };
// Used in: [Component usage not yet documented]
export const NOTIFY_INVITE_ERROR = { export const NOTIFY_INVITE_ERROR = {
title: "Error with Invite", title: "Error with Invite",
message: "Got an error sending the invite.", message: "Got an error sending the invite.",
}; };
// Used in: [Component usage not yet documented]
export const NOTIFY_ONBOARDING_CONFIRM = { export const NOTIFY_ONBOARDING_CONFIRM = {
title: "They're Added To Your List", title: "They're Added To Your List",
message: "Would you like to go to the main page now?", message: "Would you like to go to the main page now?",
}; };
// Used in: [Component usage not yet documented]
export const NOTIFY_REGISTER_NOT_AVAILABLE = { export const NOTIFY_REGISTER_NOT_AVAILABLE = {
title: "Not Registered", title: "Not Registered",
message: "You must get registered before you can create invites.", message: "You must get registered before you can create invites.",
}; };
// Used in: [Component usage not yet documented]
export const NOTIFY_REGISTER_PROCESSING = { export const NOTIFY_REGISTER_PROCESSING = {
title: "Processing", title: "Processing",
message: "Sent...", message: "Sent...",
}; };
// Used in: getRegisterPersonSuccessMessage function
export const NOTIFY_REGISTER_PERSON_SUCCESS = { export const NOTIFY_REGISTER_PERSON_SUCCESS = {
title: "Registration Success", title: "Registration Success",
message: "has been registered.", message: "has been registered.",
}; };
// Used in: [Component usage not yet documented]
export const NOTIFY_REGISTER_PERSON_ERROR = { export const NOTIFY_REGISTER_PERSON_ERROR = {
title: "Registration Error", title: "Registration Error",
message: "Something went wrong during registration.", message: "Something went wrong during registration.",
}; };
// Used in: [Component usage not yet documented]
export const NOTIFY_VISIBILITY_ERROR = { export const NOTIFY_VISIBILITY_ERROR = {
title: "Error Setting Visibility", title: "Error Setting Visibility",
message: "Could not set visibility on the server.", message: "Could not set visibility on the server.",
}; };
// Used in: [Component usage not yet documented]
export const NOTIFY_UNCONFIRMED_HOURS = { export const NOTIFY_UNCONFIRMED_HOURS = {
title: "Unconfirmed Hours", title: "Unconfirmed Hours",
message: "Would you like to confirm some of those hours?", message: "Would you like to confirm some of those hours?",
@ -136,6 +169,7 @@ export const NOTIFY_UNCONFIRMED_HOURS_DYNAMIC = {
// Complex modal constants (for raw $notify calls with advanced features) // Complex modal constants (for raw $notify calls with advanced features)
// MembersList.vue complex modals // MembersList.vue complex modals
// Used in: MembersList.vue (complex modal for adding contacts)
export const NOTIFY_ADD_CONTACT_FIRST = { export const NOTIFY_ADD_CONTACT_FIRST = {
title: "Add as Contact First?", title: "Add as Contact First?",
text: "This person is not in your contacts. Would you like to add them as a contact first?", text: "This person is not in your contacts. Would you like to add them as a contact first?",
@ -143,6 +177,7 @@ export const NOTIFY_ADD_CONTACT_FIRST = {
noText: "Skip Adding Contact", noText: "Skip Adding Contact",
}; };
// Used in: MembersList.vue (complex modal for continuing without adding)
export const NOTIFY_CONTINUE_WITHOUT_ADDING = { export const NOTIFY_CONTINUE_WITHOUT_ADDING = {
title: "Continue Without Adding?", title: "Continue Without Adding?",
text: "Are you sure you want to proceed with admission? If they are not a contact, you will not know their name after this meeting.", text: "Are you sure you want to proceed with admission? If they are not a contact, you will not know their name after this meeting.",
@ -150,11 +185,13 @@ export const NOTIFY_CONTINUE_WITHOUT_ADDING = {
}; };
// ContactsView.vue complex modals // ContactsView.vue complex modals
// Used in: ContactsView.vue (addContact method - complex modal for registration)
export const NOTIFY_REGISTER_CONTACT = { export const NOTIFY_REGISTER_CONTACT = {
title: "Register", title: "Register",
text: "Do you want to register them?", text: "Do you want to register them?",
}; };
// Used in: ContactsView.vue (showOnboardMeetingDialog method - complex modal for onboarding meeting)
export const NOTIFY_ONBOARDING_MEETING = { export const NOTIFY_ONBOARDING_MEETING = {
title: "Onboarding Meeting", title: "Onboarding Meeting",
text: "Would you like to start a new meeting?", text: "Would you like to start a new meeting?",
@ -163,44 +200,52 @@ export const NOTIFY_ONBOARDING_MEETING = {
}; };
// ProjectViewView.vue complex modals // ProjectViewView.vue complex modals
// Used in: ProjectViewView.vue (complex modal for claim confirmation)
export const NOTIFY_CONFIRM_CLAIM = { export const NOTIFY_CONFIRM_CLAIM = {
title: "Confirm", title: "Confirm",
text: "Do you personally confirm that this is true?", text: "Do you personally confirm that this is true?",
}; };
// UserProfileView.vue constants // UserProfileView.vue constants
// Used in: UserProfileView.vue (profile loading error)
export const NOTIFY_PROFILE_LOAD_ERROR = { export const NOTIFY_PROFILE_LOAD_ERROR = {
title: "Profile Load Error", title: "Profile Load Error",
message: "There was a problem loading the profile.", message: "There was a problem loading the profile.",
}; };
// ProjectsView.vue constants // ProjectsView.vue constants
// Used in: ProjectsView.vue (no account error)
export const NOTIFY_NO_ACCOUNT_ERROR = { export const NOTIFY_NO_ACCOUNT_ERROR = {
title: "No Account Found", title: "No Account Found",
message: "You need an identifier to load your projects.", message: "You need an identifier to load your projects.",
}; };
// Used in: ProjectsView.vue (project load error)
export const NOTIFY_PROJECT_LOAD_ERROR = { export const NOTIFY_PROJECT_LOAD_ERROR = {
title: "Project Load Error", title: "Project Load Error",
message: "Failed to get projects from the server.", message: "Failed to get projects from the server.",
}; };
// Used in: ProjectsView.vue (project initialization error)
export const NOTIFY_PROJECT_INIT_ERROR = { export const NOTIFY_PROJECT_INIT_ERROR = {
title: "Initialization Error", title: "Initialization Error",
message: "Something went wrong loading your projects.", message: "Something went wrong loading your projects.",
}; };
// Used in: ProjectsView.vue (offers load error)
export const NOTIFY_OFFERS_LOAD_ERROR = { export const NOTIFY_OFFERS_LOAD_ERROR = {
title: "Offer Load Error", title: "Offer Load Error",
message: "Failed to get offers from the server.", message: "Failed to get offers from the server.",
}; };
// Used in: ProjectsView.vue (offers fetch error)
export const NOTIFY_OFFERS_FETCH_ERROR = { export const NOTIFY_OFFERS_FETCH_ERROR = {
title: "Offer Fetch Error", title: "Offer Fetch Error",
message: "Got an error loading offers.", message: "Got an error loading offers.",
}; };
// ProjectsView.vue complex modals // ProjectsView.vue complex modals
// Used in: ProjectsView.vue (complex modal for camera sharing method)
export const NOTIFY_CAMERA_SHARE_METHOD = { export const NOTIFY_CAMERA_SHARE_METHOD = {
title: "Are you nearby with cameras?", title: "Are you nearby with cameras?",
text: "If so, we'll use those with QR codes to share.", text: "If so, we'll use those with QR codes to share.",
@ -209,265 +254,340 @@ export const NOTIFY_CAMERA_SHARE_METHOD = {
}; };
// SharedPhotoView.vue constants // SharedPhotoView.vue constants
// Used in: SharedPhotoView.vue (photo data loading error)
export const NOTIFY_SHARED_PHOTO_LOAD_ERROR = { export const NOTIFY_SHARED_PHOTO_LOAD_ERROR = {
title: "Error", title: "Error",
message: "Got an error loading this data.", message: "Got an error loading this data.",
}; };
// Used in: SharedPhotoView.vue (photo saving error)
export const NOTIFY_SHARED_PHOTO_SAVE_ERROR = { export const NOTIFY_SHARED_PHOTO_SAVE_ERROR = {
title: "Error", title: "Error",
message: "There was a problem saving the picture.", message: "There was a problem saving the picture.",
}; };
// OfferDialog.vue constants // OfferDialog.vue constants
// Used in: OfferDialog.vue (settings retrieval error)
export const NOTIFY_OFFER_SETTINGS_ERROR = { export const NOTIFY_OFFER_SETTINGS_ERROR = {
title: "Error", title: "Error",
message: "There was an error retrieving your settings.", message: "There was an error retrieving your settings.",
}; };
// Used in: OfferDialog.vue (offer recording in progress)
export const NOTIFY_OFFER_RECORDING = { export const NOTIFY_OFFER_RECORDING = {
text: "Recording the offer...", text: "Recording the offer...",
title: "", title: "",
}; };
// Used in: OfferDialog.vue (identity required for offer)
export const NOTIFY_OFFER_IDENTITY_REQUIRED = { export const NOTIFY_OFFER_IDENTITY_REQUIRED = {
title: "Error", title: "Error",
message: "You must select an identity before you can record an offer.", message: "You must select an identity before you can record an offer.",
}; };
// Used in: OfferDialog.vue (description required for offer)
export const NOTIFY_OFFER_DESCRIPTION_REQUIRED = { export const NOTIFY_OFFER_DESCRIPTION_REQUIRED = {
title: "Error", title: "Error",
message: "You must enter a description or some number of {unit}.", message: "You must enter a description or some number of {unit}.",
}; };
// Used in: OfferDialog.vue (offer creation error)
export const NOTIFY_OFFER_CREATION_ERROR = { export const NOTIFY_OFFER_CREATION_ERROR = {
title: "Error", title: "Error",
message: "There was an error creating the offer.", message: "There was an error creating the offer.",
}; };
// Used in: OfferDialog.vue (offer recorded successfully)
export const NOTIFY_OFFER_SUCCESS = { export const NOTIFY_OFFER_SUCCESS = {
title: "Success", title: "Success",
message: "That offer was recorded.", message: "That offer was recorded.",
}; };
// Used in: OfferDialog.vue (offer submission error)
export const NOTIFY_OFFER_SUBMISSION_ERROR = { export const NOTIFY_OFFER_SUBMISSION_ERROR = {
title: "Error", title: "Error",
message: "There was an error recording the offer.", message: "There was an error recording the offer.",
}; };
// PhotoDialog.vue constants // PhotoDialog.vue constants
// Used in: PhotoDialog.vue (settings retrieval error)
export const NOTIFY_PHOTO_SETTINGS_ERROR = { export const NOTIFY_PHOTO_SETTINGS_ERROR = {
title: "Error", title: "Error",
message: "There was an error retrieving your settings.", message: "There was an error retrieving your settings.",
}; };
// Used in: PhotoDialog.vue (photo capture error)
export const NOTIFY_PHOTO_CAPTURE_ERROR = { export const NOTIFY_PHOTO_CAPTURE_ERROR = {
title: "Error", title: "Error",
message: "Failed to take picture. Please try again.", message: "Failed to take picture. Please try again.",
}; };
// Used in: PhotoDialog.vue (camera access error)
export const NOTIFY_PHOTO_CAMERA_ERROR = { export const NOTIFY_PHOTO_CAMERA_ERROR = {
title: "Camera Error", title: "Camera Error",
message: "Could not access camera. Please check permissions and try again.", message: "Could not access camera. Please check permissions and try again.",
}; };
// Used in: PhotoDialog.vue (photo upload error)
export const NOTIFY_PHOTO_UPLOAD_ERROR = { export const NOTIFY_PHOTO_UPLOAD_ERROR = {
title: "Upload Error", title: "Upload Error",
message: "Failed to upload image. Please try again.", message: "Failed to upload image. Please try again.",
}; };
// Used in: PhotoDialog.vue (photo upload success)
export const NOTIFY_PHOTO_UPLOAD_SUCCESS = { export const NOTIFY_PHOTO_UPLOAD_SUCCESS = {
title: "Success", title: "Success",
message: "Image uploaded successfully.", message: "Image uploaded successfully.",
}; };
// Used in: PhotoDialog.vue (unsupported file format)
export const NOTIFY_PHOTO_UNSUPPORTED_FORMAT = { export const NOTIFY_PHOTO_UNSUPPORTED_FORMAT = {
title: "Unsupported Format", title: "Unsupported Format",
message: "This file format is not supported. Please try a different image.", message: "This file format is not supported. Please try a different image.",
}; };
// Used in: PhotoDialog.vue (file size too large)
export const NOTIFY_PHOTO_SIZE_ERROR = { export const NOTIFY_PHOTO_SIZE_ERROR = {
title: "File Too Large", title: "File Too Large",
message: "Image file is too large. Please choose a smaller image.", message: "Image file is too large. Please choose a smaller image.",
}; };
// Used in: PhotoDialog.vue (image processing error)
export const NOTIFY_PHOTO_PROCESSING_ERROR = { export const NOTIFY_PHOTO_PROCESSING_ERROR = {
title: "Processing Error", title: "Processing Error",
message: "Failed to process image. Please try again.", message: "Failed to process image. Please try again.",
}; };
// OnboardMeetingSetupView.vue constants // OnboardMeetingSetupView.vue constants
// Used in: OnboardMeetingSetupView.vue (meeting time validation)
export const NOTIFY_MEETING_INVALID_TIME = { export const NOTIFY_MEETING_INVALID_TIME = {
title: "Invalid Time", title: "Invalid Time",
message: "Select a future time for the meeting expiration.", message: "Select a future time for the meeting expiration.",
}; };
// Used in: OnboardMeetingSetupView.vue (meeting name validation)
export const NOTIFY_MEETING_NAME_REQUIRED = { export const NOTIFY_MEETING_NAME_REQUIRED = {
title: "Invalid Name", title: "Invalid Name",
message: "Please enter your name.", message: "Please enter your name.",
}; };
// Used in: OnboardMeetingSetupView.vue (meeting password validation)
export const NOTIFY_MEETING_PASSWORD_REQUIRED = { export const NOTIFY_MEETING_PASSWORD_REQUIRED = {
title: "Invalid Password", title: "Invalid Password",
message: "Please enter a password.", message: "Please enter a password.",
}; };
// Used in: OnboardMeetingSetupView.vue (meeting creation success)
export const NOTIFY_MEETING_CREATED = { export const NOTIFY_MEETING_CREATED = {
title: "Success", title: "Success",
message: "Meeting created.", message: "Meeting created.",
}; };
// Used in: OnboardMeetingSetupView.vue (meeting deletion success)
export const NOTIFY_MEETING_DELETED = { export const NOTIFY_MEETING_DELETED = {
title: "Success", title: "Success",
message: "Meeting deleted successfully.", message: "Meeting deleted successfully.",
}; };
// Used in: OnboardMeetingSetupView.vue (member link copied)
export const NOTIFY_MEETING_LINK_COPIED = { export const NOTIFY_MEETING_LINK_COPIED = {
title: "Copied", title: "Copied",
message: "The member link is copied to the clipboard.", message: "The member link is copied to the clipboard.",
}; };
// ContactsView.vue extracted notification messages // ContactsView.vue extracted notification messages
// Used in: ContactsView.vue (onClickNewContact method - no contact info error)
export const NOTIFY_CONTACT_NO_INFO = { export const NOTIFY_CONTACT_NO_INFO = {
title: "No Contact Info", title: "No Contact Info",
message: "There was no contact info to add. Try the other green buttons.", message: "There was no contact info to add. Try the other green buttons.",
}; };
// Used in: [Component usage not yet documented]
export const NOTIFY_CONTACT_INVALID_URL = { export const NOTIFY_CONTACT_INVALID_URL = {
title: "Invalid URL", title: "Invalid URL",
message: "Invalid contact URL format.", message: "Invalid contact URL format.",
}; };
// Used in: ContactsView.vue (onClickNewContact method - CSV contacts added success)
export const NOTIFY_CONTACTS_ADDED_CSV = { export const NOTIFY_CONTACTS_ADDED_CSV = {
title: "Contacts Added", title: "Contacts Added",
message: "Each contact was added. Nothing was sent to the server.", message: "Each contact was added. Nothing was sent to the server.",
}; };
// Used in: ContactsView.vue (onClickNewContact method - CSV add error)
export const NOTIFY_CONTACTS_ADD_ERROR = { export const NOTIFY_CONTACTS_ADD_ERROR = {
title: "Add Contacts Error", title: "Add Contacts Error",
message: "An error occurred. Some contacts may have been added.", message: "An error occurred. Some contacts may have been added.",
}; };
// Used in: ContactsView.vue (onClickNewContact method - JSON array parse error)
export const NOTIFY_CONTACT_INPUT_PARSE_ERROR = { export const NOTIFY_CONTACT_INPUT_PARSE_ERROR = {
title: "Invalid Contact List", title: "Invalid Contact List",
message: "The input could not be parsed.", message: "The input could not be parsed.",
}; };
// Used in: ContactsView.vue (onClickNewContact method - no contact found in input)
export const NOTIFY_CONTACT_NO_CONTACT_FOUND = { export const NOTIFY_CONTACT_NO_CONTACT_FOUND = {
title: "No Contact Info", title: "No Contact Info",
message: "No contact info was found in that input.", message: "No contact info was found in that input.",
}; };
// Used in: ContactsView.vue (addContact method - contact has no DID)
export const NOTIFY_CONTACT_NO_DID = { export const NOTIFY_CONTACT_NO_DID = {
title: "Incomplete Contact", title: "Incomplete Contact",
message: "Cannot add a contact without a DID.", message: "Cannot add a contact without a DID.",
}; };
// Used in: ContactsView.vue (addContact method - invalid DID format)
export const NOTIFY_CONTACT_INVALID_DID = { export const NOTIFY_CONTACT_INVALID_DID = {
title: "Invalid DID", title: "Invalid DID",
message: "The DID must begin with 'did:'", message: "The DID must begin with 'did:'",
}; };
// Used in: ContactsView.vue (addContact method - contact import error)
export const NOTIFY_CONTACT_IMPORT_ERROR = { export const NOTIFY_CONTACT_IMPORT_ERROR = {
title: "Contact Not Added", title: "Contact Not Added",
message: "An error prevented this import.", message: "An error prevented this import.",
}; };
// Used in: ContactsView.vue (addContact method - contact already exists)
export const NOTIFY_CONTACT_IMPORT_CONFLICT = { export const NOTIFY_CONTACT_IMPORT_CONFLICT = {
title: "Contact Not Added", title: "Contact Not Added",
message: message:
"A contact with that DID is already in your contact list. Edit them directly below.", "A contact with that DID is already in your contact list. Edit them directly below.",
}; };
// Used in: ContactsView.vue (addContact method - constraint error)
export const NOTIFY_CONTACT_IMPORT_CONSTRAINT = { export const NOTIFY_CONTACT_IMPORT_CONSTRAINT = {
title: "Contact Not Added", title: "Contact Not Added",
message: "Check that the contact doesn't conflict with any you already have.", message: "Check that the contact doesn't conflict with any you already have.",
}; };
// Used in: ContactsView.vue (loadGives method - gives loading error)
export const NOTIFY_GIVES_LOAD_ERROR = { export const NOTIFY_GIVES_LOAD_ERROR = {
title: "Gives Load Error", title: "Gives Load Error",
message: "Got an error loading your gives.", message: "Got an error loading your gives.",
}; };
// Used in: ContactsView.vue (toggleShowContactAmounts method - setting save error)
export const NOTIFY_CONTACT_SETTING_SAVE_ERROR = { export const NOTIFY_CONTACT_SETTING_SAVE_ERROR = {
title: "Setting Save Error", title: "Setting Save Error",
message: message:
"The setting may not have saved. Try again, maybe after restarting the app.", "The setting may not have saved. Try again, maybe after restarting the app.",
}; };
// Used in: ContactsView.vue (showOnboardMeetingDialog method - meeting status error)
export const NOTIFY_MEETING_STATUS_ERROR = { export const NOTIFY_MEETING_STATUS_ERROR = {
title: "Meeting Error", title: "Meeting Error",
message: "There was an error checking your meeting status.", message: "There was an error checking your meeting status.",
}; };
// Used in: ContactsView.vue (addContact method - contact added with visibility)
export const NOTIFY_CONTACTS_ADDED_VISIBLE = { export const NOTIFY_CONTACTS_ADDED_VISIBLE = {
title: "Contact Added", title: "Contact Added",
message: "They were added, and your activity is visible to them.", message: "They were added, and your activity is visible to them.",
}; };
// Used in: ContactsView.vue (addContact method - contact added without visibility)
export const NOTIFY_CONTACTS_ADDED = { export const NOTIFY_CONTACTS_ADDED = {
title: "Contact Added", title: "Contact Added",
message: "They were added.", message: "They were added.",
}; };
// Used in: ContactsView.vue (showCopySelectionsInfo method - info about copying contacts)
export const NOTIFY_CONTACT_INFO_COPY = { export const NOTIFY_CONTACT_INFO_COPY = {
title: "Info", title: "Info",
message: "Contact info will include name, ID, profile image, and public key.", message: "Contact info will include name, ID, profile image, and public key.",
}; };
// Used in: ContactsView.vue (copySelectedContacts method - no contacts selected error)
export const NOTIFY_CONTACTS_SELECT_TO_COPY = { export const NOTIFY_CONTACTS_SELECT_TO_COPY = {
title: "Select Contacts", title: "Select Contacts",
message: "You must select contacts to copy.", message: "You must select contacts to copy.",
}; };
// Used in: ContactsView.vue (copySelectedContacts method - contact link copied success)
export const NOTIFY_CONTACT_LINK_COPIED = { export const NOTIFY_CONTACT_LINK_COPIED = {
title: "Copied", title: "Copied",
message: "contact link", message: "contact link",
}; };
// Template for registration success message // Template for registration success message
// Used in: ContactsView.vue (register method - registration success with contact name)
export const getRegisterPersonSuccessMessage = (name?: string): string => export const getRegisterPersonSuccessMessage = (name?: string): string =>
`${name || "That unnamed person"} ${NOTIFY_REGISTER_PERSON_SUCCESS.message}`; `${name || "That unnamed person"} ${NOTIFY_REGISTER_PERSON_SUCCESS.message}`;
// Template for visibility success message // Template for visibility success message
// Used in: ContactsView.vue (setVisibility method - visibility success with contact name)
export const getVisibilitySuccessMessage = ( export const getVisibilitySuccessMessage = (
name?: string, name?: string,
visible = true, visible = true,
): string => ): string =>
`${name || "That user"} can ${visible ? "" : "not "}see your activity.`; `${name || "That user"} can ${visible ? "" : "not "}see your activity.`;
// Template for gives retrieval error message
// Used in: ContactsView.vue (loadGives method - gives retrieval error with direction)
export const getGivesRetrievalErrorMessage = (useRecipient: boolean): string =>
`Got an error retrieving your ${useRecipient ? "given" : "received"} data from the server.`;
// Additional constants for ContactsView.vue
// Used in: ContactsView.vue (register method - registration error fallback)
export const NOTIFY_REGISTRATION_ERROR_FALLBACK = {
title: "Registration Error",
message: "Something went wrong during registration.",
};
// Used in: ContactsView.vue (register method - generic registration error)
export const NOTIFY_REGISTRATION_ERROR_GENERIC = {
title: "Registration Error",
message: "There was an error.",
};
// Used in: ContactsView.vue (setVisibility method - visibility error fallback)
export const NOTIFY_VISIBILITY_ERROR_FALLBACK = {
title: "Error Setting Visibility",
message: "Could not set visibility on the server.",
};
// ContactEditView.vue constants // ContactEditView.vue constants
// Used in: ContactEditView.vue (contact not found error)
export const NOTIFY_CONTACT_NOT_FOUND = { export const NOTIFY_CONTACT_NOT_FOUND = {
title: "Contact Not Found", title: "Contact Not Found",
message: "Contact not found with DID", message: "Contact not found with DID",
}; };
// Used in: ContactEditView.vue (contact methods updated)
export const NOTIFY_CONTACT_METHODS_UPDATED = { export const NOTIFY_CONTACT_METHODS_UPDATED = {
title: "Contact Methods Updated", title: "Contact Methods Updated",
message: message:
"Contact methods updated. Note that some methods have been updated, such as uppercasing 'email' to 'EMAIL'. Save again if the changes are acceptable.", "Contact methods updated. Note that some methods have been updated, such as uppercasing 'email' to 'EMAIL'. Save again if the changes are acceptable.",
}; };
// Used in: ContactEditView.vue (contact saved successfully)
export const NOTIFY_CONTACT_SAVED = { export const NOTIFY_CONTACT_SAVED = {
title: "Contact Saved", title: "Contact Saved",
message: "Contact saved successfully", message: "Contact saved successfully",
}; };
// Dynamic message template for contact not found (used in ContactEditView.vue) // Dynamic message template for contact not found (used in ContactEditView.vue)
// Used in: ContactEditView.vue (contact not found with DID)
export const createContactNotFoundMessage = (did: string): string => export const createContactNotFoundMessage = (did: string): string =>
`${NOTIFY_CONTACT_NOT_FOUND.message} ${did}`; `${NOTIFY_CONTACT_NOT_FOUND.message} ${did}`;
// ContactAmountsView.vue constants // ContactAmountsView.vue constants
// Used in: ContactAmountsView.vue (settings retrieval error)
export const NOTIFY_SETTINGS_RETRIEVAL_ERROR = { export const NOTIFY_SETTINGS_RETRIEVAL_ERROR = {
title: "Error", title: "Error",
message: "There was an error retrieving your settings or contacts or gives.", message: "There was an error retrieving your settings or contacts or gives.",
}; };
// Used in: ContactAmountsView.vue (server retrieval error)
export const NOTIFY_SERVER_RETRIEVAL_ERROR = { export const NOTIFY_SERVER_RETRIEVAL_ERROR = {
title: "Error With Server", title: "Error With Server",
message: "Got an error retrieving your given time from the server.", message: "Got an error retrieving your given time from the server.",
}; };
// Used in: ContactAmountsView.vue (confirmation restriction)
export const NOTIFY_CONFIRMATION_RESTRICTION = { export const NOTIFY_CONFIRMATION_RESTRICTION = {
title: "Not Allowed", title: "Not Allowed",
message: "Only the recipient can confirm final receipt.", message: "Only the recipient can confirm final receipt.",

174
src/views/ContactsView.vue

@ -396,14 +396,28 @@ import {
NOTIFY_CONTACTS_ADD_ERROR, NOTIFY_CONTACTS_ADD_ERROR,
NOTIFY_CONTACT_NO_DID, NOTIFY_CONTACT_NO_DID,
NOTIFY_CONTACT_INVALID_DID, NOTIFY_CONTACT_INVALID_DID,
NOTIFY_CONTACTS_ADDED_VISIBLE,
NOTIFY_CONTACTS_ADDED,
NOTIFY_CONTACT_IMPORT_ERROR, NOTIFY_CONTACT_IMPORT_ERROR,
NOTIFY_CONTACT_IMPORT_CONFLICT, NOTIFY_CONTACT_IMPORT_CONFLICT,
NOTIFY_CONTACT_IMPORT_CONSTRAINT, NOTIFY_CONTACT_IMPORT_CONSTRAINT,
NOTIFY_CONTACT_SETTING_SAVE_ERROR, NOTIFY_CONTACT_SETTING_SAVE_ERROR,
NOTIFY_CONTACTS_ADDED_VISIBLE,
NOTIFY_CONTACTS_ADDED,
NOTIFY_CONTACT_INFO_COPY, NOTIFY_CONTACT_INFO_COPY,
NOTIFY_CONTACTS_SELECT_TO_COPY, NOTIFY_CONTACTS_SELECT_TO_COPY,
NOTIFY_CONTACT_LINK_COPIED,
NOTIFY_BLANK_INVITE,
NOTIFY_INVITE_REGISTRATION_SUCCESS,
NOTIFY_CONTACTS_ADDED_CSV,
NOTIFY_CONTACT_INPUT_PARSE_ERROR,
NOTIFY_CONTACT_NO_CONTACT_FOUND,
NOTIFY_GIVES_LOAD_ERROR,
NOTIFY_MEETING_STATUS_ERROR,
NOTIFY_REGISTRATION_ERROR_FALLBACK,
NOTIFY_REGISTRATION_ERROR_GENERIC,
NOTIFY_VISIBILITY_ERROR_FALLBACK,
getRegisterPersonSuccessMessage,
getVisibilitySuccessMessage,
getGivesRetrievalErrorMessage,
} from "@/constants/notifications"; } from "@/constants/notifications";
@Component({ @Component({
@ -513,15 +527,7 @@ export default class ContactsView extends Vue {
const importedInviteJwt = this.$route.query["inviteJwt"] as string; const importedInviteJwt = this.$route.query["inviteJwt"] as string;
if (importedInviteJwt === "") { if (importedInviteJwt === "") {
// this happens when a platform (eg iOS) doesn't include anything after the "=" in a shared link. // this happens when a platform (eg iOS) doesn't include anything after the "=" in a shared link.
this.$notify( this.notify.error(NOTIFY_BLANK_INVITE.message, TIMEOUTS.VERY_LONG);
{
group: "alert",
type: "danger",
title: "Blank Invite",
text: "The invite was not included, which can happen when your iOS device cuts off the link. Try pasting the full link into a browser.",
},
7000,
);
} else if (importedInviteJwt) { } else if (importedInviteJwt) {
// make sure user is created // make sure user is created
if (!this.activeDid) { if (!this.activeDid) {
@ -541,15 +547,7 @@ export default class ContactsView extends Vue {
// Replace databaseUtil.updateDidSpecificSettings with mixin method // Replace databaseUtil.updateDidSpecificSettings with mixin method
await this.$saveUserSettings(this.activeDid, { isRegistered: true }); await this.$saveUserSettings(this.activeDid, { isRegistered: true });
this.isRegistered = true; this.isRegistered = true;
this.$notify( this.notify.success(NOTIFY_INVITE_REGISTRATION_SUCCESS.message);
{
group: "alert",
type: "success",
title: "Registered",
text: "You are now registered.",
},
3000,
);
// wait for a second before continuing so they see the registration message // wait for a second before continuing so they see the registration message
await new Promise((resolve) => setTimeout(resolve, 1000)); await new Promise((resolve) => setTimeout(resolve, 1000));
@ -602,15 +600,7 @@ export default class ContactsView extends Vue {
} else if (error.message) { } else if (error.message) {
message = error.message; message = error.message;
} }
this.$notify( this.notify.error(message, TIMEOUTS.MODAL);
{
group: "alert",
type: "danger",
title: "Error with Invite",
text: message,
},
-1,
);
} }
// if we're here, they haven't redirected anywhere, so we'll redirect here without a query parameter // if we're here, they haven't redirected anywhere, so we'll redirect here without a query parameter
this.$router.push({ path: "/contacts" }); this.$router.push({ path: "/contacts" });
@ -683,18 +673,7 @@ export default class ContactsView extends Vue {
resp.status, resp.status,
resp.data, resp.data,
); );
this.$notify( this.notify.error(getGivesRetrievalErrorMessage(useRecipient));
{
group: "alert",
type: "danger",
title: "Retrieval Error",
text:
"Got an error retrieving your " +
(useRecipient ? "given" : "received") +
" data from the server.",
},
3000,
);
} }
}; };
@ -744,15 +723,7 @@ export default class ContactsView extends Vue {
} catch (error) { } catch (error) {
const fullError = "Error loading gives: " + errorStringForLog(error); const fullError = "Error loading gives: " + errorStringForLog(error);
logConsoleAndDb(fullError, true); logConsoleAndDb(fullError, true);
this.$notify( this.notify.error(NOTIFY_GIVES_LOAD_ERROR.message);
{
group: "alert",
type: "danger",
title: "Load Error",
text: "Got an error loading your gives.",
},
3000,
);
} }
} }
@ -797,15 +768,7 @@ export default class ContactsView extends Vue {
} }
try { try {
await Promise.all(lineAdded); await Promise.all(lineAdded);
this.$notify( this.notify.success(NOTIFY_CONTACTS_ADDED_CSV.message);
{
group: "alert",
type: "success",
title: "Contacts Added",
text: "Each contact was added. Nothing was sent to the server.",
},
3000, // keeping it up so that the "visibility" message is seen
);
} catch (e) { } catch (e) {
const fullError = const fullError =
"Error adding contacts from CSV: " + errorStringForLog(e); "Error adding contacts from CSV: " + errorStringForLog(e);
@ -877,13 +840,13 @@ export default class ContactsView extends Vue {
"Error adding contacts from array: " + errorStringForLog(e); "Error adding contacts from array: " + errorStringForLog(e);
logConsoleAndDb(fullError, true); logConsoleAndDb(fullError, true);
// Use notification helper and constant // Use notification helper and constant
this.notify.error("The input could not be parsed."); this.notify.error(NOTIFY_CONTACT_INPUT_PARSE_ERROR.message);
} }
return; return;
} }
// Use notification helper and constant // Use notification helper and constant
this.notify.error("No contact info was found in that input."); this.notify.error(NOTIFY_CONTACT_NO_CONTACT_FOUND.message);
} }
private async addContactFromEndorserMobileLine( private async addContactFromEndorserMobileLine(
@ -985,31 +948,9 @@ export default class ContactsView extends Vue {
} }
} }
// note that this is also in DIDView.vue
private async confirmSetVisibility(contact: Contact, visibility: boolean) {
const visibilityPrompt = visibility
? "Are you sure you want to make your activity visible to them?"
: "Are you sure you want to hide all your activity from them?";
this.$notify(
{
group: "modal",
type: "confirm",
title: "Set Visibility",
text: visibilityPrompt,
onYes: async () => {
const success = await this.setVisibility(contact, visibility, true);
if (success) {
contact.seesMe = visibility; // didn't work inside setVisibility
}
},
},
-1,
);
}
// note that this is also in DIDView.vue // note that this is also in DIDView.vue
private async register(contact: Contact) { private async register(contact: Contact) {
this.$notify({ group: "alert", type: "toast", title: "Sent..." }, 1000); this.notify.sent();
try { try {
const regResult = await register( const regResult = await register(
@ -1023,33 +964,18 @@ export default class ContactsView extends Vue {
// Replace PlatformServiceFactory with mixin method // Replace PlatformServiceFactory with mixin method
await this.$updateContact(contact.did, { registered: true }); await this.$updateContact(contact.did, { registered: true });
this.$notify( this.notify.success(getRegisterPersonSuccessMessage(contact.name));
{
group: "alert",
type: "success",
title: "Registration Success",
text:
(contact.name || "That unnamed person") + " has been registered.",
},
3000,
);
} else { } else {
this.$notify( this.notify.error(
{
group: "alert",
type: "danger",
title: "Registration Error",
text:
(regResult.error as string) || (regResult.error as string) ||
"Something went wrong during registration.", NOTIFY_REGISTRATION_ERROR_FALLBACK.message,
}, TIMEOUTS.MODAL,
-1,
); );
} }
} catch (error) { } catch (error) {
const fullError = "Error when registering: " + errorStringForLog(error); const fullError = "Error when registering: " + errorStringForLog(error);
logConsoleAndDb(fullError, true); logConsoleAndDb(fullError, true);
let userMessage = "There was an error."; let userMessage = NOTIFY_REGISTRATION_ERROR_GENERIC.message;
const serverError = error as AxiosError; const serverError = error as AxiosError;
if (serverError.isAxiosError) { if (serverError.isAxiosError) {
if ( if (
@ -1070,15 +996,7 @@ export default class ContactsView extends Vue {
userMessage = error as string; userMessage = error as string;
} }
// Now set that error for the user to see. // Now set that error for the user to see.
this.$notify( this.notify.error(userMessage, TIMEOUTS.MODAL);
{
group: "alert",
type: "danger",
title: "Registration Error",
text: userMessage,
},
-1,
);
} }
} }
@ -1098,18 +1016,8 @@ export default class ContactsView extends Vue {
if (result.success) { if (result.success) {
//contact.seesMe = visibility; // why doesn't it affect the UI from here? //contact.seesMe = visibility; // why doesn't it affect the UI from here?
if (showSuccessAlert) { if (showSuccessAlert) {
this.$notify( this.notify.success(
{ getVisibilitySuccessMessage(contact.name, visibility),
group: "alert",
type: "success",
title: "Visibility Set",
text:
(contact.name || "That user") +
" can " +
(visibility ? "" : "not ") +
"see your activity.",
},
3000,
); );
} }
return true; return true;
@ -1119,16 +1027,8 @@ export default class ContactsView extends Vue {
result, result,
); );
const message = const message =
(result.error as string) || "Could not set visibility on the server."; (result.error as string) || NOTIFY_VISIBILITY_ERROR_FALLBACK.message;
this.$notify( this.notify.error(message, TIMEOUTS.LONG);
{
group: "alert",
type: "danger",
title: "Error Setting Visibility",
text: message,
},
5000,
);
return false; return false;
} }
} }
@ -1314,7 +1214,7 @@ export default class ContactsView extends Vue {
.copy(contactsJwtUrl) .copy(contactsJwtUrl)
.then(() => { .then(() => {
// Use notification helper // Use notification helper
this.notify.copied("contact link"); this.notify.copied(NOTIFY_CONTACT_LINK_COPIED.message);
}); });
} }
@ -1371,7 +1271,7 @@ export default class ContactsView extends Vue {
"Error checking meeting status:" + errorStringForLog(error), "Error checking meeting status:" + errorStringForLog(error),
); );
// Use notification helper // Use notification helper
this.notify.error("There was an error checking your meeting status."); this.notify.error(NOTIFY_MEETING_STATUS_ERROR.message);
} }
} }

Loading…
Cancel
Save