Add EEM power module to the shop

Co-authored-by: Egor Savkin <es@m-labs.hk>
Co-committed-by: Egor Savkin <es@m-labs.hk>
This commit is contained in:
Egor Savkin 2023-10-10 17:34:52 +08:00 committed by sb10q
parent a7c4c079a4
commit 393fc8e3c9
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);
destClone.splice(droppableDestination.index, 0, {
...model[draggableSource],
id: uuidv4(),
});
destClone.splice(droppableDestination.index, 0, ...draggableSource.map((dragged_item, _) => {
return {
...model[dragged_item],
id: uuidv4(),
}
}));
return destClone;
};
@ -1633,10 +1635,12 @@ class Shop extends React.PureComponent {
}
componentDidMount() {
// index 0 is a Kasli, we place it as a default conf on the crate.
const source = {
droppableId: 'backlog',
index: 0,
indexes: [
itemsUnfoldedList.findIndex(element => element === "eem_pwr_mod"),
itemsUnfoldedList.findIndex(element => element === "kasli")
],
};
const destination = {
droppableId: 'cart',
@ -1945,7 +1949,14 @@ class Shop extends React.PureComponent {
source,
destination,
} = 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) {
@ -1984,7 +1995,7 @@ class Shop extends React.PureComponent {
this.state.items,
this.state.columns[source.droppableId],
this.state.columns[destination.droppableId],
dragged_item,
dragged_items,
destination,
),
},

View File

@ -888,7 +888,34 @@ const shop_data = {
nbrClockMax: 0,
slotOccupied: 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: {
@ -936,7 +963,9 @@ const shop_data = {
'koster',
'stabilizer',
'pounder',
'thermostat-eem']}
'thermostat-eem',
'eem_pwr_mod',
]}
],
},