diff --git a/src/composables/accountSelector.ts b/src/composables/accountSelector.ts index 019d30da4..18fbbd760 100644 --- a/src/composables/accountSelector.ts +++ b/src/composables/accountSelector.ts @@ -119,7 +119,15 @@ export const useAccountSelector = createCustomScopedComposable(() => { } watch( - () => [accountsTransactionsLatest.value, activeAccount.value.address, protocolFilter.value], + () => [protocolFilter.value], + async () => { + if (protocolFilter.value) { + setAccountSelectType(ACCOUNT_SELECT_TYPE_FILTER.addressBook); + } + }, + ); + watch( + () => [accountsTransactionsLatest.value, activeAccount.value.address], async () => { const filteredTransactions = accountsTransactionsLatest .value[activeAccount.value.address].filter( diff --git a/src/composables/modals.ts b/src/composables/modals.ts index 2a600c304..d06d7819e 100644 --- a/src/composables/modals.ts +++ b/src/composables/modals.ts @@ -93,6 +93,10 @@ export function useModals() { }); } + function closeAllModals() { + modalsOpen.value.forEach((modal) => closeModalByKey(modal.key)); + } + function openModal(name: string, props: IModalProps = {}): Promise { const modalSettings = modalsRegistered.get(name); @@ -226,5 +230,6 @@ export function useModals() { openPasswordLoginModal, openEnableBiometricLoginModal, closeModalByKey, + closeAllModals, }; } diff --git a/src/popup/components/AddressBook/AddressBookList.vue b/src/popup/components/AddressBook/AddressBookList.vue index a8519ac69..b51002cb4 100644 --- a/src/popup/components/AddressBook/AddressBookList.vue +++ b/src/popup/components/AddressBook/AddressBookList.vue @@ -63,10 +63,12 @@ v-text="noRecordsMessage" /> {{ $t('pages.addressBook.addAddressRecord') }} @@ -127,7 +129,7 @@ export default defineComponent({ /** Whether the list is being used in an account selector or not */ isSelector: Boolean, }, - emits: ['update:hideButtons', 'select-address'], + emits: ['update:hideButtons', 'select-address', 'close-all'], setup(props, { emit }) { const scrollWrapperEl = ref(); const isScrolled = ref(false); @@ -192,15 +194,16 @@ export default defineComponent({ function bgColorStyle(isOwnAddress: boolean, address: String) { return isOwnAddress ? { '--bg-color': getAddressColor(address) } : {}; } + function closeModals() { + emit('close-all'); + } onMounted(() => { scrollWrapper.value?.addEventListener('scroll', handleScroll); - if (props.isSelector) { - if (hasBookmarkedEntries.value) { - setAccountSelectType(ACCOUNT_SELECT_TYPE_FILTER.bookmarked); - } else { - setAccountSelectType(ACCOUNT_SELECT_TYPE_FILTER.addressBook); - } + if (hasBookmarkedEntries.value) { + setAccountSelectType(ACCOUNT_SELECT_TYPE_FILTER.bookmarked); + } else { + setAccountSelectType(ACCOUNT_SELECT_TYPE_FILTER.addressBook); } }); @@ -216,6 +219,7 @@ export default defineComponent({ return { ROUTE_ADDRESS_BOOK_EDIT, ROUTE_ADDRESS_BOOK, + ACCOUNT_SELECT_TYPE_FILTER, scrollWrapperEl, isSearchVisible, hasBookmarkedEntries, @@ -226,6 +230,7 @@ export default defineComponent({ protocolName, bgColorStyle, accountIcon, + closeModals, PlusCircleIcon, }; }, @@ -265,7 +270,7 @@ export default defineComponent({ align-items: center; color: $color-grey-light; text-align: center; - padding: 40px 8px; + padding: 40px 8px 16px; } .account-type-icon { diff --git a/src/popup/components/Modals/AddressBookAccountSelector.vue b/src/popup/components/Modals/AddressBookAccountSelector.vue index ed4fadaaf..b15395516 100644 --- a/src/popup/components/Modals/AddressBookAccountSelector.vue +++ b/src/popup/components/Modals/AddressBookAccountSelector.vue @@ -9,9 +9,15 @@

+ - @@ -26,7 +32,7 @@ import { import { IonPage } from '@ionic/vue'; import type { ResolveCallback, RejectCallback, Protocol } from '@/types'; -import { useAccounts, useAddressBook } from '@/composables'; +import { useAccounts, useAddressBook, useModals } from '@/composables'; import Modal from '@/popup/components/Modal.vue'; import AddressBookList from '@/popup/components/AddressBook/AddressBookList.vue'; @@ -41,10 +47,12 @@ export default defineComponent({ resolve: { type: Function as PropType, required: true }, reject: { type: Function as PropType, required: true }, protocol: { type: String as PropType, default: null }, + isSigner: Boolean, }, setup(props) { const { activeAccount } = useAccounts(); const { setProtocolFilter } = useAddressBook(); + const { closeAllModals } = useModals(); function handleSelectAddress(address: string) { props.resolve(address); @@ -60,6 +68,7 @@ export default defineComponent({ return { handleSelectAddress, + closeAllModals, }; }, }); diff --git a/src/popup/components/Modals/MultisigVaultCreate.vue b/src/popup/components/Modals/MultisigVaultCreate.vue index 24a846878..317ae6541 100644 --- a/src/popup/components/Modals/MultisigVaultCreate.vue +++ b/src/popup/components/Modals/MultisigVaultCreate.vue @@ -359,7 +359,7 @@ export default defineComponent({ async function updateSignerFromAddressBook(index: number) { const address = await openModal( MODAL_ADDRESS_BOOK_ACCOUNT_SELECTOR, - { protocol: PROTOCOLS.aeternity }, + { protocol: PROTOCOLS.aeternity, isSigner: true }, ); if (address) { updateSigner(index, address); diff --git a/src/popup/locales/en.json b/src/popup/locales/en.json index 7df77a824..129cb76f1 100644 --- a/src/popup/locales/en.json +++ b/src/popup/locales/en.json @@ -633,7 +633,8 @@ "exportAddressBook": "Export", "searchPlaceholder": "Search for name or {0}address", "scanTitle": "Scan the address you want to add", - "selectAddress": "Select recipient’s address", + "selectRecipientAddress": "Select recipient’s address", + "selectSignerAddress": "Select signer’s address", "addAddressRecord": "Add new address records", "noRecords": { "addressBook": "There are no records in your address book.",