Skip to content

Commit

Permalink
fix: wordings in multisig
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandros Kalogerakis committed Nov 4, 2024
1 parent adb61d4 commit e23f2fc
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 14 deletions.
10 changes: 9 additions & 1 deletion src/composables/accountSelector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
5 changes: 5 additions & 0 deletions src/composables/modals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ export function useModals() {
});
}

function closeAllModals() {
modalsOpen.value.forEach((modal) => closeModalByKey(modal.key));
}

function openModal<T = void>(name: string, props: IModalProps = {}): Promise<T> {
const modalSettings = modalsRegistered.get(name);

Expand Down Expand Up @@ -226,5 +230,6 @@ export function useModals() {
openPasswordLoginModal,
openEnableBiometricLoginModal,
closeModalByKey,
closeAllModals,
};
}
21 changes: 13 additions & 8 deletions src/popup/components/AddressBook/AddressBookList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@
v-text="noRecordsMessage"
/>
<BtnMain
v-if="isSelector && accountSelectType === ACCOUNT_SELECT_TYPE_FILTER.addressBook"
variant="muted"
extend
:to="{ name: ROUTE_ADDRESS_BOOK }"
:icon="PlusCircleIcon"
@click="closeModals"
>
{{ $t('pages.addressBook.addAddressRecord') }}
</BtnMain>
Expand Down Expand Up @@ -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<ComponentRef>();
const isScrolled = ref(false);
Expand Down Expand Up @@ -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);
}
});
Expand All @@ -216,6 +219,7 @@ export default defineComponent({
return {
ROUTE_ADDRESS_BOOK_EDIT,
ROUTE_ADDRESS_BOOK,
ACCOUNT_SELECT_TYPE_FILTER,
scrollWrapperEl,
isSearchVisible,
hasBookmarkedEntries,
Expand All @@ -226,6 +230,7 @@ export default defineComponent({
protocolName,
bgColorStyle,
accountIcon,
closeModals,
PlusCircleIcon,
};
},
Expand Down Expand Up @@ -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 {
Expand Down
15 changes: 12 additions & 3 deletions src/popup/components/Modals/AddressBookAccountSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@
<IonPage>
<h2
class="header"
v-text="$t('pages.addressBook.selectAddress')"
v-text="(
isSigner ? $t('pages.addressBook.selectSignerAddress') : $t('pages.addressBook.selectRecipientAddress')
)"
/>
<AddressBookList
is-selector
@select-address="handleSelectAddress"
@close-all="closeAllModals"
/>
<AddressBookList is-selector @select-address="handleSelectAddress" />
</IonPage>
</Modal>
</template>
Expand All @@ -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';
Expand All @@ -41,10 +47,12 @@ export default defineComponent({
resolve: { type: Function as PropType<ResolveCallback>, required: true },
reject: { type: Function as PropType<RejectCallback>, required: true },
protocol: { type: String as PropType<Protocol>, default: null },
isSigner: Boolean,
},
setup(props) {
const { activeAccount } = useAccounts();
const { setProtocolFilter } = useAddressBook();
const { closeAllModals } = useModals();
function handleSelectAddress(address: string) {
props.resolve(address);
Expand All @@ -60,6 +68,7 @@ export default defineComponent({
return {
handleSelectAddress,
closeAllModals,
};
},
});
Expand Down
2 changes: 1 addition & 1 deletion src/popup/components/Modals/MultisigVaultCreate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ export default defineComponent({
async function updateSignerFromAddressBook(index: number) {
const address = await openModal<Encoded.AccountAddress>(
MODAL_ADDRESS_BOOK_ACCOUNT_SELECTOR,
{ protocol: PROTOCOLS.aeternity },
{ protocol: PROTOCOLS.aeternity, isSigner: true },
);
if (address) {
updateSigner(index, address);
Expand Down
3 changes: 2 additions & 1 deletion src/popup/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down

0 comments on commit e23f2fc

Please sign in to comment.