17
17
required
18
18
:error =" !name"
19
19
>
20
- <NeoInput
21
- v-model =" name"
22
- required
23
- :placeholder =" $t('mint.collection.name.placeholder')"
24
- />
20
+ <NonRecommendFieldNotification
21
+ :show =" name && nameChanged"
22
+ @undo =" name = props.collection.name"
23
+ >
24
+ <NeoInput
25
+ v-model =" name"
26
+ required
27
+ :placeholder =" $t('mint.collection.name.placeholder')"
28
+ />
29
+ </NonRecommendFieldNotification >
25
30
</NeoField >
26
31
27
32
<!-- collection description -->
36
41
/>
37
42
</NeoField >
38
43
<CollectionEditSection :title =" $t('edit.collection.image.label')" >
39
- <FormLogoField
40
- v-model:file =" image"
41
- v-model:url =" imageUrl"
42
- :title =" $t('edit.collection.image.message')"
43
- />
44
+ <NonRecommendFieldNotification
45
+ :show =" hasImageChanged"
46
+ @undo =" initLogoImage"
47
+ >
48
+ <FormLogoField
49
+ v-model:file =" image"
50
+ v-model:url =" imageUrl"
51
+ :title =" $t('edit.collection.image.message')"
52
+ />
53
+ </NonRecommendFieldNotification >
44
54
</CollectionEditSection >
45
55
46
56
<CollectionEditSection :title =" $t('edit.collection.banner.label')" >
@@ -165,19 +175,26 @@ const unlimited = ref(true)
165
175
const min = computed (() => props .min || 1 )
166
176
const max = ref <number | null >(null )
167
177
178
+ const nameChanged = computed (() => props .collection .name !== name .value )
179
+ const hasImageChanged = computed (() => (! imageUrl .value && Boolean (props .collection .image )) || Boolean (image .value ))
180
+ const originalLogoImageUrl = computed (() => sanitizeIpfsUrl (props .collection .image ))
181
+
168
182
const disabled = computed (() => {
169
183
const hasImage = imageUrl .value
170
184
const isNameFilled = Boolean (name .value )
171
185
172
- const nameChanged = props .collection .name !== name .value
173
186
const descriptionChanged = props .collection .description !== description .value
174
- const hasImageChanged = (! imageUrl .value && Boolean (props .collection .image )) || Boolean (image .value )
175
187
const hasBannerChanged = (! bannerUrl .value && Boolean (props .collection .banner )) || Boolean (banner .value )
176
188
const hasMaxChanged = max .value !== props .collection .max
177
189
178
- return ! hasImage || ! isNameFilled || (! nameChanged && ! descriptionChanged && ! hasImageChanged && ! hasBannerChanged && ! hasMaxChanged )
190
+ return ! hasImage || ! isNameFilled || (! nameChanged . value && ! descriptionChanged && ! hasImageChanged . value && ! hasBannerChanged && ! hasMaxChanged )
179
191
})
180
192
193
+ const initLogoImage = () => {
194
+ imageUrl .value = originalLogoImageUrl .value
195
+ image .value = undefined
196
+ }
197
+
181
198
const editCollection = async () => {
182
199
emit (' submit' , {
183
200
name: name .value ,
@@ -193,10 +210,9 @@ watch(isModalActive, (value) => {
193
210
if (value && props .collection ) {
194
211
name .value = props .collection .name
195
212
description .value = props .collection .description
196
- imageUrl .value = sanitizeIpfsUrl (props .collection .image )
197
213
bannerUrl .value = props .collection .banner && sanitizeIpfsUrl (props .collection .banner )
198
- image .value = undefined
199
214
banner .value = undefined
215
+ initLogoImage ()
200
216
unlimited .value = ! props .collection .max
201
217
max .value = props .collection .max
202
218
}
0 commit comments