u
This commit is contained in:
@@ -179,24 +179,20 @@ class NameDisplay extends Component {
|
||||
|
||||
class NameEdit extends Component {
|
||||
render() {
|
||||
const { draft, onChange, inputRef, name, categoryIds } = this.props;
|
||||
const currentName = draft?.name ?? name;
|
||||
const currentCategoryIds = draft?.categoryIds ?? categoryIds;
|
||||
const { name, categoryIds } = this.props;
|
||||
return (
|
||||
<Box sx={columnSx}>
|
||||
<Box sx={{ flex: 1, display: 'flex', alignItems: 'center' }}>
|
||||
<SingleLineTextEdit
|
||||
inputRef={inputRef}
|
||||
label="Name"
|
||||
value={currentName}
|
||||
onChange={(nextName) => onChange({ ...draft, name: nextName })}
|
||||
value={name}
|
||||
onChange={() => {}}
|
||||
sx={articleNameFieldSx}
|
||||
/>
|
||||
</Box>
|
||||
<CategoryPills
|
||||
categoryIds={currentCategoryIds}
|
||||
categoryIds={categoryIds}
|
||||
editMode
|
||||
onCategoryIdsChange={(nextIds) => onChange({ ...draft, categoryIds: nextIds })}
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
@@ -217,6 +213,7 @@ export default class ArticleViewName extends Component {
|
||||
let article = null;
|
||||
|
||||
if (nameChanged) {
|
||||
console.log('nameChanged', name, articleData.name);
|
||||
const nameRes = await store.article.update(articleData.sku, { name });
|
||||
article = nameRes.article;
|
||||
}
|
||||
@@ -248,12 +245,16 @@ export default class ArticleViewName extends Component {
|
||||
<NameDisplay
|
||||
name={value.name}
|
||||
categoryIds={value.categoryIds}
|
||||
|
||||
/>
|
||||
}
|
||||
edit={
|
||||
<NameEdit
|
||||
name={value.name}
|
||||
categoryIds={value.categoryIds}
|
||||
onNameChange={() => {}}
|
||||
onCategoryIdsChange={() => {}}
|
||||
onIsDirtyChange={() => {}}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user