shop: group cards #67

Merged
sb10q merged 5 commits from esavkin/web2019:30-group-cards into master 2023-06-30 10:10:16 +08:00
3 changed files with 45 additions and 28 deletions
Showing only changes of commit cd7b1ba198 - Show all commits

View File

@ -77,7 +77,7 @@ const copy = (
droppableSource, droppableSource,
droppableDestination droppableDestination
) => { ) => {
const sourceClone = Array.from(source.itemIds); const sourceClone = Array.from(source.categories.map(groupId => groupId.itemIds).flat());
const destClone = Array.from(destination.items); const destClone = Array.from(destination.items);
const item = sourceClone[droppableSource.index]; const item = sourceClone[droppableSource.index];
@ -1515,7 +1515,8 @@ class Backlog extends React.PureComponent {
isMobile, isMobile,
} = this.props; } = this.props;
const ordered_items = data.itemIds.map(itemId => items[itemId]);
const ordered_items = data.categories.map(groupItem => groupItem.itemIds.map(itemId => items[itemId])).flat();
const products = ordered_items.map((item, index) => { const products = ordered_items.map((item, index) => {
return ( return (
<ProductItem <ProductItem

View File

@ -108,7 +108,9 @@ var nbrClocksStyle = function nbrClocksStyle(data) {
}; };
var copy = function copy(model, source, destination, droppableSource, droppableDestination) { var copy = function copy(model, source, destination, droppableSource, droppableDestination) {
var sourceClone = Array.from(source.itemIds); var sourceClone = Array.from(source.categories.map(function (groupId) {
return groupId.itemIds;
}).flat());
var destClone = Array.from(destination.items); var destClone = Array.from(destination.items);
var item = sourceClone[droppableSource.index]; var item = sourceClone[droppableSource.index];
destClone.splice(droppableDestination.index, 0, _objectSpread({}, model[item], { destClone.splice(droppableDestination.index, 0, _objectSpread({}, model[item], {
@ -1551,9 +1553,11 @@ var Backlog = /*#__PURE__*/function (_React$PureComponent11) {
onClickAddItem = _this$props11.onClickAddItem, onClickAddItem = _this$props11.onClickAddItem,
onClickToggleMobileSideMenu = _this$props11.onClickToggleMobileSideMenu, onClickToggleMobileSideMenu = _this$props11.onClickToggleMobileSideMenu,
isMobile = _this$props11.isMobile; isMobile = _this$props11.isMobile;
var ordered_items = data.itemIds.map(function (itemId) { var ordered_items = data.categories.map(function (groupItem) {
return groupItem.itemIds.map(function (itemId) {
return items[itemId]; return items[itemId];
}); });
}).flat();
var products = ordered_items.map(function (item, index) { var products = ordered_items.map(function (item, index) {
return /*#__PURE__*/React.createElement(ProductItem, { return /*#__PURE__*/React.createElement(ProductItem, {
key: item.id, key: item.id,

View File

@ -855,28 +855,40 @@ const shop_data = {
id: 'backlog', id: 'backlog',
title: 'Backlog', title: 'Backlog',
/* itemIds define items order - change order to suit your need */ /* itemIds define items order - change order to suit your need */
categories: [
{ name: 'Core',
itemIds: [ itemIds: [
'kasli', 'kasli',
'kaslisoc', 'kaslisoc']},
{ name: 'TTL',
itemIds: [
'bnc-dio', 'bnc-dio',
'sma-dio', 'sma-dio',
'mcx-dio', 'mcx-dio',
'rj45-dio', 'rj45-dio']},
{ name: 'RF',
itemIds: [
'clocker',
'urukul', 'urukul',
'phaser', 'phaser',
'mirny', 'mirny',
'almazny', 'almazny']},
{ name: 'DAC/ADC',
itemIds: [
'zotino', 'zotino',
'fastino', 'fastino',
'novo']},
{ name: 'Adapters',
itemIds: [
'idc-bnc-adapter', 'idc-bnc-adapter',
'idc-sma-adapter', 'idc-sma-adapter',
'idc-mcx-adapter', 'idc-mcx-adapter',
'hd68-idc-adapter', 'hd68-idc-adapter',
'novo', 'vhdcicarrier']},
{ name: 'Misc',
itemIds: [
'koster', 'koster',
'clocker', 'stabilizer']}
'stabilizer',
'vhdcicarrier',
], ],
}, },