forked from jsnbuchanan/crowd-funder-for-time-pwa
Enhance migration templates with critical omission prevention
Add comprehensive guidance to prevent common migration oversights: - Remove unused notification imports - Replace hardcoded timeout values with constants - Remove legacy wrapper functions - Extract long class attributes to computed properties - Replace literal strings with constants Based on lessons learned from ContactQRScanShowView.vue migration. Includes validation commands and specific examples for each pattern.
This commit is contained in:
@@ -1236,3 +1236,147 @@ export const NOTIFY_SEARCH_AREA_DELETED = {
|
||||
title: "Location Deleted",
|
||||
text: "Your stored search area has been removed. Location filtering is now disabled.",
|
||||
} as const;
|
||||
|
||||
// ContactQRScanShowView.vue specific constants
|
||||
// Used in: ContactQRScanShowView.vue (created method - initialization error)
|
||||
export const NOTIFY_QR_INITIALIZATION_ERROR = {
|
||||
title: "Initialization Error",
|
||||
message: "Failed to initialize QR renderer or scanner. Please try again.",
|
||||
};
|
||||
|
||||
// Used in: ContactQRScanShowView.vue (startScanning method - camera in use)
|
||||
export const NOTIFY_QR_CAMERA_IN_USE = {
|
||||
title: "Camera in Use",
|
||||
message: "Please close other applications using the camera and try again",
|
||||
};
|
||||
|
||||
// Used in: ContactQRScanShowView.vue (startScanning method - camera access required)
|
||||
export const NOTIFY_QR_CAMERA_ACCESS_REQUIRED = {
|
||||
title: "Camera Access Required",
|
||||
message: "Please grant camera permission to scan QR codes",
|
||||
};
|
||||
|
||||
// Used in: ContactQRScanShowView.vue (startScanning method - no camera)
|
||||
export const NOTIFY_QR_NO_CAMERA = {
|
||||
title: "No Camera",
|
||||
message: "No camera was found on this device",
|
||||
};
|
||||
|
||||
// Used in: ContactQRScanShowView.vue (startScanning method - HTTPS required)
|
||||
export const NOTIFY_QR_HTTPS_REQUIRED = {
|
||||
title: "HTTPS Required",
|
||||
message: "Camera access requires a secure (HTTPS) connection",
|
||||
};
|
||||
|
||||
// Used in: ContactQRScanShowView.vue (addNewContact method - contact exists)
|
||||
export const NOTIFY_QR_CONTACT_EXISTS = {
|
||||
title: "Contact Exists",
|
||||
message: "This contact has already been added to your list.",
|
||||
};
|
||||
|
||||
// Used in: ContactQRScanShowView.vue (addNewContact method - contact added)
|
||||
export const NOTIFY_QR_CONTACT_ADDED = {
|
||||
title: "Contact Added",
|
||||
message: "They were added, and your activity is visible to them.",
|
||||
};
|
||||
|
||||
// Used in: ContactQRScanShowView.vue (addNewContact method - contact added without visibility)
|
||||
export const NOTIFY_QR_CONTACT_ADDED_NO_VISIBILITY = {
|
||||
title: "Contact Added",
|
||||
message: "They were added.",
|
||||
};
|
||||
|
||||
// Used in: ContactQRScanShowView.vue (addNewContact method - contact error)
|
||||
export const NOTIFY_QR_CONTACT_ERROR = {
|
||||
title: "Contact Error",
|
||||
message: "Could not save contact. Check if it already exists.",
|
||||
};
|
||||
|
||||
// Used in: ContactQRScanShowView.vue (register method - registration submitted)
|
||||
export const NOTIFY_QR_REGISTRATION_SUBMITTED = {
|
||||
title: "",
|
||||
message: "Registration submitted...",
|
||||
};
|
||||
|
||||
// Used in: ContactQRScanShowView.vue (register method - registration success)
|
||||
export const NOTIFY_QR_REGISTRATION_SUCCESS = {
|
||||
title: "Registration Success",
|
||||
message: " has been registered.",
|
||||
};
|
||||
|
||||
// Used in: ContactQRScanShowView.vue (register method - registration error)
|
||||
export const NOTIFY_QR_REGISTRATION_ERROR = {
|
||||
title: "Registration Error",
|
||||
message: "Something went wrong during registration.",
|
||||
};
|
||||
|
||||
// Used in: ContactQRScanShowView.vue (onCopyUrlToClipboard method - URL copied)
|
||||
export const NOTIFY_QR_URL_COPIED = {
|
||||
title: "Copied",
|
||||
message: "Contact URL was copied to clipboard.",
|
||||
};
|
||||
|
||||
// Used in: ContactQRScanShowView.vue (toastQRCodeHelp method - QR code help)
|
||||
export const NOTIFY_QR_CODE_HELP = {
|
||||
title: "QR Code Help",
|
||||
message: "Click the QR code to copy your contact info to your clipboard.",
|
||||
};
|
||||
|
||||
// Used in: ContactQRScanShowView.vue (onCopyDidToClipboard method - DID copied)
|
||||
export const NOTIFY_QR_DID_COPIED = {
|
||||
title: "Copied",
|
||||
message:
|
||||
"Your DID was copied to the clipboard. Have them paste it in the box on their 'People' screen to add you.",
|
||||
};
|
||||
|
||||
// Used in: ContactQRScanShowView.vue (onScanDetect method - invalid QR code)
|
||||
export const NOTIFY_QR_INVALID_QR_CODE = {
|
||||
title: "Invalid QR Code",
|
||||
message: "This QR code does not contain valid contact information. Scan a TimeSafari contact QR code.",
|
||||
};
|
||||
|
||||
// Used in: ContactQRScanShowView.vue (onScanDetect method - invalid contact info)
|
||||
export const NOTIFY_QR_INVALID_CONTACT_INFO = {
|
||||
title: "Invalid Contact Info",
|
||||
message: "The contact information is incomplete or invalid.",
|
||||
};
|
||||
|
||||
// Used in: ContactQRScanShowView.vue (onScanDetect method - missing DID)
|
||||
export const NOTIFY_QR_MISSING_DID = {
|
||||
title: "Invalid Contact",
|
||||
message: "The contact DID is missing.",
|
||||
};
|
||||
|
||||
// Used in: ContactQRScanShowView.vue (onScanDetect method - unknown contact type)
|
||||
export const NOTIFY_QR_UNKNOWN_CONTACT_TYPE = {
|
||||
title: "Error",
|
||||
message: "Could not determine the type of contact info. Try again, or tap the QR code to copy it and send it to them.",
|
||||
};
|
||||
|
||||
// Used in: ContactQRScanShowView.vue (onScanDetect method - processing error)
|
||||
export const NOTIFY_QR_PROCESSING_ERROR = {
|
||||
title: "Error",
|
||||
message: "Could not process QR code. Please try again.",
|
||||
};
|
||||
|
||||
// Helper function for dynamic contact added messages
|
||||
// Used in: ContactQRScanShowView.vue (addNewContact method - dynamic contact added message)
|
||||
export function createQRContactAddedMessage(hasVisibility: boolean): string {
|
||||
return hasVisibility
|
||||
? NOTIFY_QR_CONTACT_ADDED.message
|
||||
: NOTIFY_QR_CONTACT_ADDED_NO_VISIBILITY.message;
|
||||
}
|
||||
|
||||
// Helper function for dynamic registration success messages
|
||||
// Used in: ContactQRScanShowView.vue (register method - dynamic success message)
|
||||
export function createQRRegistrationSuccessMessage(
|
||||
contactName: string,
|
||||
): string {
|
||||
return `${contactName || "That unnamed person"}${NOTIFY_QR_REGISTRATION_SUCCESS.message}`;
|
||||
}
|
||||
|
||||
// ContactQRScanShowView.vue timeout constants
|
||||
export const QR_TIMEOUT_SHORT = 1000; // Short operations like registration submission
|
||||
export const QR_TIMEOUT_MEDIUM = 2000; // Medium operations like URL copy
|
||||
export const QR_TIMEOUT_STANDARD = 3000; // Standard success messages
|
||||
export const QR_TIMEOUT_LONG = 5000; // Error messages and warnings
|
||||
|
||||
Reference in New Issue
Block a user