From ce9a90b9b63641306f7394b8ce98ebaf229fd176 Mon Sep 17 00:00:00 2001 From: Jarsen <31397967+Jarsen136@users.noreply.github.com> Date: Sun, 1 Dec 2024 14:58:48 +0100 Subject: [PATCH 1/4] feat: Item Edit: Limit Name and Image Update --- components/common/EditNftModal.vue | 30 +++++++++++-------- .../common/NonRecommendFieldNotification.vue | 26 ++++++++++++++++ locales/en.json | 1 + 3 files changed, 44 insertions(+), 13 deletions(-) create mode 100644 components/common/NonRecommendFieldNotification.vue diff --git a/components/common/EditNftModal.vue b/components/common/EditNftModal.vue index 7bd0d1a324..a052b0218b 100644 --- a/components/common/EditNftModal.vue +++ b/components/common/EditNftModal.vue @@ -16,10 +16,12 @@ :label="$t('mint.nft.art.label')" required > - + + + @@ -28,11 +30,13 @@ required :error="!name" > - + + + @@ -91,17 +95,17 @@ const image = ref() const imageUrl = ref() const attributes = ref([]) +const nameChanged = computed(() => props.metadata?.name !== name.value) +const imageChanged = computed(() => Boolean(image.value)) + const disabled = computed(() => { const hasImage = Boolean(imageUrl.value) const isNameFilled = Boolean(name.value) - - const nameChanged = props.metadata?.name !== name.value const descriptionChanged = props.metadata?.description !== description.value - const imageChanged = Boolean(image.value) const attributesChanged = JSON.stringify(attributes.value) !== JSON.stringify(props.metadata?.attributes || []) return !hasImage || !isNameFilled - || (!nameChanged && !descriptionChanged && !imageChanged && !attributesChanged) + || (!nameChanged.value && !descriptionChanged && !imageChanged.value && !attributesChanged) }) const editCollection = async () => { diff --git a/components/common/NonRecommendFieldNotification.vue b/components/common/NonRecommendFieldNotification.vue new file mode 100644 index 0000000000..206307ac4b --- /dev/null +++ b/components/common/NonRecommendFieldNotification.vue @@ -0,0 +1,26 @@ + + + diff --git a/locales/en.json b/locales/en.json index e0df34b649..3af8e8f3dc 100644 --- a/locales/en.json +++ b/locales/en.json @@ -1358,6 +1358,7 @@ "message": "People will be able to buy your NFT." } }, + "notRecommendedModify": "Please note that this value is not recommended to be modified as it may lead to misuse and confusion", "progress": "In Progress", "requiredDeposit": "A deposit of {0} is required to create a {1}. Please note, this initial deposit is refundable.", "royalty": { From 874e602a6dbb63066378e38fda4e80fdfa731600 Mon Sep 17 00:00:00 2001 From: Jarsen <31397967+Jarsen136@users.noreply.github.com> Date: Mon, 2 Dec 2024 13:51:04 +0100 Subject: [PATCH 2/4] feat: undo edit nft --- components/common/EditNftModal.vue | 22 ++++++++++--- .../common/NonRecommendFieldNotification.vue | 31 ++++++++++++++++--- locales/en.json | 2 +- 3 files changed, 45 insertions(+), 10 deletions(-) diff --git a/components/common/EditNftModal.vue b/components/common/EditNftModal.vue index a052b0218b..470521dfa7 100644 --- a/components/common/EditNftModal.vue +++ b/components/common/EditNftModal.vue @@ -16,7 +16,10 @@ :label="$t('mint.nft.art.label')" required > - + - + () const imageUrl = ref() const attributes = ref([]) +const originalImageUrl = computed(() => sanitizeIpfsUrl(props.metadata?.image)) + const nameChanged = computed(() => props.metadata?.name !== name.value) -const imageChanged = computed(() => Boolean(image.value)) +const imageChanged = computed(() => originalImageUrl.value !== imageUrl.value) + +const initImage = () => { + imageUrl.value = originalImageUrl.value + image.value = undefined +} const disabled = computed(() => { const hasImage = Boolean(imageUrl.value) @@ -122,8 +135,7 @@ const editCollection = async () => { watch(isModalActive, (value) => { if (value) { - imageUrl.value = sanitizeIpfsUrl(props.metadata?.image) - image.value = undefined + initImage() name.value = props.metadata?.name description.value = props.metadata?.description attributes.value = structuredClone(toRaw(props.metadata?.attributes || [])) diff --git a/components/common/NonRecommendFieldNotification.vue b/components/common/NonRecommendFieldNotification.vue index 206307ac4b..2490f88b90 100644 --- a/components/common/NonRecommendFieldNotification.vue +++ b/components/common/NonRecommendFieldNotification.vue @@ -10,17 +10,40 @@ class="text-yellow-500 flex-shrink-0" size="small" /> -

- {{ $t('mint.notRecommendedModify') }} -

+ +
+

+ {{ $t('mint.notRecommendedModify') }} +

+
+ + + {{ $t('undo') }} + +
+
diff --git a/locales/en.json b/locales/en.json index 3af8e8f3dc..40de2ad3ef 100644 --- a/locales/en.json +++ b/locales/en.json @@ -1358,7 +1358,7 @@ "message": "People will be able to buy your NFT." } }, - "notRecommendedModify": "Please note that this value is not recommended to be modified as it may lead to misuse and confusion", + "notRecommendedModify": "Please note that this field is not recommended to be modified as it may lead to misuse and confusion", "progress": "In Progress", "requiredDeposit": "A deposit of {0} is required to create a {1}. Please note, this initial deposit is refundable.", "royalty": { From 70ae8a6c9d5d6b77cb168eb96c61c4744a2e55f8 Mon Sep 17 00:00:00 2001 From: Jarsen <31397967+Jarsen136@users.noreply.github.com> Date: Mon, 2 Dec 2024 13:58:06 +0100 Subject: [PATCH 3/4] chore: remove class --- components/common/NonRecommendFieldNotification.vue | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/components/common/NonRecommendFieldNotification.vue b/components/common/NonRecommendFieldNotification.vue index 2490f88b90..043a1710e8 100644 --- a/components/common/NonRecommendFieldNotification.vue +++ b/components/common/NonRecommendFieldNotification.vue @@ -7,11 +7,11 @@ > -
+

{{ $t('mint.notRecommendedModify') }}

@@ -26,7 +26,6 @@ > {{ $t('undo') }} From 51b748408de9161dd592d5aaa10146326dd64462 Mon Sep 17 00:00:00 2001 From: Jarsen <31397967+Jarsen136@users.noreply.github.com> Date: Tue, 3 Dec 2024 09:51:57 +0100 Subject: [PATCH 4/4] chore: update translation --- components/common/NonRecommendFieldNotification.vue | 2 +- locales/en.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/components/common/NonRecommendFieldNotification.vue b/components/common/NonRecommendFieldNotification.vue index 043a1710e8..27de4d33e2 100644 --- a/components/common/NonRecommendFieldNotification.vue +++ b/components/common/NonRecommendFieldNotification.vue @@ -28,7 +28,7 @@ icon="undo" size="small" /> - {{ $t('undo') }} + {{ $t('general.undo') }}
diff --git a/locales/en.json b/locales/en.json index 40de2ad3ef..ae894a5be4 100644 --- a/locales/en.json +++ b/locales/en.json @@ -941,6 +941,7 @@ "cancelled": "Transaction was cancelled", "feesPaidIn": "You are paying fees in {0}" }, + "undo": "Undo", "updateOnWebsiteSoon": "Update on website visible soon", "usd": "USD", "using": "using"