Skip to content

Commit 78fdbb9

Browse files
feat: Allow editing mappings (#3143)
1 parent 7d1d2c4 commit 78fdbb9

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/components/Modals/CreateSingleItemModal/CreateSingleItemModal.container.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import { MapStateProps, MapDispatchProps, MapDispatch, OwnProps } from './Create
1313
import CreateSingleItemModal from './CreateSingleItemModal'
1414

1515
const mapState = (state: RootState, ownProps: OwnProps): MapStateProps => {
16-
const collection: Collection | null = ownProps.metadata.collectionId ? getCollection(state, ownProps.metadata.collectionId) : null
16+
const collectionId: string | undefined = ownProps.metadata.item?.collectionId || ownProps.metadata.item?.collectionId
17+
const collection: Collection | null = collectionId ? getCollection(state, collectionId) : null
1718
const statusByItemId = getStatusByItemId(state)
1819
const itemStatus = ownProps.metadata.item ? statusByItemId[ownProps.metadata.item.id] : null
1920
const contracts = collection && isThirdPartyCollection(collection) ? getCollectionThirdParty(state, collection)?.contracts ?? [] : []

src/components/Modals/CreateSingleItemModal/CreateSingleItemModal.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ export default class CreateSingleItemModal extends React.PureComponent<Props, St
402402

403403
modifyItem = async (pristineItem: Item, sortedContents: SortedContent, representations: WearableRepresentation[]) => {
404404
const { itemStatus, onSave } = this.props
405-
const { name, bodyShape, type, metrics, category, playMode, requiredPermissions } = this.state as StateData
405+
const { name, bodyShape, type, mappings, metrics, category, playMode, requiredPermissions } = this.state as StateData
406406

407407
let data: WearableData | EmoteDataADR74
408408

@@ -430,6 +430,7 @@ export default class CreateSingleItemModal extends React.PureComponent<Props, St
430430
name,
431431
metrics,
432432
contents,
433+
mappings,
433434
updatedAt: +new Date()
434435
}
435436

src/components/Modals/CreateSingleItemModal/CreateSingleItemModal.types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export type AcceptedFileProps = Pick<
105105
| 'tags'
106106
| 'blockVrmExport'
107107
>
108-
export type OwnProps = Pick<Props, 'metadata' | 'name' | 'onClose'>
108+
export type OwnProps = Pick<Props, 'name' | 'onClose'> & { metadata: CreateSingleItemModalMetadata }
109109
export type MapStateProps = Pick<
110110
Props,
111111
'address' | 'error' | 'isLoading' | 'collection' | 'itemStatus' | 'isThirdPartyV2Enabled' | 'contracts'

0 commit comments

Comments
 (0)