From 54c139c12a9d26677d68b13e4b406f3c3cc6b70a Mon Sep 17 00:00:00 2001 From: Alexandros Kalogerakis Date: Wed, 30 Oct 2024 15:18:47 +0200 Subject: [PATCH] feat: show names in address book --- src/composables/accountSelector.ts | 8 +------- src/constants/common.ts | 1 + src/popup/components/AddressBook/AddressBookList.vue | 8 ++++---- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/composables/accountSelector.ts b/src/composables/accountSelector.ts index 0957b991f..14a88f479 100644 --- a/src/composables/accountSelector.ts +++ b/src/composables/accountSelector.ts @@ -1,5 +1,5 @@ import { useAddressBook } from '@/composables/addressBook'; -import { ref, watch } from 'vue'; +import { ref } from 'vue'; import { ACCOUNT_SELECT_TYPE_FILTER, AccountSelectTypeFilter } from '@/constants'; import { createCustomScopedComposable } from '@/utils'; @@ -26,12 +26,6 @@ export const useAccountSelector = createCustomScopedComposable(() => { addressBookClearFilters(resetProtocolFilter); } - watch(showBookmarked, (val) => { - if (!val) { - accountSelectType.value = ACCOUNT_SELECT_TYPE_FILTER.addressBook; - } - }); - return { accountSelectType, addressBookFiltered, diff --git a/src/constants/common.ts b/src/constants/common.ts index 97520016d..84f43cc74 100644 --- a/src/constants/common.ts +++ b/src/constants/common.ts @@ -505,6 +505,7 @@ export const PASSWORD_STRENGTH = { } as const; export const ACCOUNT_SELECT_TYPE_FILTER = { + all: 'all', bookmarked: 'bookmarked', owned: 'owned', addressBook: 'addressBook', diff --git a/src/popup/components/AddressBook/AddressBookList.vue b/src/popup/components/AddressBook/AddressBookList.vue index b81aefefb..3f579805b 100644 --- a/src/popup/components/AddressBook/AddressBookList.vue +++ b/src/popup/components/AddressBook/AddressBookList.vue @@ -92,6 +92,7 @@ import { AE_TRANSACTION_OWNERSHIP_STATUS } from '@/protocols/aeternity/config'; import { ACCOUNT_SELECT_TYPE_FILTER, PROTOCOLS, TX_DIRECTION } from '@/constants'; import { useAeNames } from '@/protocols/aeternity/composables/aeNames'; import { useAeMiddleware } from '@/protocols/aeternity/composables'; +import { getDefaultAccountLabel } from '@/utils'; export default defineComponent({ components: { @@ -131,16 +132,15 @@ export default defineComponent({ } = useAccountSelector(); const ownAddresses = computed(() => { if (protocolFilter.value) { - return accountsGroupedByProtocol.value[protocolFilter.value]?.map((accountAddress) => ( + return accountsGroupedByProtocol.value[protocolFilter.value]?.map((account) => ( { - name: protocolFilter.value === PROTOCOLS.aeternity ? getName(accountAddress.address).value : '', - address: accountAddress.address, + name: getName(account.address).value || getDefaultAccountLabel(account), + address: account.address, isBookmarked: false, protocol: protocolFilter.value ?? PROTOCOLS.aeternity, } )); } - return []; }); const { accountsTransactionsLatest } = useLatestTransactionList();