Allow duplicating cards in the backlog

Signed-off-by: Egor Savkin <es@m-labs.hk>
This commit is contained in:
Egor Savkin 2023-08-10 16:00:04 +08:00 committed by sb10q
parent 4dc15f5633
commit 27c7db1df4
3 changed files with 14 additions and 14 deletions

File diff suppressed because one or more lines are too long

View File

@ -9,6 +9,7 @@ import { v4 as uuidv4 } from 'uuid';
const data = window.shop_data;
const itemsUnfoldedList = Array.from(data.columns.backlog.categories.map(groupId => groupId.itemIds).flat());
const productStyle = (style, snapshot, removeAnim, hovered, selected, cart=false) => {
const custom = {
@ -486,7 +487,7 @@ class ProductItem extends React.PureComponent {
<div className="content">
<button onClick={this.handleOnClickAddItem.bind(this, id, true)}>
<button onClick={this.handleOnClickAddItem.bind(this, index, true)}>
<img src="/images/shop/icon-add.svg" alt="add" />
</button>
@ -1538,7 +1539,7 @@ class Backlog extends React.PureComponent {
return (
<ProductItem
key={item.id}
id={item.id}
id={uuidv4()}
index={item_index}
name={`${item.name_number} ${item.name}`}
name_codename={item.name_codename}
@ -1633,10 +1634,9 @@ class Shop extends React.PureComponent {
componentDidMount() {
// index 0 is a Kasli, we place it as a default conf on the crate.
const sourceIds = Array.from(this.state.columns.backlog.categories.map(groupId => groupId.itemIds).flat())
const source = {
droppableId: 'backlog',
index: null,
index: 0,
};
const destination = {
droppableId: 'cart',
@ -1645,8 +1645,7 @@ class Shop extends React.PureComponent {
this.handleOnDragEnd({
source,
destination,
draggableId: sourceIds[0],
destination
});
}
@ -1729,10 +1728,10 @@ class Shop extends React.PureComponent {
});
}
handleClickAddItem(id, tap) {
handleClickAddItem(index, tap) {
const source = {
droppableId: 'backlog',
index: null,
index: index,
};
const destination = {
droppableId: 'cart',
@ -1741,8 +1740,7 @@ class Shop extends React.PureComponent {
this.handleOnDragEnd({
source,
destination,
draggableId: id
destination
}, tap);
}
@ -1946,8 +1944,9 @@ class Shop extends React.PureComponent {
const {
source,
destination,
draggableId,
} = result;
let dragged_item = itemsUnfoldedList[source.index];
if (!destination) {
if (source.droppableId === 'cart') {
@ -1985,7 +1984,7 @@ class Shop extends React.PureComponent {
this.state.items,
this.state.columns[source.droppableId],
this.state.columns[destination.droppableId],
draggableId,
dragged_item,
destination,
),
},

View File

@ -917,7 +917,8 @@ const shop_data = {
'urukul',
'phaser',
'mirny',
'almazny']},
'almazny',
'pounder']},
{ name: 'DAC/ADC',
itemIds: [
'zotino',