@riosst100/pwa-marketplace 1.5.8 → 1.6.0
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/components/CollectibleGameSets/collectibleGameSets.js +9 -2
- package/src/components/FilterTop/CustomFilters/customFilter.js +3 -4
- package/src/components/SubCategory/subCategory.js +20 -19
- package/src/overwrites/peregrine/lib/talons/FilterSidebar/useFilterSidebar.js +2 -2
- package/src/overwrites/peregrine/lib/talons/RootComponents/Category/categoryContent.gql.js +13 -1
- package/src/overwrites/peregrine/lib/talons/RootComponents/Category/useCategoryContent.js +19 -4
- package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.js +5 -3
- package/src/overwrites/venia-ui/lib/components/FilterModal/CurrentFilters/currentFilters.js +3 -1
- package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterItem.js +2 -1
- package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterItemRadio.js +7 -4
- package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterItemRadioGroup.js +2 -1
- package/src/overwrites/venia-ui/lib/components/FilterSidebar/filterSidebar.js +29 -1
package/package.json
CHANGED
|
@@ -100,11 +100,18 @@ const CollectibleGameSets = props => {
|
|
|
100
100
|
}
|
|
101
101
|
];
|
|
102
102
|
|
|
103
|
+
let title = "All Sets";
|
|
104
|
+
if (productType == "expansion-sets") {
|
|
105
|
+
title = "Expansion Sets";
|
|
106
|
+
} else if (productType == "artist") {
|
|
107
|
+
title = "Artist";
|
|
108
|
+
}
|
|
109
|
+
|
|
103
110
|
return (
|
|
104
111
|
<Fragment>
|
|
105
|
-
<StoreTitle>{
|
|
112
|
+
<StoreTitle>{title}</StoreTitle>
|
|
106
113
|
<h1 className='mx-auto relative block text-xl font-bold text-center pt-10 pb-4'>
|
|
107
|
-
{
|
|
114
|
+
{title}
|
|
108
115
|
</h1>
|
|
109
116
|
<div className='border border-gray-100 px-6'>
|
|
110
117
|
{productType != "expansion-sets" ? (
|
|
@@ -26,9 +26,6 @@ const CustomFilter = props => {
|
|
|
26
26
|
}
|
|
27
27
|
);
|
|
28
28
|
|
|
29
|
-
console.log(group)
|
|
30
|
-
console.log(item)
|
|
31
|
-
|
|
32
29
|
const normalizedData = [
|
|
33
30
|
{
|
|
34
31
|
'label': 'Sealed Products',
|
|
@@ -46,7 +43,9 @@ const CustomFilter = props => {
|
|
|
46
43
|
|
|
47
44
|
const subCategory = [];
|
|
48
45
|
|
|
49
|
-
|
|
46
|
+
const customAttributeLandingPage = ['card_set', 'sc_baseball_release'];
|
|
47
|
+
|
|
48
|
+
if (customAttributeLandingPage.includes(group)) {
|
|
50
49
|
normalizedData && normalizedData.map(({ label, path }, index) => {
|
|
51
50
|
subCategory.push(
|
|
52
51
|
<Link
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { useSubCategory } from '@riosst100/pwa-marketplace/src/talons/SubCategory/useSubCategory';
|
|
2
|
-
import React
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { Link } from 'react-router-dom';
|
|
4
4
|
import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
|
|
5
5
|
import defaultClasses from './subCategory.module.css';
|
|
6
6
|
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
7
|
-
import { useFilterSidebar } from '@magento/peregrine/lib/talons/FilterSidebar';
|
|
8
|
-
import CollectibleGameSets from '@riosst100/pwa-marketplace/src/components/CollectibleGameSets/collectibleGameSets';
|
|
9
7
|
|
|
10
8
|
const SubCategory = props => {
|
|
11
|
-
const { children } = props;
|
|
9
|
+
const { children, parent } = props;
|
|
12
10
|
|
|
13
11
|
const talonProps = useSubCategory({ children });
|
|
14
12
|
|
|
@@ -17,32 +15,35 @@ const SubCategory = props => {
|
|
|
17
15
|
const {
|
|
18
16
|
normalizedData
|
|
19
17
|
} = talonProps;
|
|
18
|
+
|
|
19
|
+
const maxSubCategory = 5;
|
|
20
20
|
|
|
21
21
|
const subCategory = [];
|
|
22
22
|
|
|
23
23
|
normalizedData && normalizedData.map(({ text, path }, index) => {
|
|
24
|
+
if (index < maxSubCategory) {
|
|
25
|
+
subCategory.push(
|
|
26
|
+
<Link
|
|
27
|
+
key={index}
|
|
28
|
+
to={resourceUrl(path)}
|
|
29
|
+
>
|
|
30
|
+
<li className={classes.item}>{text}</li>
|
|
31
|
+
</Link>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
if (normalizedData.length > maxSubCategory) {
|
|
24
37
|
subCategory.push(
|
|
25
38
|
<Link
|
|
26
|
-
|
|
27
|
-
to={resourceUrl(path)}
|
|
39
|
+
to={resourceUrl('/')}
|
|
28
40
|
>
|
|
29
|
-
<li className={classes.item}>{
|
|
41
|
+
<li className={classes.item}>{"Other " + parent[0].name}</li>
|
|
30
42
|
</Link>
|
|
31
43
|
)
|
|
32
|
-
}
|
|
44
|
+
}
|
|
33
45
|
|
|
34
46
|
return subCategory.length ? <ul className={classes.root}>{subCategory}</ul> : '';
|
|
35
|
-
|
|
36
|
-
// const [activeTab, setActiveTab] = useState('singles')
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<>
|
|
40
|
-
<ul className={classes.root}>
|
|
41
|
-
<li className={classes.item}>All Sets</li>
|
|
42
|
-
<li className={classes.item}>Expansion Sets</li>
|
|
43
|
-
</ul>
|
|
44
|
-
</>
|
|
45
|
-
)
|
|
46
47
|
};
|
|
47
48
|
|
|
48
49
|
export default SubCategory;
|
|
@@ -140,8 +140,8 @@ export const useFilterSidebar = props => {
|
|
|
140
140
|
// Add frontend input type
|
|
141
141
|
frontendInput.set(group, null);
|
|
142
142
|
// add items
|
|
143
|
-
for (const { label, value } of options) {
|
|
144
|
-
items.push({ title: stripHtml(label), value });
|
|
143
|
+
for (const { label, value, path } of options) {
|
|
144
|
+
items.push({ title: stripHtml(label), value, path });
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
itemsByGroup.set(group, items);
|
|
@@ -78,8 +78,20 @@ export const GET_CATEGORY_AVAILABLE_SORT_METHODS = gql`
|
|
|
78
78
|
}
|
|
79
79
|
`;
|
|
80
80
|
|
|
81
|
+
export const GET_STORE_CONFIG_DATA = gql`
|
|
82
|
+
query GetStoreConfigForBreadcrumbs {
|
|
83
|
+
# eslint-disable-next-line @graphql-eslint/require-id-when-available
|
|
84
|
+
storeConfig {
|
|
85
|
+
store_code
|
|
86
|
+
custommarketplace_plp_filters_virtualcategory
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
`;
|
|
90
|
+
|
|
91
|
+
|
|
81
92
|
export default {
|
|
82
93
|
getCategoryContentQuery: GET_CATEGORY_CONTENT,
|
|
83
94
|
getProductFiltersByCategoryQuery: GET_PRODUCT_FILTERS_BY_CATEGORY,
|
|
84
|
-
getCategoryAvailableSortMethodsQuery: GET_CATEGORY_AVAILABLE_SORT_METHODS
|
|
95
|
+
getCategoryAvailableSortMethodsQuery: GET_CATEGORY_AVAILABLE_SORT_METHODS,
|
|
96
|
+
getStoreConfigQuery: GET_STORE_CONFIG_DATA
|
|
85
97
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
1
|
+
import { useEffect, useMemo } from 'react';
|
|
2
2
|
import { useLazyQuery, useQuery } from '@apollo/client';
|
|
3
3
|
|
|
4
4
|
import mergeOperations from '@magento/peregrine/lib/util/shallowMerge';
|
|
@@ -26,10 +26,22 @@ export const useCategoryContent = props => {
|
|
|
26
26
|
const {
|
|
27
27
|
getCategoryContentQuery,
|
|
28
28
|
getProductFiltersByCategoryQuery,
|
|
29
|
-
getCategoryAvailableSortMethodsQuery
|
|
29
|
+
getCategoryAvailableSortMethodsQuery,
|
|
30
|
+
getStoreConfigQuery
|
|
30
31
|
} = operations;
|
|
31
32
|
|
|
32
33
|
const placeholderItems = Array.from({ length: pageSize }).fill(null);
|
|
34
|
+
|
|
35
|
+
const { data: storeConfigData } = useQuery(getStoreConfigQuery, {
|
|
36
|
+
fetchPolicy: 'cache-and-network'
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const virtualCategoryFilters = useMemo(() => {
|
|
40
|
+
if (storeConfigData) {
|
|
41
|
+
const data = storeConfigData.storeConfig.custommarketplace_plp_filters_virtualcategory;
|
|
42
|
+
return data ? data.split(',') : [];
|
|
43
|
+
}
|
|
44
|
+
}, [storeConfigData]);
|
|
33
45
|
|
|
34
46
|
const [getFilters, { data: filterData }] = useLazyQuery(
|
|
35
47
|
getProductFiltersByCategoryQuery,
|
|
@@ -106,7 +118,8 @@ export const useCategoryContent = props => {
|
|
|
106
118
|
children && children.map((category, index) => {
|
|
107
119
|
filterOptions.push({
|
|
108
120
|
'label': category.name,
|
|
109
|
-
'value': category.uid
|
|
121
|
+
'value': category.uid,
|
|
122
|
+
'path': category.url_path
|
|
110
123
|
});
|
|
111
124
|
});
|
|
112
125
|
|
|
@@ -117,6 +130,7 @@ export const useCategoryContent = props => {
|
|
|
117
130
|
attribute_code: filter.attribute_code,
|
|
118
131
|
count: filter.count,
|
|
119
132
|
label: label,
|
|
133
|
+
position: filter.position,
|
|
120
134
|
options: filterOptions.length ? filterOptions : filter.options
|
|
121
135
|
};
|
|
122
136
|
|
|
@@ -172,6 +186,7 @@ export const useCategoryContent = props => {
|
|
|
172
186
|
children,
|
|
173
187
|
parent,
|
|
174
188
|
attributesBlock,
|
|
175
|
-
category
|
|
189
|
+
category,
|
|
190
|
+
virtualCategoryFilters
|
|
176
191
|
};
|
|
177
192
|
};
|
|
@@ -65,10 +65,12 @@ const CategoryContent = props => {
|
|
|
65
65
|
filters,
|
|
66
66
|
items,
|
|
67
67
|
children,
|
|
68
|
+
parent,
|
|
68
69
|
totalCount,
|
|
69
70
|
totalPagesFromData,
|
|
70
71
|
attributesBlock,
|
|
71
|
-
category
|
|
72
|
+
category,
|
|
73
|
+
virtualCategoryFilters
|
|
72
74
|
} = talonProps;
|
|
73
75
|
|
|
74
76
|
const sidebarRef = useRef(null);
|
|
@@ -186,7 +188,7 @@ const CategoryContent = props => {
|
|
|
186
188
|
|
|
187
189
|
const label = filterArr[0];
|
|
188
190
|
const optionId = filterArr[1];
|
|
189
|
-
if (
|
|
191
|
+
if (virtualCategoryFilters && virtualCategoryFilters.includes(key)) {
|
|
190
192
|
activeFilters.push(
|
|
191
193
|
{
|
|
192
194
|
'label': label
|
|
@@ -217,7 +219,7 @@ const CategoryContent = props => {
|
|
|
217
219
|
</div>
|
|
218
220
|
{/* {activeFilters.size <= 0 && category && category.custom_landing_page ? ( */}
|
|
219
221
|
<>
|
|
220
|
-
<SubCategory children={children} />
|
|
222
|
+
<SubCategory parent={parent} children={children} />
|
|
221
223
|
{!currentFilter && <CustomSubCategory customSubCategory={category ? category.custom_subcategory : null} />}
|
|
222
224
|
</>
|
|
223
225
|
{/* ) : ( */}
|
|
@@ -20,7 +20,9 @@ const CurrentFilters = props => {
|
|
|
20
20
|
const { title, value } = item || {};
|
|
21
21
|
const key = `${group}::${title}_${value}`;
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
const customAttributeLandingPage = ['card_set', 'sc_baseball_release'];
|
|
24
|
+
|
|
25
|
+
if (!customAttributeLandingPage.includes(group)) {
|
|
24
26
|
elements.push(
|
|
25
27
|
<li key={key} className={classes.item}>
|
|
26
28
|
<CurrentFilter
|
|
@@ -26,9 +26,11 @@ const FilterItemRadio = props => {
|
|
|
26
26
|
|
|
27
27
|
const handleOnchange = useCallback(
|
|
28
28
|
e => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
if (group != "category_uid") {
|
|
30
|
+
removeGroup({ group });
|
|
31
|
+
if (e.target.value === item.value) {
|
|
32
|
+
toggleItem({ group, item });
|
|
33
|
+
}
|
|
32
34
|
}
|
|
33
35
|
if (typeof onApply === 'function') {
|
|
34
36
|
onApply(group, item);
|
|
@@ -67,7 +69,8 @@ FilterItemRadio.propTypes = {
|
|
|
67
69
|
item: shape({
|
|
68
70
|
title: string.isRequired,
|
|
69
71
|
value: oneOfType([number, string]).isRequired,
|
|
70
|
-
label: string
|
|
72
|
+
label: string,
|
|
73
|
+
path: string
|
|
71
74
|
}).isRequired,
|
|
72
75
|
onApply: func,
|
|
73
76
|
labels: instanceOf(Map).isRequired
|
|
@@ -10,6 +10,8 @@ import FilterBlock from '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/
|
|
|
10
10
|
import defaultClasses from './filterSidebar.module.css';
|
|
11
11
|
import { Filter } from 'iconsax-react';
|
|
12
12
|
import cn from 'classnames';
|
|
13
|
+
import { useHistory } from 'react-router-dom';
|
|
14
|
+
|
|
13
15
|
|
|
14
16
|
const SCROLL_OFFSET = 150;
|
|
15
17
|
|
|
@@ -52,6 +54,30 @@ const FilterSidebar = props => {
|
|
|
52
54
|
[handleApply, filterRef]
|
|
53
55
|
);
|
|
54
56
|
|
|
57
|
+
const history = useHistory();
|
|
58
|
+
|
|
59
|
+
const handleCategoryApplyFilter = useCallback(
|
|
60
|
+
(...args) => {
|
|
61
|
+
// const filterElement = filterRef.current;
|
|
62
|
+
// if (
|
|
63
|
+
// filterElement &&
|
|
64
|
+
// typeof filterElement.getBoundingClientRect === 'function'
|
|
65
|
+
// ) {
|
|
66
|
+
// const filterTop = filterElement.getBoundingClientRect().top;
|
|
67
|
+
// const windowScrollY =
|
|
68
|
+
// window.scrollY + filterTop - SCROLL_OFFSET;
|
|
69
|
+
// window.scrollTo(0, windowScrollY);
|
|
70
|
+
// }
|
|
71
|
+
|
|
72
|
+
history.push('/'+args[1].path+'.html');
|
|
73
|
+
|
|
74
|
+
if (args[0] != "category_uid") {
|
|
75
|
+
handleApply(...args);
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
[handleApply, filterRef]
|
|
79
|
+
);
|
|
80
|
+
|
|
55
81
|
const allowedFiltersArr = [];
|
|
56
82
|
|
|
57
83
|
allowedFilters.length && allowedFilters.map((val, index) => {
|
|
@@ -65,6 +91,8 @@ const FilterSidebar = props => {
|
|
|
65
91
|
const groupName = filterNames.get(group);
|
|
66
92
|
const frontendInput = filterFrontendInput.get(group);
|
|
67
93
|
if (!allowedFiltersArr.length && group != "category_uid" || allowedFiltersArr.length && allowedFiltersArr.includes(group)) {
|
|
94
|
+
|
|
95
|
+
|
|
68
96
|
return (
|
|
69
97
|
<FilterBlock
|
|
70
98
|
key={group}
|
|
@@ -74,7 +102,7 @@ const FilterSidebar = props => {
|
|
|
74
102
|
group={group}
|
|
75
103
|
items={items}
|
|
76
104
|
name={groupName}
|
|
77
|
-
onApply={handleApplyFilter}
|
|
105
|
+
onApply={group == "category_uid" ? handleCategoryApplyFilter : handleApplyFilter}
|
|
78
106
|
initialOpen={iteration < filterCountToOpen}
|
|
79
107
|
/>
|
|
80
108
|
);
|