@riosst100/pwa-marketplace 1.9.6 → 1.9.7
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 +4 -4
- package/src/components/FilterTop/CurrentTopFilters/currentTopFilter.js +1 -1
- package/src/components/FilterTop/FilterBlockList/filterTopItem.js +26 -3
- package/src/components/FilterTop/FilterBlockList/filterTopItemGroup.js +1 -1
- package/src/components/FilterTop/filterTop.js +1 -1
- package/src/components/ShopBy/shopBy.js +8 -0
- package/src/components/ShopByFilters/index.js +1 -0
- package/src/components/ShopByFilters/shopByFilters.js +74 -0
- package/src/components/ShopByFilters/shopByFilters.module.css +21 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/category.js +1 -7
- package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.js +1 -1
- package/src/talons/FilterTop/filterTop.gql.js +2 -2
- package/src/talons/FilterTop/useFilterTop.js +2 -1
- package/src/talons/ShopBy/shopBy.gql.js +2 -2
- package/src/talons/ShopBy/useShopBy.js +3 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riosst100/pwa-marketplace",
|
|
3
3
|
"author": "riosst100@gmail.com",
|
|
4
|
-
"version": "1.9.
|
|
4
|
+
"version": "1.9.7",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"pwa-studio": {
|
|
7
7
|
"targets": {
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
"axios": "^1.6.5",
|
|
13
13
|
"iconsax-react": "^0.0.8",
|
|
14
14
|
"react-countdown": "^2.3.5",
|
|
15
|
-
"react-phone-number-input": "^3.3.9",
|
|
16
|
-
"react-slick": "^0.30.2",
|
|
17
15
|
"react-datepicker": "4.10.0",
|
|
18
|
-
"react-dropzone": "^14.2.3"
|
|
16
|
+
"react-dropzone": "^14.2.3",
|
|
17
|
+
"react-phone-number-input": "^3.3.9",
|
|
18
|
+
"react-slick": "^0.30.2"
|
|
19
19
|
},
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"private": false
|
|
@@ -31,7 +31,7 @@ const CurrentTopFilter = props => {
|
|
|
31
31
|
}
|
|
32
32
|
);
|
|
33
33
|
|
|
34
|
-
return group && group != "toys_character" && group != "toys_product_series" && group != "toys_scale" && group != "toys_product_line" && group != "filterby" && group != "trains" && group != "toys_franchise" && group != "toys_brands" && group != "
|
|
34
|
+
return group && group != "toys_character" && group != "toys_product_series" && group != "toys_scale" && group != "toys_product_line" && group != "filterby" && group != "trains" && group != "toys_franchise" && group != "toys_brands" && group != "category" && group != "shopby" ? (
|
|
35
35
|
<span className={classes.item} data-cy="CurrentTopFilter-root">
|
|
36
36
|
<Trigger
|
|
37
37
|
action={handleClick}
|
|
@@ -28,6 +28,22 @@ const FilterTopItem = props => {
|
|
|
28
28
|
[group, item, onApply, removeGroup, toggleItem]
|
|
29
29
|
);
|
|
30
30
|
|
|
31
|
+
let filterSearchArr = search ? search.split('&') : [];
|
|
32
|
+
let categoryIdFilters = [];
|
|
33
|
+
let shopbyFilters = [];
|
|
34
|
+
if (filterSearchArr) {
|
|
35
|
+
categoryIdFilters = filterSearchArr.filter(function(data) {
|
|
36
|
+
return data && data.includes('cat_id');
|
|
37
|
+
})
|
|
38
|
+
shopbyFilters = filterSearchArr.filter(function(data) {
|
|
39
|
+
return data && data.includes('shopby');
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// console.log(filterSearchArr)
|
|
44
|
+
|
|
45
|
+
// const catId = null;
|
|
46
|
+
|
|
31
47
|
const element = group == "filterby" ? (
|
|
32
48
|
filterBy == value ? (
|
|
33
49
|
<span className={classes.item}><b>{title}</b></span>
|
|
@@ -36,12 +52,19 @@ const FilterTopItem = props => {
|
|
|
36
52
|
)
|
|
37
53
|
) : group == "category" ? (
|
|
38
54
|
<Link className={classes.item} to={'/'+value}>{title}</Link>
|
|
39
|
-
) : value == "
|
|
40
|
-
<Link className={classes.item} to={search ? search + '&shopby=' +
|
|
55
|
+
) : value == "shopby_all" ? (
|
|
56
|
+
<Link className={classes.item} to={search ? search + '&shopby=' + group : '?shopby=' + group}>{title}</Link>
|
|
41
57
|
) : group == "shopby" || group == "shopby_with_all" ? (
|
|
42
58
|
<Link className={classes.item} to={search ? search + '&shopby=' + value : '?shopby=' + value}>{title}</Link>
|
|
59
|
+
) : group == "cat_id" ? (
|
|
60
|
+
value == "all" && !categoryIdFilters.length || categoryIdFilters.length && categoryIdFilters[0].includes('cat_id='+value) ? (
|
|
61
|
+
<span className={classes.item}><b>{title}</b></span>
|
|
62
|
+
) : (
|
|
63
|
+
value == "all" ? <Link className={classes.item} to={'#'}>{title}</Link> :
|
|
64
|
+
<Link className={classes.item} to={'?cat_id=' + value + (shopbyFilters.length ? '&' + shopbyFilters[0] : '')}>{title}</Link>
|
|
65
|
+
)
|
|
43
66
|
) : (
|
|
44
|
-
activeFilters.includes(value) ? (
|
|
67
|
+
activeFilters && activeFilters.includes(value) ? (
|
|
45
68
|
<span className={classes.item}><b>{title}</b></span>
|
|
46
69
|
) : (
|
|
47
70
|
<span className={classes.item} onClick={() =>handleOnchange(value)}>{title}</span>
|
|
@@ -87,7 +87,7 @@ const FilterTopItemGroup = props => {
|
|
|
87
87
|
<div className={classes.root}>
|
|
88
88
|
{radioItems}
|
|
89
89
|
{filterElements && filterElements.length > 10 ? <span className={classes.item}><b>More Item</b></span> : ''}
|
|
90
|
-
{filterElements && filterElements.length ? filterElements : group && group != "toys_character" && group != "toys_product_series" && group != "toys_scale" && group != "toys_product_line" && group != "trains" && group != "
|
|
90
|
+
{filterElements && filterElements.length ? filterElements : group && group != "toys_character" && group != "toys_product_series" && group != "toys_scale" && group != "toys_product_line" && group != "trains" && group != "toys_franchise" && group != "toys_brands" && group != "category" && group != "filterby" && group != "shopby" && group != "cat_id" ? (<span className={classes.item}><b>All</b></span>) : ''}
|
|
91
91
|
</div>
|
|
92
92
|
);
|
|
93
93
|
};
|
|
@@ -114,8 +114,8 @@ const FilterTop = props => {
|
|
|
114
114
|
const blockState = filterState.get(group);
|
|
115
115
|
const groupName = filterNames.get(group);
|
|
116
116
|
const frontendInput = filterFrontendInput.get(group);
|
|
117
|
+
|
|
117
118
|
if (customFilters && customFilters.length && customFilters.includes(group)) {
|
|
118
|
-
|
|
119
119
|
return (
|
|
120
120
|
<FilterTopBlock
|
|
121
121
|
key={group}
|
|
@@ -31,6 +31,7 @@ import { useLocation } from 'react-router-dom';
|
|
|
31
31
|
import { getFiltersFromSearch } from '@magento/peregrine/lib/talons/FilterModal/helpers';
|
|
32
32
|
import CustomSubCategory from '@riosst100/pwa-marketplace/src/components/SubCategory/customSubCategory';
|
|
33
33
|
import AlphaFilter from '@riosst100/pwa-marketplace/src/components/AlphaFilter';
|
|
34
|
+
import ShopByFilters from '@riosst100/pwa-marketplace/src/components/ShopByFilters';
|
|
34
35
|
|
|
35
36
|
import ErrorView from '@magento/venia-ui/lib/components/ErrorView';
|
|
36
37
|
import { StoreTitle, Meta } from '@magento/venia-ui/lib/components/Head';
|
|
@@ -133,6 +134,9 @@ const ShopBy = props => {
|
|
|
133
134
|
filterSearchArr = filterSearchArr.filter(function(data) {
|
|
134
135
|
return !data.includes('shopby');
|
|
135
136
|
})
|
|
137
|
+
filterSearchArr = filterSearchArr.filter(function(data) {
|
|
138
|
+
return !data.includes('trains_roadname_country');
|
|
139
|
+
})
|
|
136
140
|
let filterSearch = filterSearchArr.join('&')
|
|
137
141
|
|
|
138
142
|
if (!filterSearch.includes('?')) {
|
|
@@ -335,10 +339,14 @@ const ShopBy = props => {
|
|
|
335
339
|
setSearchQuery('')
|
|
336
340
|
}
|
|
337
341
|
|
|
342
|
+
// console.log(category)
|
|
343
|
+
|
|
338
344
|
return (
|
|
339
345
|
<Fragment>
|
|
340
346
|
<StoreTitle>{title}</StoreTitle>
|
|
341
347
|
<Breadcrumbs categoryId={categoryId} customPage={title} currentFilter={activeFilters} />
|
|
348
|
+
{category.url_path.includes('model-railway') && <FilterTop shopby={shopby} filters={[]} category={category} children={[]} allowedFilters={category ? category.allowed_filters : []} />}
|
|
349
|
+
{/* <ShopByFilters handleActiveFilter={handleActiveFilter} activeFilter={activeFilter} category={category} /> */}
|
|
342
350
|
{availableFilterOption.length ?
|
|
343
351
|
<ul className={classes.nav}>
|
|
344
352
|
{availableFilterOption.map((filter, index) => (
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './shopByFilters';
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
// import ErrorView from '@magento/venia-ui/lib/components/ErrorView';
|
|
3
|
+
// import { StoreTitle, Meta } from '@magento/venia-ui/lib/components/Head';
|
|
4
|
+
// import { useShopByFilters } from '@riosst100/pwa-marketplace/src/talons/ShopByFilters/useShopByFilters';
|
|
5
|
+
// import { Link } from 'react-router-dom';
|
|
6
|
+
// import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
|
|
7
|
+
import defaultClasses from './shopByFilters.module.css';
|
|
8
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
9
|
+
// import cn from 'classnames';
|
|
10
|
+
// import Divider from '@riosst100/pwa-marketplace/src/components/Divider';
|
|
11
|
+
// import CustomSortBy from '@riosst100/pwa-marketplace/src/components/CustomSortBy';
|
|
12
|
+
// import ArraySearchInput from '@riosst100/pwa-marketplace/src/components/ArraySearchInput';
|
|
13
|
+
// import { useCustomSort } from '@riosst100/pwa-marketplace/src/hooks/useCustomSort';
|
|
14
|
+
// import Breadcrumbs from '@magento/venia-ui/lib/components/Breadcrumbs';
|
|
15
|
+
|
|
16
|
+
const ShopByFilters = props => {
|
|
17
|
+
const { activeFilter, handleActiveFilter, category } = props;
|
|
18
|
+
|
|
19
|
+
const classes = useStyle(defaultClasses);
|
|
20
|
+
|
|
21
|
+
// const talonProps = useShopByFilters({ activeFilter, searchQuery, setActive, currentSort, shopby, setType, categoryId, activeTab });
|
|
22
|
+
|
|
23
|
+
// const { error, loading, shopByBrands, categoryUrlSuffix, categoryUrlKey, productType, filteredShopByBrands, availableGroups, category } = talonProps;
|
|
24
|
+
|
|
25
|
+
// if (loading && !shopByBrands)
|
|
26
|
+
// return <ShopByBrandsShimmer />;
|
|
27
|
+
// if (error && !shopByBrands) return <ErrorView />;
|
|
28
|
+
|
|
29
|
+
// if (!shopByBrands && !loading && !error) {
|
|
30
|
+
// return <ShopByBrandsShimmer />;
|
|
31
|
+
// }
|
|
32
|
+
|
|
33
|
+
// url_path
|
|
34
|
+
|
|
35
|
+
let availableShopByFilters = [];
|
|
36
|
+
|
|
37
|
+
if (category.url_path.includes('model-railway')) {
|
|
38
|
+
availableShopByFilters = [
|
|
39
|
+
'N Scale',
|
|
40
|
+
'HO Scale',
|
|
41
|
+
'O Scale',
|
|
42
|
+
'G Scale',
|
|
43
|
+
'S Scale',
|
|
44
|
+
'Z Scale'
|
|
45
|
+
];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<ul className={classes.nav}>
|
|
50
|
+
{availableShopByFilters.map((label, index) => (
|
|
51
|
+
<li key={index} className={classes.nav_item}>
|
|
52
|
+
<button
|
|
53
|
+
onClick={() => {
|
|
54
|
+
handleActiveFilter(label)
|
|
55
|
+
}}
|
|
56
|
+
>
|
|
57
|
+
{activeFilter == label ? <b>{label}</b> : label}
|
|
58
|
+
</button>
|
|
59
|
+
</li>
|
|
60
|
+
))}
|
|
61
|
+
<li className={classes.nav_item}>
|
|
62
|
+
<button
|
|
63
|
+
onClick={() => {
|
|
64
|
+
handleActiveFilter('')
|
|
65
|
+
}}
|
|
66
|
+
>
|
|
67
|
+
{!activeFilter ? <b>All</b> : 'All'}
|
|
68
|
+
</button>
|
|
69
|
+
</li>
|
|
70
|
+
</ul>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export default ShopByFilters;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.nav {
|
|
2
|
+
composes: flex from global;
|
|
3
|
+
composes: flex-wrap from global;
|
|
4
|
+
margin: 50px 0 30px 0;
|
|
5
|
+
composes: gap-[10px] from global;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.nav_item {
|
|
9
|
+
composes: px-4 from global;
|
|
10
|
+
composes: py-2 from global;
|
|
11
|
+
composes: transition-colors from global;
|
|
12
|
+
composes: duration-150 from global;
|
|
13
|
+
composes: border from global;
|
|
14
|
+
composes: border-solid from global;
|
|
15
|
+
composes: leading-normal from global;
|
|
16
|
+
composes: text-base from global;
|
|
17
|
+
composes: text-colorDefault from global;
|
|
18
|
+
composes: bg-white from global;
|
|
19
|
+
composes: border-gray-100 from global;
|
|
20
|
+
border-radius: 5px;
|
|
21
|
+
}
|
|
@@ -88,18 +88,12 @@ const Category = props => {
|
|
|
88
88
|
categoryId={uid}
|
|
89
89
|
isLoading={loading} />
|
|
90
90
|
) : (
|
|
91
|
-
shopby == "
|
|
92
|
-
categoryId={uid}
|
|
93
|
-
shopby={shopby}
|
|
94
|
-
isLoading={loading} /> : shopby == "singles" || shopby == "lego_set_name" && parentCategoryUrlKey == "lego" ? <LegoSets
|
|
91
|
+
shopby == "singles" || shopby == "lego_set_name" && parentCategoryUrlKey == "lego" ? <LegoSets
|
|
95
92
|
categoryId={uid}
|
|
96
93
|
shopby={shopby}
|
|
97
94
|
isLoading={loading} /> : shopby && parentCategoryUrlKey == "non-sports-cards" ? <NonSportCardsSets
|
|
98
95
|
categoryId={uid}
|
|
99
96
|
shopby={shopby}
|
|
100
|
-
isLoading={loading} /> : shopby == "trains_brands" || shopby == "trains_roadname" ? <TrainsSets
|
|
101
|
-
categoryId={uid}
|
|
102
|
-
shopby={shopby}
|
|
103
97
|
isLoading={loading} /> : shopby == "sc_baseball_players" || shopby == "sc_baseball_teams" || shopby == "release" && parentCategoryUrlKey == "sport-cards" ? <SportCardsSets
|
|
104
98
|
categoryId={uid}
|
|
105
99
|
shopby={shopby}
|
|
@@ -266,7 +266,7 @@ const CategoryContent = props => {
|
|
|
266
266
|
if (label == "Singles") {
|
|
267
267
|
isSingles = true;
|
|
268
268
|
}
|
|
269
|
-
if (key == "toys_product_line" && urlKey == "brands" || key == "toys_product_line" && urlKey == "franchise" || key == "toys_franchise" && urlKey == "brands" || key == "toys_franchise" && urlKey == "franchise" || key == "toys_brands" && urlKey == "franchise" || key == "toys_brands" && urlKey == "brands" || virtualCategoryFilters.includes(key)) {
|
|
269
|
+
if (key == "toys_product_line" && urlKey == "brands" || key == "toys_product_line" && urlKey == "franchise" || key == "toys_franchise" && urlKey == "brands" || key == "toys_franchise" && urlKey == "franchise" || key == "toys_brands" && urlKey == "franchise" || key == "toys_brands" && urlKey == "brands" || virtualCategoryFilters && virtualCategoryFilters.includes(key)) {
|
|
270
270
|
activeFilters.push(
|
|
271
271
|
{
|
|
272
272
|
'label': label,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { gql } from '@apollo/client';
|
|
2
2
|
|
|
3
3
|
export const GET_CUSTOM_FILTERS = gql`
|
|
4
|
-
query GetCustomFilters($filterBy: String, $shopby: String, $category: String!, $filters: ProductAttributeFilterInput!) {
|
|
5
|
-
customSubFilters(filterBy: $filterBy, shopby: $shopby, category: $category, filters: $filters) {
|
|
4
|
+
query GetCustomFilters($search: String, $filterBy: String, $shopby: String, $category: String!, $filters: ProductAttributeFilterInput!) {
|
|
5
|
+
customSubFilters(search: $search, filterBy: $filterBy, shopby: $shopby, category: $category, filters: $filters) {
|
|
6
6
|
label
|
|
7
7
|
count
|
|
8
8
|
attribute_code
|
|
@@ -12,8 +12,8 @@ export const GET_STORE_CONFIG_DATA = gql`
|
|
|
12
12
|
`;
|
|
13
13
|
|
|
14
14
|
export const GET_SHOP_BY_DATA_QUERY = gql`
|
|
15
|
-
query getShopByData($activeFilter: String, $categoryUrlKey: String!, $attributeCode: String, $filters: ProductAttributeFilterInput!) {
|
|
16
|
-
shopByData(activeFilter: $activeFilter, categoryUrlKey: $categoryUrlKey, attributeCode: $attributeCode, filters: $filters) {
|
|
15
|
+
query getShopByData($search: String, $activeFilter: String, $categoryUrlKey: String!, $attributeCode: String, $filters: ProductAttributeFilterInput!) {
|
|
16
|
+
shopByData(search: $search, activeFilter: $activeFilter, categoryUrlKey: $categoryUrlKey, attributeCode: $attributeCode, filters: $filters) {
|
|
17
17
|
label
|
|
18
18
|
count
|
|
19
19
|
attribute_code
|
|
@@ -93,7 +93,8 @@ export const useShopBy = props => {
|
|
|
93
93
|
filters: newFilters,
|
|
94
94
|
categoryUrlKey: categoryUrlKey,
|
|
95
95
|
attributeCode: shopby,
|
|
96
|
-
activeFilter: activeFilter
|
|
96
|
+
activeFilter: activeFilter,
|
|
97
|
+
search: search
|
|
97
98
|
}
|
|
98
99
|
});
|
|
99
100
|
}, [
|
|
@@ -103,7 +104,7 @@ export const useShopBy = props => {
|
|
|
103
104
|
// categoryUrlKey,
|
|
104
105
|
// filters
|
|
105
106
|
// filterTypeMap,
|
|
106
|
-
|
|
107
|
+
search
|
|
107
108
|
]);
|
|
108
109
|
|
|
109
110
|
// console.log(activeFilters)
|