Allow duplicating cards in the backlog and add Pounder to RF #88
File diff suppressed because one or more lines are too long
|
@ -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>
|
||||
|
||||
|
@ -1537,7 +1538,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}
|
||||
|
@ -1632,10 +1633,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',
|
||||
|
@ -1644,8 +1644,7 @@ class Shop extends React.PureComponent {
|
|||
|
||||
this.handleOnDragEnd({
|
||||
source,
|
||||
destination,
|
||||
draggableId: sourceIds[0],
|
||||
destination
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1728,10 +1727,10 @@ class Shop extends React.PureComponent {
|
|||
});
|
||||
}
|
||||
|
||||
handleClickAddItem(id, tap) {
|
||||
handleClickAddItem(index, tap) {
|
||||
const source = {
|
||||
droppableId: 'backlog',
|
||||
index: null,
|
||||
index: index,
|
||||
};
|
||||
const destination = {
|
||||
droppableId: 'cart',
|
||||
|
@ -1740,8 +1739,7 @@ class Shop extends React.PureComponent {
|
|||
|
||||
this.handleOnDragEnd({
|
||||
source,
|
||||
destination,
|
||||
draggableId: id
|
||||
destination
|
||||
}, tap);
|
||||
}
|
||||
|
||||
|
@ -1945,8 +1943,9 @@ class Shop extends React.PureComponent {
|
|||
const {
|
||||
source,
|
||||
destination,
|
||||
draggableId,
|
||||
} = result;
|
||||
let dragged_item = itemsUnfoldedList[source.index];
|
||||
|
||||
|
||||
if (!destination) {
|
||||
if (source.droppableId === 'cart') {
|
||||
|
@ -1984,7 +1983,7 @@ class Shop extends React.PureComponent {
|
|||
this.state.items,
|
||||
this.state.columns[source.droppableId],
|
||||
this.state.columns[destination.droppableId],
|
||||
draggableId,
|
||||
dragged_item,
|
||||
destination,
|
||||
),
|
||||
},
|
||||
|
|
|
@ -917,7 +917,8 @@ const shop_data = {
|
|||
'urukul',
|
||||
'phaser',
|
||||
'mirny',
|
||||
'almazny']},
|
||||
'almazny',
|
||||
'pounder']},
|
||||
{ name: 'DAC/ADC',
|
||||
itemIds: [
|
||||
'zotino',
|
||||
|
|
Loading…
Reference in New Issue