Skip to content

Commit 8e1dbca

Browse files
feat: Add mapping to multiple uploads (#3154)
* feat: Add mapping to multiple uploads * fix: Remove console log
1 parent 667bf68 commit 8e1dbca

File tree

6 files changed

+25
-9
lines changed

6 files changed

+25
-9
lines changed

package-lock.json

+8-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"dependencies": {
66
"@babylonjs/core": "^4.2.0",
77
"@babylonjs/loaders": "^4.2.0",
8-
"@dcl/builder-client": "^5.0.0",
8+
"@dcl/builder-client": "^6.0.0",
99
"@dcl/builder-templates": "^0.2.0",
1010
"@dcl/content-hash-tree": "^1.1.3",
1111
"@dcl/crypto": "^3.4.5",

src/components/Modals/CreateAndEditMultipleItemsModal/CreateAndEditMultipleItemsModal.tsx

+13
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,19 @@ export default class CreateAndEditMultipleItemsModal extends React.PureComponent
185185
throw new Error(t('create_and_edit_multiple_items_modal.invalid_urn'))
186186
}
187187

188+
// In case the collection is linked to a smart contract, the mappings must be present
189+
if (collection?.linkedContractAddress && collection.linkedContractNetwork) {
190+
if (!loadedFile.wearable.mapping) {
191+
throw new Error(t('create_and_edit_multiple_items_modal.missing_mapping'))
192+
}
193+
// Build the mapping with the linked contract address and network
194+
itemFactory.withMappings({
195+
[collection.linkedContractNetwork]: {
196+
[collection.linkedContractAddress]: [loadedFile.wearable.mapping]
197+
}
198+
})
199+
}
200+
188201
// Build the third party item URN in accordance ot the collection URN
189202
if (isThirdPartyCollectionDecodedUrn(decodedCollectionUrn)) {
190203
itemFactory.withUrn(

src/modules/translation/languages/en.json

+1
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@
390390
"saved_items_table_title": "Updated items"
391391
},
392392
"wrong_thumbnail_format": "The thumbnail.png file is not formatted as a PNG image.",
393+
"missing_mapping": "The item is missing a mapping.",
393394
"wrong_file_extension": "File extension is not correct.",
394395
"wearable_file_not_found": "The wearable.json file was not found.",
395396
"thumbnail_file_not_generated": "The thumbnail.png file couldn't be generated.",

src/modules/translation/languages/es.json

+1
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@
389389
"saved_items_table_title": "Items actualizados"
390390
},
391391
"wrong_thumbnail_format": "El archivo thumbnail.png no tiene el formato de una imagen PNG.",
392+
"missing_mapping": "El item no contiene un mapeo.",
392393
"wrong_file_extension": "La extensión del artchivo no es correcta.",
393394
"wearable_file_not_found": "El archivo wearable.json no se encontró.",
394395
"thumbnail_file_not_generated": "El archivo thumbnail.png no pudo ser generado.",

src/modules/translation/languages/zh.json

+1
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,7 @@
383383
"saved_items_table_title": "更新项目"
384384
},
385385
"wrong_thumbnail_format": "thumbnail.png 文件未格式化为 PNG 图像。",
386+
"missing_mapping": "该项缺少映射。",
386387
"wrong_file_extension": "文件扩展名不正确。",
387388
"wearable_file_not_found": "找不到wearable.json 文件。",
388389
"thumbnail_file_not_generated": "无法生成 thumbnail.png 文件。",

0 commit comments

Comments
 (0)