diff --git a/doc/migration-progress-tracker.md b/doc/migration-progress-tracker.md index 796b1f97..1246e2dd 100644 --- a/doc/migration-progress-tracker.md +++ b/doc/migration-progress-tracker.md @@ -381,5 +381,19 @@ find src -name "*.vue" -o -name "*.ts" | xargs grep -l "import.*databaseUtil" | --- +## 🎯 **Notification Best Practices and Nuances** + +- **All user-facing notification messages must be defined as constants** in `src/constants/notifications.ts`. Do not hardcode notification strings in components. +- **All notification durations/timeouts must use the `TIMEOUTS` constants** from `src/utils/notify.ts`. Do not hardcode durations. +- **Notification helpers (`this.notify`) must be initialized as a property in `created()`** using `createNotifyHelpers(this.$notify)`. +- **Never hardcode notification strings or durations in components.** +- **When using `notifyWhyCannotConfirm` or similar utilities, pass a wrapper function** if the signature expects a raw notify function (e.g., `(msg, timeout) => this.notify.info(msg.text ?? '', timeout)`). +- **Declare `$notify` as a property on the class** to satisfy the type checker, since Vue injects it at runtime. +- **Use type guards or `as any` for unknown notification payloads** when necessary, but prefer type safety where possible. + +These practices ensure maintainability, consistency, and type safety for all notification-related code during and after migration. + +--- + **Last Updated**: $(date) **Next Review**: After each phase completion \ No newline at end of file diff --git a/src/components/ActivityListItem.vue b/src/components/ActivityListItem.vue index 58c67e82..9f47fd68 100644 --- a/src/components/ActivityListItem.vue +++ b/src/components/ActivityListItem.vue @@ -249,7 +249,7 @@ - \ No newline at end of file diff --git a/src/constants/notifications.ts b/src/constants/notifications.ts new file mode 100644 index 00000000..d203a986 --- /dev/null +++ b/src/constants/notifications.ts @@ -0,0 +1,12 @@ +// Notification message constants for user-facing notifications +// Add new notification messages here as needed + +export const NOTIFY_PERSON_HIDDEN = { + title: "Person Outside Your Network", + message: "This person is not visible to you.", +}; + +export const NOTIFY_UNKNOWN_PERSON = { + title: "Unidentified Person", + message: "Nobody specific was recognized.", +}; \ No newline at end of file diff --git a/src/utils/notificationUtils.ts b/src/utils/notificationUtils.ts index 73d7b9a1..496df3de 100644 --- a/src/utils/notificationUtils.ts +++ b/src/utils/notificationUtils.ts @@ -276,4 +276,3 @@ export const NotificationMixin = { }, }, }; - \ No newline at end of file