This commit is contained in:
seb
2026-09-22 07:20:31 +02:00
parent 536e7b1e2a
commit 5e13b8f9cd
32 changed files with 2485 additions and 1908 deletions

View File

@@ -1,10 +1,6 @@
import { Component } from 'react';
import { connect } from 'react-redux';
import { ActionTile } from '../tiles';
import {
createArticles as createArticlesThunk,
createArticle as createArticleThunk,
} from '../../store/categorySlice';
import categoryAutomat from '../../automats/categoryAutomat';
import ArticleNameDialog from './ArticleNameDialog';
class NewArticleTile extends Component {
@@ -28,15 +24,16 @@ class NewArticleTile extends Component {
const { parentId } = this.props;
const list = (names ?? []).filter(Boolean);
if (list.length <= 1) {
const article = await this.props
.createArticle({ parentId, name: list[0] ?? '' })
.unwrap();
const article = await categoryAutomat.actions.createArticle({
parentId,
name: list[0] ?? '',
});
if (article) {
this.props.onOpenArticle?.(article);
}
return;
}
const created = await this.props.createArticles({ parentId, names: list }).unwrap();
const created = await categoryAutomat.actions.createArticles({ parentId, names: list });
if (created?.[0]) {
this.props.onOpenArticle?.(created[0]);
}
@@ -62,9 +59,4 @@ class NewArticleTile extends Component {
}
}
const mapDispatchToProps = {
createArticle: createArticleThunk,
createArticles: createArticlesThunk,
};
export default connect(null, mapDispatchToProps)(NewArticleTile);
export default NewArticleTile;