@riosst100/pwa-marketplace 2.1.4 → 2.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/componentOverrideMapping.js +6 -0
- package/src/components/FavoriteSeller/AddToListButton/addToListButton.js +54 -54
- package/src/components/FavoriteSeller/AddToListButton/addToListButton.module.css +17 -17
- package/src/components/FavoriteSeller/AddToListButton/index.js +1 -1
- package/src/components/FavoriteSeller/AddToListButton/useCommonToasts.js +33 -33
- package/src/components/FilterTop/CustomFilters/customFilters.js +130 -132
- package/src/components/FilterTop/filterTop.js +1 -8
- package/src/components/LinkToOtherStores/index.js +61 -0
- package/src/components/NonSportCardsSets/nonSportCardsSets.js +0 -2
- package/src/components/RFQ/index.js +6 -3
- package/src/components/SellerDetail/sellerDetail.js +18 -1
- package/src/components/SellerInformation/sellerInformation.js +5 -3
- package/src/components/SellerSocialMedia/index.js +96 -0
- package/src/overwrites/pagebuilder/lib/ContentTypes/Products/products.js +13 -0
- package/src/overwrites/peregrine/lib/talons/MagentoRoute/magentoRoute.gql.js +27 -0
- package/src/overwrites/peregrine/lib/talons/MagentoRoute/useMagentoRoute.js +193 -0
- package/src/overwrites/peregrine/lib/talons/ProductFullDetail/useProductFullDetail.js +40 -9
- package/src/overwrites/peregrine/lib/talons/ProductImageCarousel/useProductImageCarousel.js +77 -0
- package/src/overwrites/peregrine/lib/talons/ProductOptions/useOption.js +59 -0
- package/src/overwrites/peregrine/lib/talons/ProductOptions/useTile.js +47 -0
- package/src/overwrites/peregrine/lib/talons/RootComponents/Category/categoryFragments.gql.js +13 -0
- package/src/overwrites/peregrine/lib/talons/RootComponents/Product/productDetailFragment.gql.js +23 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.js +0 -6
- package/src/overwrites/venia-ui/lib/components/AccountInformationPage/accountInformationPage.js +0 -1
- package/src/overwrites/venia-ui/lib/components/AccountInformationPage/editForm.js +0 -1
- package/src/overwrites/venia-ui/lib/components/Breadcrumbs/breadcrumbs.js +0 -3
- package/src/overwrites/venia-ui/lib/components/CheckoutPage/OrderSummary/orderSummary.js +0 -1
- package/src/overwrites/venia-ui/lib/components/Gallery/item.js +17 -3
- package/src/overwrites/venia-ui/lib/components/Price/price.js +113 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/components/auctionDetail.js +1 -1
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/productFullDetail.js +77 -104
- package/src/overwrites/venia-ui/lib/components/ProductImageCarousel/carousel.js +3 -1
- package/src/overwrites/venia-ui/lib/components/ProductOptions/option.js +112 -0
- package/src/overwrites/venia-ui/lib/components/ProductOptions/option.module.css +30 -0
- package/src/overwrites/venia-ui/lib/components/ProductOptions/options.js +49 -0
- package/src/overwrites/venia-ui/lib/components/ProductOptions/tile.js +118 -0
- package/src/overwrites/venia-ui/lib/components/ProductOptions/tile.module.css +68 -0
- package/src/overwrites/venia-ui/lib/components/ProductOptions/tileList.js +78 -0
- package/src/overwrites/venia-ui/lib/components/ProductOptions/tileList.module.css +6 -0
- package/src/overwrites/venia-ui/lib/components/ProductOptions/tileList.shimmer.js +32 -0
- package/src/talons/CustomFilters/useCustomFilters.js +0 -2
- package/src/talons/FavoriteSeller/AddToListButton/addToListButton.gql.js +30 -30
- package/src/talons/FavoriteSeller/AddToListButton/useAddToFavoriteListButton.js +0 -1
- package/src/talons/LegoSets/useLegoSets.js +0 -5
- package/src/talons/TrainsSets/useTrainsSets.js +0 -3
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { FormattedMessage } from 'react-intl';
|
|
3
|
+
import {
|
|
4
|
+
arrayOf,
|
|
5
|
+
func,
|
|
6
|
+
number,
|
|
7
|
+
object,
|
|
8
|
+
oneOfType,
|
|
9
|
+
shape,
|
|
10
|
+
string
|
|
11
|
+
} from 'prop-types';
|
|
12
|
+
|
|
13
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
14
|
+
import getOptionType from '@magento/venia-ui/lib/components/ProductOptions/getOptionType';
|
|
15
|
+
import SwatchList from '@magento/venia-ui/lib/components/ProductOptions/swatchList';
|
|
16
|
+
import TileList from './tileList';
|
|
17
|
+
import defaultClasses from './option.module.css';
|
|
18
|
+
import { useOption } from '@magento/peregrine/lib/talons/ProductOptions/useOption';
|
|
19
|
+
|
|
20
|
+
const getItemKey = ({ value_index }) => value_index;
|
|
21
|
+
|
|
22
|
+
// TODO: get an explicit field from the API
|
|
23
|
+
// that identifies an attribute as a swatch
|
|
24
|
+
const getListComponent = (attribute_code, values) => {
|
|
25
|
+
const optionType = getOptionType({ attribute_code, values });
|
|
26
|
+
|
|
27
|
+
return optionType === 'swatch' ? SwatchList : TileList;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const Option = props => {
|
|
31
|
+
const {
|
|
32
|
+
attribute_code,
|
|
33
|
+
attribute_id,
|
|
34
|
+
label,
|
|
35
|
+
onSelectionChange,
|
|
36
|
+
selectedValue,
|
|
37
|
+
values,
|
|
38
|
+
variants,
|
|
39
|
+
setHoveredMedia,
|
|
40
|
+
isEverythingOutOfStock,
|
|
41
|
+
outOfStockVariants
|
|
42
|
+
} = props;
|
|
43
|
+
|
|
44
|
+
const talonProps = useOption({
|
|
45
|
+
attribute_id,
|
|
46
|
+
attribute_code,
|
|
47
|
+
label,
|
|
48
|
+
variants,
|
|
49
|
+
onSelectionChange,
|
|
50
|
+
selectedValue,
|
|
51
|
+
values
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const {
|
|
55
|
+
handleSelectionChange,
|
|
56
|
+
initialSelection,
|
|
57
|
+
selectedValueDescription,
|
|
58
|
+
filteredVariants
|
|
59
|
+
} = talonProps;
|
|
60
|
+
|
|
61
|
+
const ValueList = useMemo(() => getListComponent(attribute_code, values), [
|
|
62
|
+
attribute_code,
|
|
63
|
+
values
|
|
64
|
+
]);
|
|
65
|
+
|
|
66
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<div className={classes.root} data-cy="ProductOptions-Option-root">
|
|
70
|
+
<span className={classes.title}>{label}</span>
|
|
71
|
+
<ValueList
|
|
72
|
+
getItemKey={getItemKey}
|
|
73
|
+
selectedValue={initialSelection}
|
|
74
|
+
items={values}
|
|
75
|
+
setHoveredMedia={setHoveredMedia}
|
|
76
|
+
onSelectionChange={handleSelectionChange}
|
|
77
|
+
isEverythingOutOfStock={isEverythingOutOfStock}
|
|
78
|
+
outOfStockVariants={outOfStockVariants}
|
|
79
|
+
filteredVariants={filteredVariants}
|
|
80
|
+
attributeLabel={label}
|
|
81
|
+
/>
|
|
82
|
+
<dl className={classes.selection} style={{ display: 'none' }}>
|
|
83
|
+
<dt
|
|
84
|
+
data-cy="ProductOptions-Option-selectedLabel"
|
|
85
|
+
className={classes.selectionLabel}
|
|
86
|
+
>
|
|
87
|
+
<FormattedMessage
|
|
88
|
+
id="productOptions.selectedLabel"
|
|
89
|
+
defaultMessage="Selected {label}:"
|
|
90
|
+
values={{ label }}
|
|
91
|
+
/>
|
|
92
|
+
</dt>
|
|
93
|
+
<dd>{selectedValueDescription}</dd>
|
|
94
|
+
</dl>
|
|
95
|
+
</div>
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
Option.propTypes = {
|
|
100
|
+
attribute_code: string.isRequired,
|
|
101
|
+
attribute_id: string,
|
|
102
|
+
classes: shape({
|
|
103
|
+
root: string,
|
|
104
|
+
title: string
|
|
105
|
+
}),
|
|
106
|
+
label: string.isRequired,
|
|
107
|
+
onSelectionChange: func,
|
|
108
|
+
selectedValue: oneOfType([number, string]),
|
|
109
|
+
values: arrayOf(object).isRequired
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export default Option;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
composes: border-b from global;
|
|
3
|
+
composes: border-solid from global;
|
|
4
|
+
/* composes: border-subtle from global; */
|
|
5
|
+
/* composes: mx-sm from global; */
|
|
6
|
+
composes: my-0 from global;
|
|
7
|
+
composes: px-0 from global;
|
|
8
|
+
composes: py-xs from global;
|
|
9
|
+
|
|
10
|
+
border-color: rgb(230 233 234);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.title {
|
|
14
|
+
composes: block from global;
|
|
15
|
+
composes: font-semibold from global;
|
|
16
|
+
composes: leading-normal from global;
|
|
17
|
+
composes: mb-xs from global;
|
|
18
|
+
composes: text-colorDefault from global;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.selection {
|
|
22
|
+
composes: flex from global;
|
|
23
|
+
composes: leading-normal from global;
|
|
24
|
+
composes: mt-xs from global;
|
|
25
|
+
composes: text-colorDefault from global;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.selectionLabel {
|
|
29
|
+
composes: mr-xs from global;
|
|
30
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { array, func } from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import Option from './option';
|
|
5
|
+
import { useOptions } from '@magento/peregrine/lib/talons/ProductOptions/useOptions';
|
|
6
|
+
|
|
7
|
+
const Options = props => {
|
|
8
|
+
const {
|
|
9
|
+
classes,
|
|
10
|
+
onSelectionChange,
|
|
11
|
+
options,
|
|
12
|
+
variants,
|
|
13
|
+
setHoveredMedia,
|
|
14
|
+
selectedValues = [],
|
|
15
|
+
isEverythingOutOfStock,
|
|
16
|
+
outOfStockVariants
|
|
17
|
+
} = props;
|
|
18
|
+
|
|
19
|
+
const talonProps = useOptions({
|
|
20
|
+
onSelectionChange,
|
|
21
|
+
selectedValues,
|
|
22
|
+
options
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const { handleSelectionChange, selectedValueMap } = talonProps;
|
|
26
|
+
|
|
27
|
+
// Render a list of options passing in any pre-selected values.
|
|
28
|
+
return options.map(option => (
|
|
29
|
+
<Option
|
|
30
|
+
{...option}
|
|
31
|
+
classes={classes}
|
|
32
|
+
key={option.attribute_id}
|
|
33
|
+
variants={variants}
|
|
34
|
+
setHoveredMedia={setHoveredMedia}
|
|
35
|
+
onSelectionChange={handleSelectionChange}
|
|
36
|
+
selectedValue={selectedValueMap.get(option.label)}
|
|
37
|
+
isEverythingOutOfStock={isEverythingOutOfStock}
|
|
38
|
+
outOfStockVariants={outOfStockVariants}
|
|
39
|
+
/>
|
|
40
|
+
));
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
Options.propTypes = {
|
|
44
|
+
onSelectionChange: func,
|
|
45
|
+
options: array.isRequired,
|
|
46
|
+
selectedValues: array
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default Options;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { bool, func, number, oneOfType, shape, string } from 'prop-types';
|
|
3
|
+
import { useIntl } from 'react-intl';
|
|
4
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
5
|
+
import defaultClasses from './tile.module.css';
|
|
6
|
+
import { useTile } from '@magento/peregrine/lib/talons/ProductOptions/useTile';
|
|
7
|
+
import Image from '@magento/venia-ui/lib/components/Image';
|
|
8
|
+
import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
|
|
9
|
+
|
|
10
|
+
const getClassName = (
|
|
11
|
+
name,
|
|
12
|
+
isSelected,
|
|
13
|
+
hasFocus,
|
|
14
|
+
isOptionOutOfStock,
|
|
15
|
+
isEverythingOutOfStock
|
|
16
|
+
) =>
|
|
17
|
+
`${name}${isSelected ? '_selected' : ''}${hasFocus ? '_focused' : ''}${
|
|
18
|
+
isEverythingOutOfStock || isOptionOutOfStock ? '_outOfStock' : ''
|
|
19
|
+
}`;
|
|
20
|
+
|
|
21
|
+
const Tile = props => {
|
|
22
|
+
const {
|
|
23
|
+
hasFocus,
|
|
24
|
+
isSelected,
|
|
25
|
+
item: { label, value_index },
|
|
26
|
+
onClick,
|
|
27
|
+
isEverythingOutOfStock,
|
|
28
|
+
isOptionOutOfStock,
|
|
29
|
+
setHoveredMedia,
|
|
30
|
+
itemVariant
|
|
31
|
+
} = props;
|
|
32
|
+
|
|
33
|
+
const talonProps = useTile({
|
|
34
|
+
onClick,
|
|
35
|
+
itemVariant,
|
|
36
|
+
setHoveredMedia,
|
|
37
|
+
value_index
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const { handleMouseLeave, handleMouseEnter, handleClick, variantImg } = talonProps;
|
|
41
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
42
|
+
const className =
|
|
43
|
+
classes[
|
|
44
|
+
getClassName(
|
|
45
|
+
'root',
|
|
46
|
+
isSelected,
|
|
47
|
+
hasFocus,
|
|
48
|
+
isOptionOutOfStock,
|
|
49
|
+
isEverythingOutOfStock
|
|
50
|
+
)
|
|
51
|
+
];
|
|
52
|
+
const { formatMessage } = useIntl();
|
|
53
|
+
const ariaLabelView = formatMessage(
|
|
54
|
+
{
|
|
55
|
+
id: 'ProductOptions.productSize',
|
|
56
|
+
defaultMessage: 'Fashion size {label}'
|
|
57
|
+
},
|
|
58
|
+
{ label: label }
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
const ariaLabelSelected = formatMessage(
|
|
62
|
+
{
|
|
63
|
+
id: 'productOptions.selectedSize',
|
|
64
|
+
defaultMessage: 'Fashion size {label} button Selected'
|
|
65
|
+
},
|
|
66
|
+
{ label: label }
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
const result = isSelected ? ariaLabelSelected : ariaLabelView;
|
|
70
|
+
|
|
71
|
+
// variantImg
|
|
72
|
+
let image = (
|
|
73
|
+
<Image
|
|
74
|
+
alt=''
|
|
75
|
+
classes={{
|
|
76
|
+
root: classes.variantImageSwatch
|
|
77
|
+
}}
|
|
78
|
+
resource={variantImg}
|
|
79
|
+
width={24}
|
|
80
|
+
/>
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<button
|
|
85
|
+
className={className}
|
|
86
|
+
onClick={handleClick}
|
|
87
|
+
onMouseEnter={handleMouseEnter}
|
|
88
|
+
onFocus={handleMouseEnter}
|
|
89
|
+
onTouchStart={handleMouseEnter}
|
|
90
|
+
onMouseLeave={handleMouseLeave}
|
|
91
|
+
title={label}
|
|
92
|
+
type="button"
|
|
93
|
+
data-cy="Tile-button"
|
|
94
|
+
aria-label={result}
|
|
95
|
+
disabled={isEverythingOutOfStock || isOptionOutOfStock}
|
|
96
|
+
>
|
|
97
|
+
{image}
|
|
98
|
+
<span className={classes.label}>{label}</span>
|
|
99
|
+
</button>
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export default Tile;
|
|
104
|
+
|
|
105
|
+
Tile.propTypes = {
|
|
106
|
+
hasFocus: bool,
|
|
107
|
+
isSelected: bool,
|
|
108
|
+
item: shape({
|
|
109
|
+
label: string.isRequired,
|
|
110
|
+
value_index: oneOfType([number, string]).isRequired
|
|
111
|
+
}).isRequired,
|
|
112
|
+
onClick: func.isRequired
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
Tile.defaultProps = {
|
|
116
|
+
hasFocus: false,
|
|
117
|
+
isSelected: false
|
|
118
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
composes: root from '@magento/venia-ui/lib/components/clickable.module.css';
|
|
3
|
+
|
|
4
|
+
/* composes: border from global; */
|
|
5
|
+
/* composes: border-solid from global; */
|
|
6
|
+
/* composes: border-strong from global; */
|
|
7
|
+
/* composes: h-[3rem] from global; */
|
|
8
|
+
/* composes: min-w-[3rem] from global; */
|
|
9
|
+
/* composes: px-2xs from global; */
|
|
10
|
+
/* composes: py-0 from global; */
|
|
11
|
+
/* composes: rounded-sm from global; */
|
|
12
|
+
position: relative;
|
|
13
|
+
border: 1px solid rgb(230 233 234);
|
|
14
|
+
border-radius: 2px;
|
|
15
|
+
padding: .5rem;
|
|
16
|
+
align-items: center;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.variantImageSwatch {
|
|
20
|
+
width: 24px;
|
|
21
|
+
height: 24px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.root:hover {
|
|
25
|
+
border-color: rgba(247, 107, 28);
|
|
26
|
+
color: rgba(247, 107, 28);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.label {
|
|
30
|
+
padding-left: 0.4rem;
|
|
31
|
+
padding-right: 5px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.root_selected {
|
|
35
|
+
composes: root;
|
|
36
|
+
|
|
37
|
+
/* composes: bg-gray-900 from global;
|
|
38
|
+
composes: text-white from global; */
|
|
39
|
+
border-color: rgba(247, 107, 28);
|
|
40
|
+
color: rgba(247, 107, 28);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.root_focused {
|
|
44
|
+
composes: root;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.root_selected_focused {
|
|
48
|
+
composes: root_selected;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.root_outOfStock,
|
|
52
|
+
.root_selected_outOfStock {
|
|
53
|
+
composes: root;
|
|
54
|
+
composes: bg-disabledTile from global;
|
|
55
|
+
composes: opacity-50 from global;
|
|
56
|
+
composes: border-2 from global;
|
|
57
|
+
composes: border-solid from global;
|
|
58
|
+
composes: border-gray-400 from global;
|
|
59
|
+
composes: text-gray-600 from global;
|
|
60
|
+
}
|
|
61
|
+
.root_outOfStock:after,
|
|
62
|
+
.root_selected_outOfStock:after {
|
|
63
|
+
content: '';
|
|
64
|
+
position: absolute;
|
|
65
|
+
border-top: 2px solid rgb(var(--venia-global-color-gray-400));
|
|
66
|
+
width: 62px;
|
|
67
|
+
transform: rotate(-45deg);
|
|
68
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { arrayOf, func, object, shape, string } from 'prop-types';
|
|
3
|
+
import Tile from './tile';
|
|
4
|
+
|
|
5
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
6
|
+
import defaultClasses from './tileList.module.css';
|
|
7
|
+
|
|
8
|
+
const TileList = props => {
|
|
9
|
+
const {
|
|
10
|
+
getItemKey,
|
|
11
|
+
selectedValue = {},
|
|
12
|
+
items,
|
|
13
|
+
onSelectionChange,
|
|
14
|
+
isEverythingOutOfStock,
|
|
15
|
+
outOfStockVariants,
|
|
16
|
+
setHoveredMedia,
|
|
17
|
+
filteredVariants
|
|
18
|
+
} = props;
|
|
19
|
+
|
|
20
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
21
|
+
|
|
22
|
+
const tiles = useMemo(
|
|
23
|
+
() =>
|
|
24
|
+
items.map(item => {
|
|
25
|
+
const value_index = item.value_index;
|
|
26
|
+
|
|
27
|
+
const itemVariant = filteredVariants.filter(variant => {
|
|
28
|
+
return variant.attributes.some(attribute => attribute.value_index === value_index);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const isSelected = item.label === selectedValue.label;
|
|
32
|
+
let isOptionOutOfStock;
|
|
33
|
+
if (outOfStockVariants && outOfStockVariants.length > 0) {
|
|
34
|
+
const flatOutOfStockArray = outOfStockVariants.flat();
|
|
35
|
+
isOptionOutOfStock = flatOutOfStockArray.includes(
|
|
36
|
+
item.value_index
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<Tile
|
|
42
|
+
key={getItemKey(item)}
|
|
43
|
+
isSelected={isSelected}
|
|
44
|
+
item={item}
|
|
45
|
+
setHoveredMedia={setHoveredMedia}
|
|
46
|
+
itemVariant={itemVariant}
|
|
47
|
+
onClick={onSelectionChange}
|
|
48
|
+
isEverythingOutOfStock={isEverythingOutOfStock}
|
|
49
|
+
isOptionOutOfStock={isOptionOutOfStock}
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
}),
|
|
53
|
+
[
|
|
54
|
+
getItemKey,
|
|
55
|
+
selectedValue.label,
|
|
56
|
+
items,
|
|
57
|
+
onSelectionChange,
|
|
58
|
+
isEverythingOutOfStock,
|
|
59
|
+
outOfStockVariants
|
|
60
|
+
]
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
return <div className={classes.root}>{tiles}</div>;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
TileList.propTypes = {
|
|
67
|
+
classes: shape({
|
|
68
|
+
root: string
|
|
69
|
+
}),
|
|
70
|
+
getItemKey: func,
|
|
71
|
+
selectedValue: object,
|
|
72
|
+
items: arrayOf(object),
|
|
73
|
+
onSelectionChange: func
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
TileList.displayName = 'TileList';
|
|
77
|
+
|
|
78
|
+
export default TileList;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { shape, string } from 'prop-types';
|
|
3
|
+
import Shimmer from '@magento/venia-ui/lib/components/Shimmer';
|
|
4
|
+
|
|
5
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
6
|
+
import defaultClasses from './tileList.module.css';
|
|
7
|
+
|
|
8
|
+
const TileListShimmer = props => {
|
|
9
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
10
|
+
|
|
11
|
+
const tiles = useMemo(() => {
|
|
12
|
+
return Array.from({ length: 3 })
|
|
13
|
+
.fill(null)
|
|
14
|
+
.map((value, index) => {
|
|
15
|
+
return <Shimmer width={3} height={3} key={`tile-${index}`} />;
|
|
16
|
+
});
|
|
17
|
+
}, []);
|
|
18
|
+
|
|
19
|
+
return <div className={classes.root}>{tiles}</div>;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
TileListShimmer.defaultProps = {
|
|
23
|
+
classes: {}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
TileListShimmer.propTypes = {
|
|
27
|
+
classes: shape({
|
|
28
|
+
root: string
|
|
29
|
+
})
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default TileListShimmer;
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { gql } from '@apollo/client';
|
|
2
|
-
|
|
3
|
-
export const ADD_TO_FAVORITE_SELLER_LIST = gql`
|
|
4
|
-
mutation AddSellerToFavoriteList(
|
|
5
|
-
$sellerId: ID!
|
|
6
|
-
) {
|
|
7
|
-
addSellerToFavoritelist(
|
|
8
|
-
sellerId: $sellerId
|
|
9
|
-
) {
|
|
10
|
-
favorite {
|
|
11
|
-
id
|
|
12
|
-
customer_id
|
|
13
|
-
creation_time
|
|
14
|
-
status
|
|
15
|
-
}
|
|
16
|
-
error
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
`;
|
|
20
|
-
|
|
21
|
-
export const GET_SELLER_IN_FAVORITE_LISTS = gql`
|
|
22
|
-
query GetProductsInWishlistsForGallery {
|
|
23
|
-
customerWishlistProducts @client
|
|
24
|
-
}
|
|
25
|
-
`;
|
|
26
|
-
|
|
27
|
-
export default {
|
|
28
|
-
addToFavoriteSellerMutation: ADD_TO_FAVORITE_SELLER_LIST,
|
|
29
|
-
getSellerInFavoriteListsQuery: GET_SELLER_IN_FAVORITE_LISTS
|
|
30
|
-
};
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
|
|
3
|
+
export const ADD_TO_FAVORITE_SELLER_LIST = gql`
|
|
4
|
+
mutation AddSellerToFavoriteList(
|
|
5
|
+
$sellerId: ID!
|
|
6
|
+
) {
|
|
7
|
+
addSellerToFavoritelist(
|
|
8
|
+
sellerId: $sellerId
|
|
9
|
+
) {
|
|
10
|
+
favorite {
|
|
11
|
+
id
|
|
12
|
+
customer_id
|
|
13
|
+
creation_time
|
|
14
|
+
status
|
|
15
|
+
}
|
|
16
|
+
error
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
export const GET_SELLER_IN_FAVORITE_LISTS = gql`
|
|
22
|
+
query GetProductsInWishlistsForGallery {
|
|
23
|
+
customerWishlistProducts @client
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
export default {
|
|
28
|
+
addToFavoriteSellerMutation: ADD_TO_FAVORITE_SELLER_LIST,
|
|
29
|
+
getSellerInFavoriteListsQuery: GET_SELLER_IN_FAVORITE_LISTS
|
|
30
|
+
};
|
|
@@ -51,19 +51,14 @@ export const useLegoSets = props => {
|
|
|
51
51
|
}, [introspectionData]);
|
|
52
52
|
const filters = getFiltersFromSearch(search);
|
|
53
53
|
|
|
54
|
-
// console.log(search)
|
|
55
|
-
|
|
56
54
|
// Construct the filter arg object.
|
|
57
55
|
const newFilters = {};
|
|
58
56
|
filters.forEach((values, key) => {
|
|
59
57
|
newFilters[key] = getFilterInput(values, filterTypeMap.get(key));
|
|
60
|
-
// console.log(key)
|
|
61
|
-
// console.log(values)
|
|
62
58
|
|
|
63
59
|
if (key == "sc_baseball_release") {
|
|
64
60
|
for(let item of values) {
|
|
65
61
|
if(item) {
|
|
66
|
-
// console.log(item.split(',')[0])
|
|
67
62
|
const data = search.split('&');
|
|
68
63
|
data.pop();
|
|
69
64
|
activeFilters.push(
|
|
@@ -133,7 +133,6 @@ export const useTrainsSets = props => {
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
if (activeTab == "trains_gauge") {
|
|
136
|
-
console.log(activeFilter + ' dan '+set.trains_gauge)
|
|
137
136
|
return set.trains_gauge.search(new RegExp('<'+activeFilter+'>', "i")) != -1;
|
|
138
137
|
}
|
|
139
138
|
|
|
@@ -177,8 +176,6 @@ export const useTrainsSets = props => {
|
|
|
177
176
|
})
|
|
178
177
|
}
|
|
179
178
|
|
|
180
|
-
console.log(filteredSets)
|
|
181
|
-
|
|
182
179
|
return searchQuery || activeFilter ? filteredSets : trainsSets;
|
|
183
180
|
}, [trainsSets, searchQuery, activeFilter]);
|
|
184
181
|
|