Skip to content

Commit 042defb

Browse files
committed
Merge branch 'main' of github.com:kodadot/nft-gallery into refactor--replace-neo-icon-4
2 parents 655affd + d360ffe commit 042defb

File tree

40 files changed

+815
-749
lines changed

40 files changed

+815
-749
lines changed

assets/styles/components/_search.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
box-shadow: none;
8080
}
8181

82-
box-shadow: var(--primary-shadow);
82+
box-shadow: var(--primary-shadow) !important;
8383
border: 1px solid var(--border-color);
8484
color: rgb(var(--text-color));
8585
background: var(--background-color);

components/Error.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<script setup lang="ts">
2929
const props = withDefaults(
3030
defineProps<{
31-
errorCode: number
31+
errorCode?: number
3232
hasImg: boolean
3333
errorTitle: string
3434
errorSubtitle: string

components/collection/HeroButtonAddNfts.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const { urlPrefix } = usePrefix()
1818
1919
const addNfts = () => {
2020
navigateTo({
21-
path: `/${urlPrefix.value}/create`,
21+
path: `/${urlPrefix.value}/create/nft`,
2222
query: {
2323
select: 'nft',
2424
collectionId: id,

components/collection/drop/RefreshMetadata.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
<script setup lang="ts">
1717
import type { Prefix } from '@kodadot1/static'
18-
import { refreshOdaCollectionTokensMetadata } from '@/services/oda'
18+
import { refreshOdaCollection, refreshOdaCollectionTokensMetadata } from '@/services/oda'
1919
2020
const props = defineProps<{
2121
collectionId: string
@@ -27,6 +27,7 @@ const { $i18n } = useNuxtApp()
2727
2828
const refreshMetadata = () => {
2929
toast($i18n.t('toast.refreshMetdata'))
30+
refreshOdaCollection(props.chain, props.collectionId)
3031
refreshOdaCollectionTokensMetadata(props.chain, props.collectionId)
3132
}
3233
</script>

components/create/Confirm/MintConfirmModal.vue

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,10 @@ import ModalBody from '@/components/shared/modals/ModalBody.vue'
5353
import type { BaseMintedCollection } from '@/components/base/types'
5454
import { CreateComponent } from '@/composables/useCreate'
5555
import { useFiatStore } from '@/stores/fiat'
56-
import { usePreferencesStore } from '@/stores/preferences'
5756
import { availablePrefixes } from '@/utils/chain'
5857
import { calculateBalanceUsdValue } from '@/utils/format/balance'
59-
import { BASE_FEE } from '@/utils/support'
6058
import type { AutoTeleportAction } from '@/composables/autoTeleport/types'
59+
import { calculateFees } from '@/composables/transaction/mintToken/utils'
6160
6261
export type NftInformation = {
6362
file: Blob | null
@@ -76,7 +75,7 @@ export type ExtendedInformation = NftInformation & {
7675
networkFee: number
7776
existentialDeposit: number
7877
kodadotFee: number
79-
kodadotUSDFee: number
78+
kodaUSDFee: number
8079
carbonlessFee: number
8180
carbonlessUSDFee: number
8281
totalFee: number
@@ -98,7 +97,6 @@ const { isLogIn, accountId } = useAuth()
9897
const { urlPrefix } = usePrefix()
9998
const { $i18n } = useNuxtApp()
10099
const fiatStore = useFiatStore()
101-
const preferencesStore = usePreferencesStore()
102100
103101
const { metadataDeposit, collectionDeposit, existentialDeposit, itemDeposit, attributeDeposit } = useDeposit(urlPrefix)
104102
@@ -120,22 +118,31 @@ const decimals = computed(() => props.nftInformation.paidToken?.tokenDecimals)
120118
const tokenPrice = computed(() =>
121119
Number(fiatStore.getCurrentTokenValue(chainSymbol.value) ?? 0),
122120
)
123-
const kodadotFee = computed(
124-
() =>
125-
((preferencesStore.hasSupport ? BASE_FEE : 0) / tokenPrice.value)
126-
* Math.pow(10, decimals.value),
127-
)
128-
const carbonlessFee = computed(
129-
() =>
130-
((preferencesStore.hasCarbonOffset && isNFT.value ? BASE_FEE * 2 : 0)
131-
/ tokenPrice.value)
132-
* Math.pow(10, decimals.value),
121+
const { kodaUSDFee, carbonlessUSDFee: carbonlessUSDFeeValue } = calculateFees()
122+
123+
const carbonlessUSDFee = computed(() => isNFT.value ? carbonlessUSDFeeValue : 0)
124+
125+
const convertUSDFeeToToken = (fee: number) => (fee / tokenPrice.value) * Math.pow(10, decimals.value)
126+
const kodadotFee = computed(() => convertUSDFeeToToken(kodaUSDFee))
127+
const carbonlessFee = computed(() => convertUSDFeeToToken(carbonlessUSDFee.value))
128+
129+
const totalFee = computed(() =>
130+
deposit.value + carbonlessFee.value + kodadotFee.value + networkFee.value,
133131
)
134-
const totalFee = computed(() => {
135-
return (
136-
deposit.value + carbonlessFee.value + kodadotFee.value + networkFee.value
137-
)
138-
})
132+
133+
const extendedInformation = computed(() => ({
134+
...props.nftInformation,
135+
networkFee: networkFee.value,
136+
existentialDeposit: deposit.value,
137+
kodadotFee: kodadotFee.value,
138+
kodaUSDFee: kodaUSDFee,
139+
carbonlessFee: carbonlessFee.value,
140+
carbonlessUSDFee: carbonlessUSDFee,
141+
totalFee: totalFee.value,
142+
totalUSDFee: totalUSDFee.value,
143+
blockchain: blockchain.value,
144+
}))
145+
139146
const deposit = computed(
140147
() =>
141148
metadataDeposit.value
@@ -160,19 +167,6 @@ const btnLabel = computed(() => {
160167
})
161168
const disabled = computed(() => !isLogIn.value)
162169
163-
const extendedInformation = computed(() => ({
164-
...props.nftInformation,
165-
networkFee: networkFee.value,
166-
existentialDeposit: deposit.value,
167-
kodadotFee: kodadotFee.value,
168-
kodadotUSDFee: BASE_FEE,
169-
carbonlessFee: carbonlessFee.value,
170-
carbonlessUSDFee: BASE_FEE * 2,
171-
totalFee: totalFee.value,
172-
totalUSDFee: totalUSDFee.value,
173-
blockchain: blockchain.value,
174-
}))
175-
176170
const networkFee = computed(() => {
177171
const extraCallsMultiplier = [
178172
props.nftInformation.listForSale,

components/create/Confirm/PriceItem.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
</NeoTooltip>
7272
</div>
7373
<div class="flex items-center">
74-
{{ nft.kodadotUSDFee }} USD ~
74+
{{ nft.kodaUSDFee }} USD ~
7575
<Money
7676
:value="kodadotFee"
7777
:unit-symbol="chainSymbol"

components/create/CreateCollection.vue

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
@confirm="handleCreateCollectionConfirmation"
2222
/>
2323
<form
24+
ref="formRef"
2425
:class="{
2526
'px-[1.2rem] md:px-8 lg:px-16 py-[3.1rem] sm:py-16 w-full sm:w-1/2 max-w-[40rem] shadow-none lg:shadow-primary lg:border-[1px] lg:border-border-color lg:bg-background-color':
2627
classColumn,
2728
}"
28-
@submit.prevent="showConfirm"
2929
>
3030
<h1 class="title text-3xl mb-7">
3131
{{ $t('mint.collection.create') }}
@@ -155,10 +155,10 @@
155155
class="text-base"
156156
expanded
157157
:label="submitButtonLabel"
158-
native-type="submit"
159158
size="medium"
160159
data-testid="collection-create"
161160
:loading="isLoading"
161+
@click="showConfirm"
162162
/>
163163
<div class="p-4 flex">
164164
<KIcon
@@ -241,6 +241,7 @@ withDefaults(
241241
const mintedCollectionInfo = ref<MintedCollectionInfo>()
242242
const collectionSubscription = ref(() => {})
243243
const displaySuccessModal = ref(false)
244+
const formRef = ref<HTMLFormElement>()
244245
245246
// composables
246247
const { transaction, status, isLoading, isError, blockNumber, txHash }
@@ -253,6 +254,7 @@ const { isTransactionSuccessful } = useTransactionSuccessful({
253254
const { urlPrefix, setUrlPrefix } = usePrefix()
254255
const { $consola, $i18n } = useNuxtApp()
255256
const { isLogIn, accountId } = useAuth()
257+
const { doAfterLogin } = useDoAfterlogin()
256258
257259
// form state
258260
const logo = ref<File | null>(null)
@@ -321,12 +323,21 @@ watch(currentChain, () => {
321323
})
322324
323325
const showConfirm = () => {
324-
if (!menus.find(menu => menu.value === currentChain.value)) {
325-
openReconnectWalletModal()
326-
return
327-
}
328-
doAfterCheckCurrentChainVM(() => {
329-
confirmModal.value = true
326+
doAfterLogin({
327+
onLoginSuccess: () => {
328+
if (formRef.value && !formRef.value.checkValidity()) {
329+
formRef.value.reportValidity()
330+
return
331+
}
332+
if (!menus.find(menu => menu.value === currentChain.value)) {
333+
openReconnectWalletModal()
334+
return
335+
}
336+
doAfterCheckCurrentChainVM(() => {
337+
confirmModal.value = true
338+
})
339+
},
340+
330341
})
331342
}
332343

components/create/CreateLanding.vue

Lines changed: 0 additions & 107 deletions
This file was deleted.

0 commit comments

Comments
 (0)