-
-
Notifications
You must be signed in to change notification settings - Fork 353
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:kodadot/nft-gallery
- Loading branch information
Showing
92 changed files
with
2,606 additions
and
908 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<template> | ||
<div> | ||
<ConfirmPurchaseModal @confirm="onConfirm" /> | ||
<Loader v-model="isLoading" :status="status" /> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { ShoppingActions } from '@/utils/shoppingActions' | ||
import { useShoppingCartStore } from '@/stores/shoppingCart' | ||
import { usePreferencesStore } from '@/stores/preferences' | ||
import { useFiatStore } from '@/stores/fiat' | ||
import { warningMessage } from '@/utils/notification' | ||
import ConfirmPurchaseModal from '@/components/common/confirmPurchaseModal/ConfirmPurchaseModal.vue' | ||
import Loader from '@/components/shared/Loader.vue' | ||
import { TokenToBuy } from '@/composables/transaction/types' | ||
import { ShoppingCartItem } from '@/components/common/shoppingCart/types' | ||
const { urlPrefix } = usePrefix() | ||
const shoppingCartStore = useShoppingCartStore() | ||
const preferencesStore = usePreferencesStore() | ||
const fiatStore = useFiatStore() | ||
const items = computed(() => | ||
shoppingCartStore.getItemsByPrefix(urlPrefix.value) | ||
) | ||
onMounted(async () => { | ||
if ( | ||
fiatStore.getCurrentKSMValue === null || | ||
fiatStore.getCurrentDOTValue === null || | ||
fiatStore.getCurrentBSXValue === null | ||
) { | ||
fiatStore.fetchFiatPrice() | ||
} | ||
}) | ||
const { transaction, status, isLoading } = useTransaction() | ||
const { $i18n } = useNuxtApp() | ||
const ShoppingCartItemToTokenToBuy = (item: ShoppingCartItem): TokenToBuy => { | ||
return { | ||
currentOwner: item.currentOwner, | ||
price: item.price, | ||
id: item.id, | ||
royalty: item.royalty, | ||
} | ||
} | ||
watchEffect(() => { | ||
if (isLoading.value === false && status.value === 'loader.finalized') { | ||
preferencesStore.setTriggerBuySuccess(true) | ||
shoppingCartStore.clear() | ||
} | ||
}) | ||
const onConfirm = () => { | ||
if (preferencesStore.getCompletePurchaseModal.mode === 'shopping-cart') { | ||
handleBuy(items.value.map(ShoppingCartItemToTokenToBuy)) | ||
} else { | ||
handleBuy( | ||
ShoppingCartItemToTokenToBuy( | ||
shoppingCartStore.getItemToBuy as ShoppingCartItem | ||
) | ||
) | ||
shoppingCartStore.removeItemToBuy() | ||
} | ||
} | ||
const handleBuy = async (nfts: TokenToBuy | TokenToBuy[]) => { | ||
try { | ||
await transaction({ | ||
interaction: ShoppingActions.BUY, | ||
nfts, | ||
urlPrefix: urlPrefix.value, | ||
successMessage: $i18n.t('mint.successNewNfts'), | ||
errorMessage: $i18n.t('transaction.buy.error'), | ||
}) | ||
} catch (error) { | ||
warningMessage(error) | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,22 @@ | ||
import ConnectWalletModal from './ConnectWalletModal.vue' | ||
|
||
import { ModalProgrammatic as Modal } from 'buefy' | ||
import { BModalComponent, BModalConfig } from 'buefy/types/components' | ||
export const ConnectWalletModalConfig = { | ||
component: ConnectWalletModal, | ||
canCancel: ['escape', 'outside'], | ||
customClass: 'connect-wallet-modal', | ||
autoFocus: false, | ||
} | ||
|
||
export const openConnectWalletModal = (instance) => { | ||
const modal = ref<BModalComponent | null>() | ||
|
||
modal.value = Modal.open({ | ||
parent: instance?.proxy, | ||
onCancel: () => { | ||
modal.value = null | ||
document.body.classList.remove('is-clipped') | ||
}, | ||
...ConnectWalletModalConfig, | ||
} as unknown as BModalConfig) | ||
} |
66 changes: 66 additions & 0 deletions
66
components/common/confirmPurchaseModal/ConfirmPurchaseItemRow.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<template> | ||
<div class="is-flex is-justify-content-space-between"> | ||
<div class="is-flex pr-2"> | ||
<div> | ||
<BasicImage | ||
:src="avatar" | ||
:alt="nft?.name" | ||
class="border image is-48x48" /> | ||
</div> | ||
<div | ||
class="is-flex is-flex-direction-column is-justify-content-space-between ml-4 limit-width"> | ||
<div | ||
class="has-text-weight-bold has-text-color line-height-1 no-wrap is-clipped ellipsis"> | ||
{{ nft.name }} | ||
</div> | ||
<div class="line-height-1 no-wrap is-clipped ellipsis"> | ||
{{ nft.collection?.name || nft.collection.id }} | ||
</div> | ||
</div> | ||
</div> | ||
<div class="is-flex is-align-items-end no-wrap line-height-1"> | ||
<CommonTokenMoney :value="nft.price" /> | ||
</div> | ||
</div> | ||
</template> | ||
<script setup lang="ts"> | ||
import { parseNftAvatar } from '@/utils/nft' | ||
import BasicImage from '@/components/shared/view/BasicImage.vue' | ||
import { ShoppingCartItem } from '../shoppingCart/types' | ||
import CommonTokenMoney from '@/components/shared/CommonTokenMoney.vue' | ||
const avatar = ref<string>() | ||
const props = defineProps<{ | ||
nft: ShoppingCartItem | ||
}>() | ||
const getAvatar = async () => { | ||
if (props.nft) { | ||
avatar.value = await parseNftAvatar(props.nft) | ||
} | ||
} | ||
onMounted(() => { | ||
getAvatar() | ||
}) | ||
</script> | ||
<style scoped lang="scss"> | ||
@import '@/styles/abstracts/variables'; | ||
.limit-width { | ||
max-width: 170px; | ||
} | ||
.ellipsis { | ||
text-overflow: ellipsis; | ||
} | ||
.line-height-1 { | ||
line-height: 1; | ||
} | ||
</style> |
Oops, something went wrong.