Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💄 [Transfer] Show displayName instead of address #811

Merged
merged 2 commits into from
Nov 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion src/components/EventModal/Transfer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,16 @@
<FormField
class="mx-[8px]"
:label="$t('tx_modal_label_receiver')"
>{{ toWallet }}</FormField>
>
<div class="flex items-center gap-[8px]">
<Identity
v-if="toUserAvatar"
:avatar-url="toUserAvatar"
:avatar-size="36"
/>
{{ toDisplayName | ellipsis }}
</div>
</FormField>
</div>
<template
v-if="!isTransferring"
Expand All @@ -120,9 +129,14 @@
</template>

<script>
import { mapActions, mapGetters } from 'vuex';
import { LIKE_ADDRESS_REGEX } from '~/util/nft';
import { ellipsis } from '~/util/ui';

export default {
filters: {
ellipsis,
},
props: {
classId: {
type: String,
Expand Down Expand Up @@ -157,6 +171,7 @@ export default {
};
},
computed: {
...mapGetters(['getUserInfoByAddress']),
errorMessage() {
if (this.toWallet && !LIKE_ADDRESS_REGEX.test(this.toWallet)) {
return this.$t('nft_details_page_errormessage_transfer_invalid');
Expand All @@ -172,6 +187,14 @@ export default {
isReady() {
return this.toWallet && !this.errorMessage;
},
toDisplayName() {
return (
this.getUserInfoByAddress(this.toWallet)?.displayName || this.toWallet
);
},
toUserAvatar() {
return this.getUserInfoByAddress(this.toWallet)?.avatar;
},
},
watch: {
isOpen(isOpen) {
Expand All @@ -189,13 +212,15 @@ export default {
},
},
methods: {
...mapActions(['lazyGetUserInfoByAddress']),
handleInputToWallet(value) {
this.toWallet = value;
},
handleInputMemo(value) {
this.memo = value;
},
handleClickTransfer() {
this.lazyGetUserInfoByAddress(this.toWallet);
this.$emit('submit', {
toWallet: this.toWallet,
nftId: this.selectedNFTId,
Expand Down