Date: Tue, 31 Dec 2024 21:02:45 +0100
Subject: [PATCH 07/12] fix: collection permission edit
---
components/collection/EditModal.vue | 39 +++++++++++--------
.../collection/HeroButtonEditCollection.vue | 16 ++++++--
components/collection/SearchInput.vue | 31 ++++++++++-----
3 files changed, 57 insertions(+), 29 deletions(-)
diff --git a/components/collection/EditModal.vue b/components/collection/EditModal.vue
index b261c61e2f..9e9d64c18d 100644
--- a/components/collection/EditModal.vue
+++ b/components/collection/EditModal.vue
@@ -127,6 +127,7 @@
@@ -149,15 +150,15 @@
-
{{ $t(mintingPriceUnset ? 'mint.collection.permission.noPriceSet' : 'mint.collection.permission.pricePlaceholder') }}
+
{{ $t(hasMintingPrice ? 'mint.collection.permission.pricePlaceholder' : 'mint.collection.permission.noPriceSet') }}
()
const imageUrl = ref
()
const bannerUrl = ref()
const unlimited = ref(true)
-const mintingPriceUnset = ref(true)
+const hasMintingPrice = ref(false)
const mintingPrice = ref(null)
+
const selectedMintingType = ref(null)
const min = computed(() => props.min || 1)
const max = ref(null)
@@ -304,7 +306,7 @@ const editCollection = async () => {
max: max.value,
mintingSettings: {
mintType: selectedMintingType.value,
- price: mintingPriceUnset.value ? null : String(withDecimals(mintingPrice.value || 0)),
+ price: hasMintingPrice.value ? String(withDecimals(mintingPrice.value || 0)) : null,
holderOf: holderOfCollectionId.value || originalHolderOfCollectionId.value,
},
} as UpdateCollection)
@@ -322,19 +324,26 @@ watch(isModalActive, (value) => {
// permission
selectedMintingType.value = props.collection.mintingSettings.mintType
- mintingPriceUnset.value = !props.collection.mintingSettings.price
+ hasMintingPrice.value = Boolean(props.collection.mintingSettings.price)
mintingPrice.value = originalMintPrice.value || null
holderOfCollectionId.value = originalHolderOfCollectionId.value
}
+}, {
+ immediate: true,
})
-
-const priceHandlerMap = {
+const mintTypeChangeHandlerMap = {
Issuer: () => {
+ hasMintingPrice.value = false
mintingPrice.value = null
- mintingPriceUnset.value = true
},
Public: () => {
- mintingPriceUnset.value = false
+ hasMintingPrice.value = true
+ mintingPrice.value = null
+ },
+ HolderOf: () => {
+ hasMintingPrice.value = false
+ mintingPrice.value = null
+ holderOfCollectionId.value = undefined
},
}
@@ -358,19 +367,17 @@ const permissionSettingCheckingMap = {
},
}
-watch(selectedMintingType, (type) => {
- if (type && priceHandlerMap[type]) {
- priceHandlerMap[type as CollectionMintSettingType]()
+watch(selectedMintingType, (type, oldType) => {
+ if (oldType && type && mintTypeChangeHandlerMap[type]) {
+ mintTypeChangeHandlerMap[type as CollectionMintSettingType]()
}
})
-watch([banner, unlimited, mintingPriceUnset], ([banner, unlimited, priceUnset]) => {
+watch([banner, unlimited], ([banner, unlimited]) => {
if (banner) {
bannerUrl.value = URL.createObjectURL(banner)
}
max.value = unlimited ? null : max.value || props.collection.max
-
- mintingPrice.value = priceUnset ? null : originalMintPrice.value
})
diff --git a/components/collection/HeroButtonEditCollection.vue b/components/collection/HeroButtonEditCollection.vue
index 50e990ba7a..7509312503 100644
--- a/components/collection/HeroButtonEditCollection.vue
+++ b/components/collection/HeroButtonEditCollection.vue
@@ -25,7 +25,7 @@
diff --git a/components/collection/SearchInput.vue b/components/collection/SearchInput.vue
index e32d368036..5ece8bbd38 100644
--- a/components/collection/SearchInput.vue
+++ b/components/collection/SearchInput.vue
@@ -17,10 +17,14 @@
class="p-2 flex items-center cursor-pointer hover:bg-k-hover text-text-color"
@click="selectCollection(collection)"
>
-
+
+
+
+
{{ collection.name }}
@@ -29,14 +33,18 @@
v-if="selectedCollection"
class="mt-2.5"
>
-
-
-
{{ selectedCollection.name }}
+
+
+
+
+
{{ selectedCollection.name }}
{
image: newCollection.meta.image,
}
}
+}, {
+ immediate: true,
})
const handleSearch = async () => {
From b1d1af808ef0e31a641c1479fd7824561fe9afee Mon Sep 17 00:00:00 2001
From: Jarsen <31397967+Jarsen136@users.noreply.github.com>
Date: Wed, 1 Jan 2025 12:22:30 +0100
Subject: [PATCH 08/12] fix: search input
---
components/collection/SearchInput.vue | 1 +
1 file changed, 1 insertion(+)
diff --git a/components/collection/SearchInput.vue b/components/collection/SearchInput.vue
index 5ece8bbd38..15479975db 100644
--- a/components/collection/SearchInput.vue
+++ b/components/collection/SearchInput.vue
@@ -1,6 +1,7 @@
Date: Wed, 1 Jan 2025 12:54:39 +0100
Subject: [PATCH 09/12] chore: price copy
---
locales/en.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/locales/en.json b/locales/en.json
index 305b762a29..bd21769a21 100644
--- a/locales/en.json
+++ b/locales/en.json
@@ -1256,8 +1256,8 @@
"holderOfWarning": "Currently HolderOf collection is not supported to mint on Koda",
"issuerWarning": "You should not set a price for Issuer type",
"label": "Collection Permission",
- "noPriceSet": "No specified price set",
- "pricePlaceholder": "specify the price of the items",
+ "noPriceSet": "No specific price set",
+ "pricePlaceholder": "Set specific price",
"publicWarning": "You need to set a price so that users can mint on Koda",
"publicWithPriceWarning": "You will not be able to mint in Koda. Moreover anyone can mint into your collection"
},
From 194f8641ca4054d09a51b4db642fcf0a8a62f7bf Mon Sep 17 00:00:00 2001
From: Jarsen <31397967+Jarsen136@users.noreply.github.com>
Date: Wed, 1 Jan 2025 15:17:28 +0100
Subject: [PATCH 10/12] chore: edit type
---
components/collection/EditModal.vue | 13 +++++++------
components/collection/SearchInput.vue | 5 +++--
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/components/collection/EditModal.vue b/components/collection/EditModal.vue
index 9e9d64c18d..0ffd202f26 100644
--- a/components/collection/EditModal.vue
+++ b/components/collection/EditModal.vue
@@ -152,7 +152,7 @@
{{ $t(hasMintingPrice ? 'mint.collection.permission.pricePlaceholder' : 'mint.collection.permission.noPriceSet') }}
@@ -175,7 +175,7 @@
@@ -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(originalHolderOfCollectionId.value)
+const isHolderOfMintingTypeSelected = computed(() => selectedMintingType.value === 'HolderOf')
const disabled = computed(() => {
const hasImage = imageUrl.value
@@ -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
@@ -331,7 +332,7 @@ watch(isModalActive, (value) => {
}, {
immediate: true,
})
-const mintTypeChangeHandlerMap = {
+const mintTypeChangeHandlerMap: Record void> = {
Issuer: () => {
hasMintingPrice.value = false
mintingPrice.value = null
@@ -347,7 +348,7 @@ const mintTypeChangeHandlerMap = {
},
}
-const permissionSettingCheckingMap = {
+const permissionSettingCheckingMap: Record string | undefined> = {
Issuer: () => {
if (mintingPrice.value) {
return $i18n.t('mint.collection.permission.issuerWarning')
diff --git a/components/collection/SearchInput.vue b/components/collection/SearchInput.vue
index 15479975db..5eca490f92 100644
--- a/components/collection/SearchInput.vue
+++ b/components/collection/SearchInput.vue
@@ -58,6 +58,7 @@