This commit is contained in:
seb
2026-08-05 19:25:43 +02:00
parent bbec785d7c
commit ff79d5b92c
5 changed files with 45 additions and 26 deletions

View File

@@ -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={() => {}}
/>
}
/>