1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00

fix category array handling

This commit is contained in:
Matthias Kretschmann 2019-04-25 14:07:44 +02:00
parent d1ce2c1963
commit c97b6b5dbb
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -24,7 +24,7 @@ interface AssetDetailsState {
dateCreated?: string
description?: string
copyrightHolder?: string
categories?: string
categories?: string[]
}
export default class AssetDetails extends PureComponent<
@ -49,6 +49,14 @@ export default class AssetDetails extends PureComponent<
})
}
private inputToArrayChange = (
event: ChangeEvent<HTMLInputElement> | ChangeEvent<HTMLSelectElement>
) => {
this.setState({
[event.currentTarget.name]: [event.currentTarget.value]
})
}
private toggleEditMode = () => {
this.setState({ isEditMode: !this.state.isEditMode })
}
@ -166,15 +174,15 @@ export default class AssetDetails extends PureComponent<
placeholder={steps[1].fields.categories.placeholder}
required={steps[1].fields.categories.required}
type={steps[1].fields.categories.type}
onChange={this.inputChange}
onChange={this.inputToArrayChange}
options={steps[1].fields.categories.options}
value={value}
value={value[0]}
disabled={this.state.isLoading}
small
/>
) : (
// TODO: Make this link to search for respective category
<Link to={`/search?text=${value}`}>{value}</Link>
<Link to={`/search?text=${value[0]}`}>{value[0]}</Link>
)
private Description = ({ value }: { value: string }) =>