diff --git a/components/collection/HeroButtonDeleteNfts.vue b/components/collection/HeroButtonDeleteNfts.vue index 6e891ac433..6f66c65c08 100644 --- a/components/collection/HeroButtonDeleteNfts.vue +++ b/components/collection/HeroButtonDeleteNfts.vue @@ -12,8 +12,8 @@ diff --git a/components/common/ItemTransferModal.vue b/components/common/ItemTransferModal.vue new file mode 100644 index 0000000000..883d1079a8 --- /dev/null +++ b/components/common/ItemTransferModal.vue @@ -0,0 +1,114 @@ + + + diff --git a/components/common/itemTransfer/ItemTransferModal.vue b/components/common/itemTransfer/ItemTransferModal.vue deleted file mode 100644 index ff3fdbad16..0000000000 --- a/components/common/itemTransfer/ItemTransferModal.vue +++ /dev/null @@ -1,284 +0,0 @@ - - - diff --git a/components/common/listingCart/ListingCartMini.vue b/components/common/listingCart/ListingCartMini.vue index 4b72e249b1..893e80f5cf 100644 --- a/components/common/listingCart/ListingCartMini.vue +++ b/components/common/listingCart/ListingCartMini.vue @@ -35,6 +35,22 @@
+ + + {{ $t('burn') }} + + + {{ $t('transfer') }} @@ -76,12 +92,14 @@ import { NeoButton, NeoTooltip } from '@kodadot1/brick' import { useListingCartStore } from '@/stores/listingCart' import { usePreferencesStore } from '@/stores/preferences' -import { listVisible } from '@/utils/config/permission.config' +import { listVisible, burnVisible } from '@/utils/config/permission.config' const listingCartStore = useListingCartStore() const preferencesStore = usePreferencesStore() const { urlPrefix } = usePrefix() +const { isEvm } = useIsChain(urlPrefix) +const isItemBurnDisabled = computed(() => isEvm.value ? listingCartStore.count > 1 : !burnVisible(urlPrefix.value)) const isItemTransferDisabled = computed(() => isSub(urlPrefix.value) ? false : listingCartStore.count > 1) const isListingDisabled = computed(() => !listVisible(urlPrefix.value)) diff --git a/components/common/userCart/UserCartModal.vue b/components/common/userCart/UserCartModal.vue new file mode 100644 index 0000000000..91bf85e6f1 --- /dev/null +++ b/components/common/userCart/UserCartModal.vue @@ -0,0 +1,221 @@ + + + diff --git a/components/common/userCart/UserCartModals.vue b/components/common/userCart/UserCartModals.vue new file mode 100644 index 0000000000..f3f072cba4 --- /dev/null +++ b/components/common/userCart/UserCartModals.vue @@ -0,0 +1,10 @@ + + + diff --git a/components/common/itemTransfer/ItemTransferMultipleItems.vue b/components/common/userCart/UserCartMultipleItems.vue similarity index 100% rename from components/common/itemTransfer/ItemTransferMultipleItems.vue rename to components/common/userCart/UserCartMultipleItems.vue diff --git a/components/common/itemTransfer/ItemTransferSingleItem.vue b/components/common/userCart/UserCartSingleItem.vue similarity index 100% rename from components/common/itemTransfer/ItemTransferSingleItem.vue rename to components/common/userCart/UserCartSingleItem.vue diff --git a/components/gallery/GalleryItemButton/GalleryItemMoreActionBtn.vue b/components/gallery/GalleryItemButton/GalleryItemMoreActionBtn.vue index 99f39ddb53..6273b793df 100644 --- a/components/gallery/GalleryItemButton/GalleryItemMoreActionBtn.vue +++ b/components/gallery/GalleryItemButton/GalleryItemMoreActionBtn.vue @@ -4,10 +4,10 @@ :title="signingModalTitle" :is-loading="isLoading" :status="status" - @try-again="burn" + @try-again="tryAgain" /> - + Transfer NFT @@ -73,7 +73,6 @@ import { sanitizeIpfsUrl, toOriginalContentUrl } from '@/utils/ipfs' import { isMobileDevice } from '@/utils/extension' import { hasOperationsDisabled } from '@/utils/prefix' import { refreshOdaTokenMetadata } from '@/services/oda' -import ItemTransferModal from '@/components/common/itemTransfer/ItemTransferModal.vue' import type { NFT } from '@/types' import type { Abi } from '@/composables/transaction/types' @@ -94,8 +93,9 @@ const props = defineProps<{ abi?: Abi | null }>() -const action = ref('') +const action = ref<'unlist' | ''>('') +const id = computed(() => route.params.id.toString()) const isOwner = computed(() => accountId.value === props.nft?.currentOwner) const isCollectionOwner = computed(() => accountId.value === props.nft?.collection?.currentOwner) const nftId = computed(() => props.nft?.id || '') @@ -103,7 +103,7 @@ const nftId = computed(() => props.nft?.id || '') const { data } = useQuery({ queryKey: ['nft-with-metadata', nftId], queryFn: async () => - nftId.value && canTransfer.value + nftId.value && canDoActions.value ? (await useAsyncGraphql({ query: 'nftEntitiesByIDs', variables: { ids: [nftId.value] }, @@ -112,12 +112,11 @@ const { data } = useQuery({ }) const nftWithMetadata = computed(() => data.value?.nftEntities?.[0]) -const canTransfer = computed(() => props.nft && isOwner.value) +const canDoActions = computed(() => props.nft && isOwner.value) const signingModalTitle = computed(() => { return ( { - burn: $i18n.t('mint.nft.burning'), unlist: $i18n.t('mint.nft.delisting'), }[action.value] || '' ) @@ -165,17 +164,12 @@ const downloadMedia = async () => { } const burn = () => { - action.value = 'burn' - transaction({ - interaction: Interaction.CONSUME, - urlPrefix: urlPrefix.value, - nftId: route.params.id as string, - nftSn: props.nft?.sn as string, - collectionId: props.nft?.collection?.id as string, - abi: props.abi, - successMessage: $i18n.t('transaction.consume.success') as string, - errorMessage: $i18n.t('transaction.consume.error') as string, - }) + openUserCartModal('burn') +} + +const tryAgain = () => { + const map = { unlist } + map[action.value]?.() } const unlist = () => { @@ -184,7 +178,7 @@ const unlist = () => { interaction: Interaction.LIST, urlPrefix: urlPrefix.value, token: { - nftId: route.params.id as string, + nftId: id.value, price: '0', }, successMessage: $i18n.t('transaction.unlist.success') as string, @@ -199,10 +193,12 @@ const refreshMetadata = async () => { } } -const transfer = () => { +const openUserCartModal = (mode: UserCartMode) => { if (nftWithMetadata.value) { listNftByNftWithMetadata(nftWithMetadata.value) - preferencesStore.itemTransferCartModalOpen = true + preferencesStore.setOpenedUserCartModal(mode) } } + +const transfer = () => openUserCartModal('transfer') diff --git a/components/migrate/steps/SignLoader3.vue b/components/migrate/steps/SignLoader3.vue index e704859fee..ddc182f8eb 100644 --- a/components/migrate/steps/SignLoader3.vue +++ b/components/migrate/steps/SignLoader3.vue @@ -82,8 +82,10 @@