forked from trent_larson/crowd-funder-for-time-pwa
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
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -243,13 +243,19 @@
|
||||
:project-name="name"
|
||||
/>
|
||||
|
||||
<h3 class="text-lg font-bold leading-tight mb-3">Offered To This Idea</h3>
|
||||
<h3 class="text-lg font-bold leading-tight mb-3">
|
||||
Offered To This Idea
|
||||
</h3>
|
||||
|
||||
<div v-if="offersToThis.length === 0" class="text-sm">
|
||||
(None yet.<span v-if="activeDid && isRegistered"> Wanna
|
||||
<span class="cursor-pointer text-blue-500" @click="openOfferDialog()"
|
||||
>offer something… especially if others join you</span
|
||||
>?</span>)
|
||||
(None yet.<span v-if="activeDid && isRegistered">
|
||||
Wanna
|
||||
<span
|
||||
class="cursor-pointer text-blue-500"
|
||||
@click="openOfferDialog()"
|
||||
>offer something… especially if others join you</span
|
||||
>?</span
|
||||
>)
|
||||
</div>
|
||||
|
||||
<ul v-else class="text-sm border-t border-slate-300">
|
||||
@@ -325,7 +331,9 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3 class="text-lg font-bold leading-tight mb-3">Given To This Project</h3>
|
||||
<h3 class="text-lg font-bold leading-tight mb-3">
|
||||
Given To This Project
|
||||
</h3>
|
||||
|
||||
<div v-if="givesToThis.length === 0" class="text-sm">
|
||||
(None yet. If you've seen something, say something by clicking a
|
||||
@@ -498,7 +506,9 @@
|
||||
Benefitted From This Project
|
||||
</h3>
|
||||
|
||||
<div v-if="givesProvidedByThis.length === 0" class="text-sm">(None yet.)</div>
|
||||
<div v-if="givesProvidedByThis.length === 0" class="text-sm">
|
||||
(None yet.)
|
||||
</div>
|
||||
|
||||
<ul v-else class="text-sm border-t border-slate-300">
|
||||
<li
|
||||
|
||||
Reference in New Issue
Block a user