@riosst100/pwa-marketplace 1.5.9 → 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 -1
- package/src/components/SubCategory/subCategory.js +20 -19
- package/src/overwrites/peregrine/lib/talons/RootComponents/Category/categoryContent.gql.js +13 -1
- package/src/overwrites/peregrine/lib/talons/RootComponents/Category/useCategoryContent.js +16 -3
- 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/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" ? (
|
|
@@ -43,7 +43,9 @@ const CustomFilter = props => {
|
|
|
43
43
|
|
|
44
44
|
const subCategory = [];
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
const customAttributeLandingPage = ['card_set', 'sc_baseball_release'];
|
|
47
|
+
|
|
48
|
+
if (customAttributeLandingPage.includes(group)) {
|
|
47
49
|
normalizedData && normalizedData.map(({ label, path }, index) => {
|
|
48
50
|
subCategory.push(
|
|
49
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;
|
|
@@ -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,
|
|
@@ -174,6 +186,7 @@ export const useCategoryContent = props => {
|
|
|
174
186
|
children,
|
|
175
187
|
parent,
|
|
176
188
|
attributesBlock,
|
|
177
|
-
category
|
|
189
|
+
category,
|
|
190
|
+
virtualCategoryFilters
|
|
178
191
|
};
|
|
179
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
|