Skip to content

Commit

Permalink
Merge pull request #11365 from hassnian/issue-11364
Browse files Browse the repository at this point in the history
ref: Remove Minted NFT Congratulations Notification
  • Loading branch information
vikiival authored Jan 23, 2025
2 parents 1436f51 + 926ad12 commit 6478eb6
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 146 deletions.
70 changes: 0 additions & 70 deletions components/MessageNotify.vue

This file was deleted.

9 changes: 3 additions & 6 deletions components/create/CreateNft.vue
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ import type { AutoTeleportAction } from '@/composables/autoTeleport/types'
import type { AutoTeleportActionButtonConfirmEvent } from '@/components/common/autoTeleport/AutoTeleportActionButton.vue'
// composables
const { $consola } = useNuxtApp()
const { $consola, $i18n } = useNuxtApp()
const { urlPrefix, setUrlPrefix } = usePrefix()
const { accountId } = useAuth()
const { transaction, status, isLoading, blockNumber, isError }
Expand Down Expand Up @@ -606,18 +606,15 @@ watchEffect(async () => {
&& transactionStatus.value === 'done'
) {
infoMessage(
`You will go to the detail in ${DETAIL_TIMEOUT / 1000} seconds`,
$i18n.t('mint.nft.redirect', [DETAIL_TIMEOUT / 1000]),
{ duration: DETAIL_TIMEOUT },
)
await delay(DETAIL_TIMEOUT)
const nftId = await getNftId()
if (nftId) {
router.push({
path: `/${urlPrefix.value}/gallery/${nftId}`,
query: { congratsNft: form.name },
})
router.push(`/${urlPrefix.value}/gallery/${nftId}`)
}
else {
retry.value -= 1
Expand Down
17 changes: 0 additions & 17 deletions components/gallery/GalleryItem.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<template>
<section class="py-5 gallery-item">
<MessageNotify
v-if="congratsNewNft"
:title="$t('mint.success')"
:subtitle="$t('mint.successCreateNewNft', [congratsNewNft])"
/>
<div class="flex flex-col lg:flex-row">
<div class="w-full lg:w-2/5 lg:pr-7 group">
<div
Expand Down Expand Up @@ -184,7 +179,6 @@ import { useGalleryItem } from './useGalleryItem'
import { GALLERY_ITEM_TABS } from '@/components/gallery/GalleryItemTabsPanel/types'
import CollectionDetailsPopover from '@/components/collectionDetailsPopover/CollectionDetailsPopover.vue'
import { usePreferencesStore } from '@/stores/preferences'
import { exist } from '@/utils/exist'
import { formatBalanceEmptyOnZero, formatNumber } from '@/utils/format/balance'
import { resolveMedia, MediaType } from '@/utils/gallery/media'
import { sanitizeIpfsUrl, toOriginalContentUrl } from '@/utils/ipfs'
Expand All @@ -197,8 +191,6 @@ const NuxtImg = resolveComponent('NuxtImg')
const { urlPrefix } = usePrefix()
const { isAssetHub } = useIsChain(urlPrefix)
const route = useRoute()
const router = useRouter()
const { placeholder } = useTheme()
const mediaItemRef = ref<{
isLewdBlurredLayer: boolean
Expand Down Expand Up @@ -251,15 +243,6 @@ watch(triggerOfferSuccess, (value) => {
}
})
const congratsNewNft = ref('')
onMounted(() => {
exist(route.query.congratsNft as string, (val) => {
congratsNewNft.value = val || ''
router.replace({ query: {} })
})
})
const { isUnlockable, unlockLink } = useUnlockable(collection)
const title = computed(() =>
Expand Down
7 changes: 1 addition & 6 deletions composables/transaction/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,10 @@ import type { Extrinsic } from '@/utils/transactionExecutor'
import type { Metadata } from '@/services/nftStorage'

type SuccessFunctionMessage = (blockNumber: string) => string
export type ObjectMessage = {
message: string | SuccessFunctionMessage
large: boolean
shareLink?: string
}

export type ExecuteTransactionSuccessMessage =
| string
| SuccessFunctionMessage
| ObjectMessage

type BaseExecuteTransactionParams = {
arg: any[]
Expand Down
21 changes: 1 addition & 20 deletions composables/useTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import type {
ExecuteEvmTransactionParams,
ExecuteSubstrateTransactionParams,
ExecuteTransactionParams,
ObjectMessage,
ActionCancelSwap,
ActionAcceptSwap,
} from './transaction/types'
Expand All @@ -57,7 +56,6 @@ import { doAfterCheckCurrentChainVM } from '@/components/common/ConnectWallet/op
import { hasOperationsDisabled } from '@/utils/prefix'
import { ShoppingActions } from '@/utils/shoppingActions'
import {
showLargeNotification,
successMessage as successNotification,
warningMessage,
} from '@/utils/notification'
Expand All @@ -66,16 +64,6 @@ export type TransactionOptions = {
disableSuccessNotification?: boolean
}

const resolveLargeSuccessNotification = (
block: string,
objectMessage: ObjectMessage,
) => {
const { $i18n } = useNuxtApp()
const title = $i18n.t('mint.success')
const message = resolveSuccessMessage(block, objectMessage.message)
showLargeNotification({ message, title, shareLink: objectMessage.shareLink })
}

const resolveMessage = (message?: string | (() => string)) => {
if (!message) {
return
Expand Down Expand Up @@ -132,15 +120,8 @@ const useExecuteTransaction = (options: TransactionOptions) => {
return
}

const isObject = typeof successMessage === 'object'
if (isObject && successMessage.large) {
return resolveLargeSuccessNotification(block, successMessage)
}
const message = resolveSuccessMessage(block, successMessage)

const message = resolveSuccessMessage(
block,
isObject ? successMessage.message : successMessage,
)
successNotification(message)
}

Expand Down
2 changes: 1 addition & 1 deletion locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1360,6 +1360,7 @@
"title": "Preview",
"uploadArt": "Upload your art to see a preview of your NFT here"
},
"redirect": "You will be redirected to the NFT detail in {0} seconds.",
"sale": {
"label": "List For Sale On Marketplace",
"message": "People will be able to buy your NFT."
Expand All @@ -1377,7 +1378,6 @@
"shareWithFriends": "Share {0} with your friends",
"submit": "Click to create NFT(s)",
"success": "Congratulations",
"successCreateNewNft": "You have successfully created {0}",
"successNewNfts": "You have successfully purchased this NFT",
"successPurchasedNfts": "You have successfully purchased {0}",
"transform": "Transform commands in NFT",
Expand Down
1 change: 0 additions & 1 deletion locales/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,6 @@
"shareWithFriends": "अपने दोस्तों के साथ {0} साझा करें",
"submit": "NFT(s) बनाने के लिए Click करें",
"success": "बधाई हो",
"successCreateNewNft": "आपने {0} को सफलता पूर्वक बनाया है",
"successNewNfts": "आपने सफलता पूर्वक इस NFT को खरीदा है",
"successPurchasedNfts": "आपने {0} को सफलता पूर्वक खरीदा है",
"transform": "NFT में कमांड ट्रांसफ़ॉर्म करें",
Expand Down
25 changes: 0 additions & 25 deletions utils/notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
import consola from 'consola'
import { h } from 'vue'
import Notification from '@/components/common/Notification.vue'
import MessageNotify from '@/components/MessageNotify.vue'

export type NotificationAction = { label: string, url: string, icon?: string }

Expand Down Expand Up @@ -80,30 +79,6 @@ export const showNotification = ({
return notification.close as () => void
}

export const showLargeNotification = ({
message,
title,
duration = 10000,
shareLink = undefined,
}: {
message: string
title?: string
duration?: number
shareLink?: string
}): void => {
Notif.open({
component: h(MessageNotify, {
title: title,
subtitle: message,
noToast: true,
shareLink,
}),
duration,
variant: 'component',
closable: true,
})
}

export const infoMessage = (
message,
{
Expand Down

0 comments on commit 6478eb6

Please sign in to comment.