Skip to content

Commit

Permalink
✨ minting Modal
Browse files Browse the repository at this point in the history
  • Loading branch information
daiagi committed Apr 22, 2023
1 parent 54d3eac commit 77d56d2
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 19 deletions.
41 changes: 28 additions & 13 deletions components/massmint/Massmint.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@
<EditPanel
:nft="nftBeingEdited"
:open="sideBarOpen"
@close="closeSideBar"
@close="sideBarOpen = false"
@save="updateNFT" />
<div class="mt-6 is-flex is-justify-content-center w-full">
<NeoButton
class="is-flex is-flex-grow-1 limit-width"
:label="mintButtonLabel"
variant="k-accent"
:disabled="!mediaLoaded"
@click.native="openMintModal" />
@click.native="openReviewModal" />
</div>
<DeleteModal
v-if="nftInDeleteModal"
Expand All @@ -62,7 +62,12 @@
v-model="overViewModalOpen"
:num-missing-descriptions="numberOfMissingDescriptions"
:num-nfts="Object.keys(NFTS).length"
@close="overViewModalOpen = false" />
@close="overViewModalOpen = false"
@mint="startMint" />
<MintingModal
v-model="mintModalOpen"
:loading="isMinting"
@close="mintModalOpen = false" />
</div>
</template>

Expand All @@ -79,27 +84,33 @@ import { NFT } from './types'
import MissingInfoModal from './modals/MissingInfoModal.vue'
import ReviewModal from './modals/ReviewModal.vue'
import DeleteModal from './modals/DeleteModal.vue'
import MintingModal from './modals/MintingModal.vue'
const preferencesStore = usePreferencesStore()
const { $consola, $i18n } = useNuxtApp()
const router = useRouter()
const route = useRoute()
const { urlPrefix } = usePrefix()
const selectedCollection = ref<MintedCollection>()
const NFTS = ref<{ [nftId: string]: NFT }>({})
const mediaLoaded = ref(false)
const nftBeingEdited = ref<NFT>()
const nftInDeleteModal = ref<NFT>()
const sideBarOpen = ref(false)
const deleteModalOpen = ref(false)
const missingInfoModalOpen = ref(false)
const overViewModalOpen = ref(false)
const mintModalOpen = ref(false)
const isMinting = ref(false)
const numberOfMissingNames = computed(
() => Object.values(NFTS.value).filter((nft) => !nft.name).length
)
const numberOfMissingDescriptions = computed(
() => Object.values(NFTS.value).filter((nft) => !nft.description).length
)
const missingInfoModalOpen = ref(false)
const overViewModalOpen = ref(false)
const openSideBarWith = (nft: NFT) => {
nftBeingEdited.value = nft
sideBarOpen.value = true
Expand All @@ -113,22 +124,26 @@ const closeDeleteModal = () => {
nftInDeleteModal.value = undefined
}
const openMintModal = () => {
const openReviewModal = () => {
if (numberOfMissingNames.value > 0) {
missingInfoModalOpen.value = true
return
}
overViewModalOpen.value = true
}
const closeSideBar = () => {
sideBarOpen.value = false
const startMint = () => {
overViewModalOpen.value = false
mintModalOpen.value = true
isMinting.value = true
// fake mint
setTimeout(() => {
isMinting.value = false
}, 5000)
}
const tabs = ['Collection', 'NFT', 'Mass Mint']
const selectedCollection = ref<MintedCollection>()
const NFTS = ref<{ [nftId: string]: NFT }>({})
const mediaLoaded = ref(false)
const tabs = ['Collection', 'NFT', 'Mass Mint']
const onCollectionSelected = (collection) => {
selectedCollection.value = collection
Expand Down
44 changes: 44 additions & 0 deletions components/massmint/modals/MintingModal.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<template>
<NeoModal v-model="isModalActive" scroll="clip" :can-cancel="!loading">
<div class="p-7">
<div
v-if="loading"
class="is-flex is-flex-direction-column is-align-items-center">
<img src="/preloader.svg" width="200" />
<span class="mt-6">Minting Your NFTS...</span>
</div>
<div
v-else
class="is-flex is-flex-direction-column is-align-items-center">
<NeoIcon icon="circle-check" class="check-icon has-text-k-green" />
<span class="mt-4">All of your NFTs were successfuly minted.</span>
<div class="is-flex w-full is-justify-content-center pt-5 px-7">
<NeoButton
:label="'Done'"
variant="k-accent"
class="is-flex is-flex-grow-1"
@click.native="emit('close')" />
</div>
</div>
</div>
</NeoModal>
</template>

<script setup lang="ts">
import { NeoButton, NeoIcon, NeoModal } from '@kodadot1/brick'
const props = defineProps<{
value: boolean
loading: boolean
}>()
const isModalActive = useVModel(props, 'value')
const emit = defineEmits(['close'])
</script>

<style lang="scss" scoped>
.check-icon {
font-size: 2.5rem;
}
</style>
4 changes: 2 additions & 2 deletions components/massmint/modals/ReviewModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
:label="$t('massmint.yesMint')"
:variant="mintBtnVariant"
class="min-width is-flex is-flex-grow-1"
@click.native="emit('close')" />
@click.native="emit('mint')" />
<NeoButton
:label="$t('massmint.cancel')"
:variant="cancelBtnVariant"
Expand Down Expand Up @@ -65,7 +65,7 @@ const cancelBtnVariant = computed(() =>
const isModalActive = useVModel(props, 'value')
const emit = defineEmits(['close'])
const emit = defineEmits(['close', 'mint'])
</script>

<style lang="scss" scoped>
Expand Down
16 changes: 12 additions & 4 deletions libs/ui/src/components/NeoModal/NeoModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
class="neo-modal"
:scroll="scroll"
:active.sync="isModalActive"
:can-cancel="canCancel"
@close="updateClose">
<slot />
</o-modal>
Expand All @@ -11,10 +12,17 @@
<script lang="ts" setup>
import { OModal } from '@oruga-ui/oruga'
const props = defineProps<{
value: boolean
scroll?: 'clip' | 'keep'
}>()
const props = withDefaults(
defineProps<{
value: boolean
scroll?: 'clip' | 'keep'
canCancel?: string[] | boolean
}>(),
{
canCancel: true,
scroll: 'keep',
}
)
const emit = defineEmits(['close'])
Expand Down

0 comments on commit 77d56d2

Please sign in to comment.