Skip to content

Commit

Permalink
chore: edit type
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarsen136 committed Jan 1, 2025
1 parent 774907c commit 194f864
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
13 changes: 7 additions & 6 deletions components/collection/EditModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
<div class="flex justify-between capitalize">
<p>{{ $t(hasMintingPrice ? 'mint.collection.permission.pricePlaceholder' : 'mint.collection.permission.noPriceSet') }}</p>
<NeoSwitch
v-if="selectedMintingType === 'HolderOf'"
v-if="isHolderOfMintingTypeSelected"
v-model="hasMintingPrice"
position="left"
/>
Expand All @@ -175,7 +175,7 @@
</div>
</div>
<div
v-if="selectedMintingType === 'HolderOf'"
v-if="isHolderOfMintingTypeSelected"
class="mt-4"
>
<p class="mb-2">
Expand Down Expand Up @@ -272,6 +272,7 @@ const mintPriceChanged = computed(() => mintingPrice.value !== originalMintPrice
const originalMintPrice = computed(() => props.collection.mintingSettings.price ? Number(props.collection.mintingSettings.price) / (10 ** decimals.value) : null)
const originalHolderOfCollectionId = computed(() => props.collection.mintingSettings.holderOf)
const holderOfCollectionId = ref<string | undefined>(originalHolderOfCollectionId.value)
const isHolderOfMintingTypeSelected = computed(() => selectedMintingType.value === 'HolderOf')
const disabled = computed(() => {
const hasImage = imageUrl.value
Expand All @@ -283,13 +284,13 @@ const disabled = computed(() => {
const holderOfCollectionIdChanged = holderOfCollectionId.value !== originalHolderOfCollectionId.value
const invalidPublicCollection = selectedMintingType.value === 'Public' && !mintingPrice.value
const invalidHolderOfCollection = selectedMintingType.value === 'HolderOf' && !holderOfCollectionId.value
const invalidHolderOfCollection = isHolderOfMintingTypeSelected.value && !holderOfCollectionId.value
return !hasImage || !isNameFilled || invalidHolderOfCollection || invalidPublicCollection
|| (!nameChanged.value && !descriptionChanged && !hasImageChanged.value && !hasBannerChanged && !hasMaxChanged && !mintTypeChanged.value && !mintPriceChanged.value && !holderOfCollectionIdChanged)
})
const permissionSettingWarningMessage = computed(() => selectedMintingType.value && permissionSettingCheckingMap[selectedMintingType.value] && permissionSettingCheckingMap[selectedMintingType.value]())
const permissionSettingWarningMessage = computed(() => selectedMintingType.value && permissionSettingCheckingMap[selectedMintingType.value]?.())
const initLogoImage = () => {
imageUrl.value = originalLogoImageUrl.value
Expand Down Expand Up @@ -331,7 +332,7 @@ watch(isModalActive, (value) => {
}, {
immediate: true,
})
const mintTypeChangeHandlerMap = {
const mintTypeChangeHandlerMap: Record<CollectionMintSettingType, () => void> = {
Issuer: () => {
hasMintingPrice.value = false
mintingPrice.value = null
Expand All @@ -347,7 +348,7 @@ const mintTypeChangeHandlerMap = {
},
}
const permissionSettingCheckingMap = {
const permissionSettingCheckingMap: Record<CollectionMintSettingType, () => string | undefined> = {
Issuer: () => {
if (mintingPrice.value) {
return $i18n.t('mint.collection.permission.issuerWarning')
Expand Down
5 changes: 3 additions & 2 deletions components/collection/SearchInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@

<script setup lang="ts">
import { NeoButton } from '@kodadot1/brick'
import debounce from 'lodash/debounce'
import { fetchCollectionSuggestion } from '@/components/search/utils/collectionSearch'
import { sanitizeIpfsUrl } from '@/utils/ipfs'
import { useCollectionMinimal } from '@/components/collection/utils/useCollectionDetails'
Expand Down Expand Up @@ -99,7 +100,7 @@ watch(initialCollection, (newCollection) => {
immediate: true,
})
const handleSearch = async () => {
const handleSearch = debounce(async () => {
if (!searchQuery.value) {
searchResults.value = []
showResults.value = false
Expand All @@ -113,7 +114,7 @@ const handleSearch = async () => {
)
searchResults.value = results
showResults.value = true
}
}, 500)
const selectCollection = (collection: CollectionMinimal) => {
selectedCollection.value = collection
Expand Down

0 comments on commit 194f864

Please sign in to comment.