Add EEM power module to the shop #97

Merged
sb10q merged 2 commits from esavkin/web2019:91-eem-pwr_mod into master 2023-10-10 17:34:53 +08:00
4 changed files with 52 additions and 11 deletions

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 34 KiB

File diff suppressed because one or more lines are too long

View File

@ -86,10 +86,12 @@ const copy = (
) => { ) => {
const destClone = Array.from(destination.items); const destClone = Array.from(destination.items);
destClone.splice(droppableDestination.index, 0, { destClone.splice(droppableDestination.index, 0, ...draggableSource.map((dragged_item, _) => {
...model[draggableSource], return {
...model[dragged_item],
id: uuidv4(), id: uuidv4(),
}); }
}));
return destClone; return destClone;
}; };
@ -1633,10 +1635,12 @@ class Shop extends React.PureComponent {
} }
componentDidMount() { componentDidMount() {
// index 0 is a Kasli, we place it as a default conf on the crate.
const source = { const source = {
droppableId: 'backlog', droppableId: 'backlog',
index: 0, indexes: [
itemsUnfoldedList.findIndex(element => element === "eem_pwr_mod"),
itemsUnfoldedList.findIndex(element => element === "kasli")
],
}; };
const destination = { const destination = {
droppableId: 'cart', droppableId: 'cart',
@ -1945,7 +1949,14 @@ class Shop extends React.PureComponent {
source, source,
destination, destination,
} = result; } = result;
let dragged_item = itemsUnfoldedList[source.index]; let dragged_items = [];
if (source.indexes) {
source.indexes.forEach((card_index, _) => {
dragged_items.push(itemsUnfoldedList[card_index]);
})
} else if (source.index) {
dragged_items.push(itemsUnfoldedList[source.index]);
}
if (!destination) { if (!destination) {
@ -1984,7 +1995,7 @@ class Shop extends React.PureComponent {
this.state.items, this.state.items,
this.state.columns[source.droppableId], this.state.columns[source.droppableId],
this.state.columns[destination.droppableId], this.state.columns[destination.droppableId],
dragged_item, dragged_items,
destination, destination,
), ),
}, },

View File

@ -888,7 +888,34 @@ const shop_data = {
nbrClockMax: 0, nbrClockMax: 0,
slotOccupied: 1, slotOccupied: 1,
clockOccupied: 1, clockOccupied: 1,
} },
'eem_pwr_mod': {
id: 'eem_pwr_mod',
name: 'EEM AC Power Module',
name_number: '1106',
name_codename: '',
price: 750,
image: '/shop/graphic-03_eem_pwr_mod.svg',
specs: [
"EEM AC power module",
"400W with forced cooling (25CFM), 200W with free air convection",
"Universal input",
"IEC inlet on front panel",
"EMC filter",
"LED current indicator",
"6 rear side outputs - 4pin Molex MiniFit (Kasli type)",
"Mains circuit protected with steel cover",
"Optional - DC PSU will be shipped if removed"
],
size: 'big',
type: null,
hp: 8,
nbrSlotMin: 0,
nbrSlotMax: 0,
nbrClockMax: 0,
slotOccupied: 0,
clockOccupied: 0,
},
}, },
columns: { columns: {
@ -936,7 +963,9 @@ const shop_data = {
'koster', 'koster',
'stabilizer', 'stabilizer',
'pounder', 'pounder',
'thermostat-eem']} 'thermostat-eem',
'eem_pwr_mod',
]}
], ],
}, },