From c4f2bb5e3aed96d281cf37b591b552a9ecb44b87 Mon Sep 17 00:00:00 2001 From: Jose Olarte III Date: Thu, 28 Aug 2025 16:44:17 +0800 Subject: [PATCH] refactor: move duplicate account import warnings to notification constants - Add NOTIFY_DUPLICATE_ACCOUNT_IMPORT constant for import warnings - Add NOTIFY_DUPLICATE_DERIVED_ACCOUNT constant for derived account warnings - Update ImportAccountView.vue to use notification constants - Update ImportDerivedAccountView.vue to use notification constants - Update test file to use notification constants for assertions Centralizes notification messages for better maintainability and consistency with the existing notification system. Files modified: - src/constants/notifications.ts: Add new notification constants - src/views/ImportAccountView.vue: Replace hardcoded messages with constants - src/views/ImportDerivedAccountView.vue: Replace hardcoded messages with constants - test-playwright/duplicate-import-test.spec.ts: Update test assertions --- src/constants/notifications.ts | 16 +++++++++++++ src/views/ImportAccountView.vue | 5 ++-- src/views/ImportDerivedAccountView.vue | 3 ++- src/views/ProjectViewView.vue | 24 +++++++++++++------ test-playwright/duplicate-import-test.spec.ts | 6 ++--- 5 files changed, 41 insertions(+), 13 deletions(-) diff --git a/src/constants/notifications.ts b/src/constants/notifications.ts index 49b14812..136a6a24 100644 --- a/src/constants/notifications.ts +++ b/src/constants/notifications.ts @@ -1689,3 +1689,19 @@ export const NOTIFY_CONTACTS_ADDED_CONFIRM = { title: "They're Added To Your List", message: "Would you like to go to the main page now?", }; + +// ImportAccountView.vue specific constants +// Used in: ImportAccountView.vue (onImportClick method - duplicate account warning) +export const NOTIFY_DUPLICATE_ACCOUNT_IMPORT = { + title: "Account Already Imported", + message: + "This account has already been imported. Please use a different seed phrase or check your existing accounts.", +}; + +// ImportDerivedAccountView.vue specific constants +// Used in: ImportDerivedAccountView.vue (incrementDerivation method - duplicate derived account warning) +export const NOTIFY_DUPLICATE_DERIVED_ACCOUNT = { + title: "Derived Account Already Exists", + message: + "This derived account already exists. Please try a different derivation path.", +}; diff --git a/src/views/ImportAccountView.vue b/src/views/ImportAccountView.vue index 2e21e187..4b0c006b 100644 --- a/src/views/ImportAccountView.vue +++ b/src/views/ImportAccountView.vue @@ -95,6 +95,7 @@ import { import { retrieveAccountCount, importFromMnemonic } from "../libs/util"; import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin"; import { createNotifyHelpers, TIMEOUTS } from "@/utils/notify"; +import { NOTIFY_DUPLICATE_ACCOUNT_IMPORT } from "@/constants/notifications"; /** * Import Account View Component @@ -206,7 +207,7 @@ export default class ImportAccountView extends Vue { const isDuplicate = await this.checkForDuplicateAccount(); if (isDuplicate) { this.notify.warning( - "This account has already been imported. Please use a different seed phrase or check your existing accounts.", + NOTIFY_DUPLICATE_ACCOUNT_IMPORT.message, TIMEOUTS.LONG, ); return; @@ -246,7 +247,7 @@ export default class ImportAccountView extends Vue { errorMessage.includes("Cannot import duplicate account") ) { this.notify.warning( - "This account has already been imported. Please use a different seed phrase or check your existing accounts.", + NOTIFY_DUPLICATE_ACCOUNT_IMPORT.message, TIMEOUTS.LONG, ); return; diff --git a/src/views/ImportDerivedAccountView.vue b/src/views/ImportDerivedAccountView.vue index 44ef37d2..834950f6 100644 --- a/src/views/ImportDerivedAccountView.vue +++ b/src/views/ImportDerivedAccountView.vue @@ -91,6 +91,7 @@ import { createNotifyHelpers, TIMEOUTS, NotifyFunction } from "@/utils/notify"; import { NOTIFY_ACCOUNT_DERIVATION_SUCCESS, NOTIFY_ACCOUNT_DERIVATION_ERROR, + NOTIFY_DUPLICATE_DERIVED_ACCOUNT, } from "@/constants/notifications"; @Component({ @@ -175,7 +176,7 @@ export default class ImportAccountView extends Vue { const isDuplicate = await this.checkForDuplicateAccount(newId.did); if (isDuplicate) { this.notify.warning( - "This derived account already exists. Please try a different derivation path.", + NOTIFY_DUPLICATE_DERIVED_ACCOUNT.message, TIMEOUTS.LONG, ); return; diff --git a/src/views/ProjectViewView.vue b/src/views/ProjectViewView.vue index 01d0cdfd..361c822f 100644 --- a/src/views/ProjectViewView.vue +++ b/src/views/ProjectViewView.vue @@ -243,13 +243,19 @@ :project-name="name" /> -

Offered To This Idea

+

+ Offered To This Idea +

- (None yet. Wanna - offer something… especially if others join you?) + (None yet. + Wanna + offer something… especially if others join you?)