@riosst100/pwa-marketplace 1.7.4 → 1.7.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/components/CustomSubCategory/subCategory.js +12 -10
- package/src/components/FilterTop/CurrentTopFilters/currentTopFilter.js +2 -2
- package/src/components/FilterTop/FilterBlockList/filterBlockList.js +3 -1
- package/src/components/FilterTop/FilterBlockList/filterTopItem.js +9 -4
- package/src/components/FilterTop/FilterBlockList/filterTopItemGroup.js +3 -2
- package/src/components/FilterTop/filterTop.js +45 -3
- package/src/components/FilterTop/filterTop.module.css +1 -1
- package/src/components/FilterTop/filterTopBlock.js +3 -1
- package/src/components/SubCategory/subCategory.js +1 -1
- package/src/talons/FilterTop/useFilterTop.js +1 -27
- package/src/talons/SubCategory/useSubCategory.js +1 -1
package/package.json
CHANGED
|
@@ -20,16 +20,18 @@ const SubCategory = props => {
|
|
|
20
20
|
|
|
21
21
|
const subCategory = [];
|
|
22
22
|
|
|
23
|
-
normalizedData && normalizedData.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
if (normalizedData && normalizedData.length) {
|
|
24
|
+
normalizedData.map(({ text, path }, index) => {
|
|
25
|
+
subCategory.push(
|
|
26
|
+
<Link
|
|
27
|
+
key={index}
|
|
28
|
+
to={path}
|
|
29
|
+
>
|
|
30
|
+
<li className={classes.item}>{text}</li>
|
|
31
|
+
</Link>
|
|
32
|
+
)
|
|
33
|
+
});
|
|
34
|
+
}
|
|
33
35
|
|
|
34
36
|
return subCategory.length ? <ul className={classes.root}>{subCategory}</ul> : '';
|
|
35
37
|
|
|
@@ -31,7 +31,7 @@ const CurrentTopFilter = props => {
|
|
|
31
31
|
}
|
|
32
32
|
);
|
|
33
33
|
|
|
34
|
-
return (
|
|
34
|
+
return group != "shopby" ? (
|
|
35
35
|
<span className={classes.item} data-cy="CurrentTopFilter-root">
|
|
36
36
|
<Trigger
|
|
37
37
|
action={handleClick}
|
|
@@ -41,7 +41,7 @@ const CurrentTopFilter = props => {
|
|
|
41
41
|
All
|
|
42
42
|
</Trigger>
|
|
43
43
|
</span>
|
|
44
|
-
);
|
|
44
|
+
) : '';
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
export default CurrentTopFilter;
|
|
@@ -12,7 +12,8 @@ const FilterBlockList = props => {
|
|
|
12
12
|
items,
|
|
13
13
|
onApply,
|
|
14
14
|
filterNames,
|
|
15
|
-
originalFilterState
|
|
15
|
+
originalFilterState,
|
|
16
|
+
search
|
|
16
17
|
} = props;
|
|
17
18
|
|
|
18
19
|
const itemElements = useMemo(() => {
|
|
@@ -27,6 +28,7 @@ const FilterBlockList = props => {
|
|
|
27
28
|
items={items}
|
|
28
29
|
onApply={onApply}
|
|
29
30
|
labels={labels}
|
|
31
|
+
search={search}
|
|
30
32
|
filterNames={filterNames}
|
|
31
33
|
key={key}
|
|
32
34
|
/>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import defaultClasses from './filterTopItem.module.css';
|
|
3
3
|
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
4
|
+
import { Link } from 'react-router-dom';
|
|
4
5
|
|
|
5
6
|
const FilterTopItem = props => {
|
|
6
|
-
const { filterApi, group, item, onApply, labels, activeFilters } = props;
|
|
7
|
+
const { filterApi, group, item, onApply, labels, activeFilters, search } = props;
|
|
7
8
|
const { removeGroup, toggleItem } = filterApi;
|
|
8
9
|
const { title, value } = item;
|
|
9
10
|
|
|
@@ -26,10 +27,14 @@ const FilterTopItem = props => {
|
|
|
26
27
|
[group, item, onApply, removeGroup, toggleItem]
|
|
27
28
|
);
|
|
28
29
|
|
|
29
|
-
const element =
|
|
30
|
-
<
|
|
30
|
+
const element = group == "shopby" ? (
|
|
31
|
+
<Link className={classes.item} to={search ? search + '&shopby=' + value : '?shopby=' + value}>{title}</Link>
|
|
31
32
|
) : (
|
|
32
|
-
|
|
33
|
+
activeFilters.includes(value) ? (
|
|
34
|
+
<span className={classes.item}><b>{title}</b></span>
|
|
35
|
+
) : (
|
|
36
|
+
<span className={classes.item} onClick={() =>handleOnchange(value)}>{title}</span>
|
|
37
|
+
)
|
|
33
38
|
)
|
|
34
39
|
|
|
35
40
|
labels.set(element, label);
|
|
@@ -7,7 +7,7 @@ import defaultClasses from './filterTopItemGroup.module.css';
|
|
|
7
7
|
import CurrentTopFilter from '@riosst100/pwa-marketplace/src/components/FilterTop/CurrentTopFilters/currentTopFilter';
|
|
8
8
|
|
|
9
9
|
const FilterTopItemGroup = props => {
|
|
10
|
-
const { filterApi, filterState, group, items, onApply, labels, filterNames, originalFilterState } = props;
|
|
10
|
+
const { filterApi, filterState, group, items, onApply, labels, filterNames, originalFilterState, search } = props;
|
|
11
11
|
|
|
12
12
|
const classes = useStyle(defaultClasses, props.classes);
|
|
13
13
|
|
|
@@ -50,6 +50,7 @@ const FilterTopItemGroup = props => {
|
|
|
50
50
|
filterState={filterState}
|
|
51
51
|
group={group}
|
|
52
52
|
activeFilters={activeFilters}
|
|
53
|
+
search={search}
|
|
53
54
|
item={item}
|
|
54
55
|
onApply={onApply}
|
|
55
56
|
labels={labels}
|
|
@@ -83,7 +84,7 @@ const FilterTopItemGroup = props => {
|
|
|
83
84
|
return (
|
|
84
85
|
<div className={classes.root}>
|
|
85
86
|
{radioItems}
|
|
86
|
-
{filterElements && filterElements.length ? filterElements : <span className={classes.item}><b>All</b></span>}
|
|
87
|
+
{filterElements && filterElements.length ? filterElements : group != "shopby" ? (<span className={classes.item}><b>All</b></span>) : ''}
|
|
87
88
|
</div>
|
|
88
89
|
);
|
|
89
90
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React, { useMemo, useCallback, useRef } from 'react';
|
|
1
|
+
import React, { useMemo, useCallback, useRef, useState } from 'react';
|
|
2
2
|
import { FormattedMessage } from 'react-intl';
|
|
3
3
|
import { array, arrayOf, shape, string, number } from 'prop-types';
|
|
4
4
|
import { useFilterTop } from '@riosst100/pwa-marketplace/src/talons/FilterTop';
|
|
5
|
-
|
|
5
|
+
import { useLocation } from 'react-router-dom';
|
|
6
6
|
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
7
7
|
import LinkButton from '@magento/venia-ui/lib/components/LinkButton';
|
|
8
8
|
import FilterTopBlock from './filterTopBlock';
|
|
@@ -10,6 +10,8 @@ import defaultClasses from './filterTop.module.css';
|
|
|
10
10
|
import { Filter } from 'iconsax-react';
|
|
11
11
|
import cn from 'classnames';
|
|
12
12
|
import { useHistory } from 'react-router-dom';
|
|
13
|
+
import { Link } from 'react-router-dom';
|
|
14
|
+
import { getFiltersFromSearch } from '@magento/peregrine/lib/talons/FilterModal/helpers';
|
|
13
15
|
|
|
14
16
|
|
|
15
17
|
const SCROLL_OFFSET = 150;
|
|
@@ -33,6 +35,21 @@ const FilterTop = props => {
|
|
|
33
35
|
customFilters
|
|
34
36
|
} = talonProps;
|
|
35
37
|
|
|
38
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
39
|
+
|
|
40
|
+
const [activeSportCardsSetsFilter, setActiveSportCardsSetsFilter] = useState('all');
|
|
41
|
+
const [activeBaseSetFilter, setActiveBaseSetFilter] = useState('all');
|
|
42
|
+
|
|
43
|
+
const { search } = useLocation();
|
|
44
|
+
|
|
45
|
+
// const filtersSearch = getFiltersFromSearch(search);
|
|
46
|
+
|
|
47
|
+
// console.log(search)
|
|
48
|
+
|
|
49
|
+
// filters.forEach((values, key) => {
|
|
50
|
+
// newFilters[key] = getFilterInput(values, filterTypeMap.get(key));
|
|
51
|
+
// });
|
|
52
|
+
|
|
36
53
|
const filterRef = useRef();
|
|
37
54
|
|
|
38
55
|
const handleApplyFilter = useCallback(
|
|
@@ -84,6 +101,10 @@ const FilterTop = props => {
|
|
|
84
101
|
// });
|
|
85
102
|
// const allowedFiltersArr = ['card_rarity','card_print_version','card_set', 'card_product_type'];
|
|
86
103
|
|
|
104
|
+
// console.log(customFilters)
|
|
105
|
+
|
|
106
|
+
// console.log(filterItems)
|
|
107
|
+
|
|
87
108
|
const filtersList = useMemo(
|
|
88
109
|
() =>
|
|
89
110
|
Array.from(filterItems, ([group, items], iteration) => {
|
|
@@ -101,6 +122,7 @@ const FilterTop = props => {
|
|
|
101
122
|
originalFilterState={filterState}
|
|
102
123
|
filterFrontendInput={frontendInput}
|
|
103
124
|
group={group}
|
|
125
|
+
search={search}
|
|
104
126
|
items={items}
|
|
105
127
|
name={groupName}
|
|
106
128
|
onApply={group == "category_uid" ? handleCategoryApplyFilter : handleApplyFilter}
|
|
@@ -122,7 +144,27 @@ const FilterTop = props => {
|
|
|
122
144
|
);
|
|
123
145
|
|
|
124
146
|
return (
|
|
125
|
-
<div>
|
|
147
|
+
<div>
|
|
148
|
+
{/* <div className={classes.root}>
|
|
149
|
+
{sportCardsSetsFilter.map(({label, value}, index) =>
|
|
150
|
+
activeSportCardsSetsFilter == value ? <span className={classes.item}><b>{label}</b></span> : <span onClick={() => setActiveSportCardsSetsFilter(value)} className={classes.item}>{label}</span>
|
|
151
|
+
)}
|
|
152
|
+
</div>
|
|
153
|
+
<div className={classes.root}>
|
|
154
|
+
{activeSportCardsSetsFilter == "base_set" && baseSetFilter.map(({label, value}, index) =>
|
|
155
|
+
activeBaseSetFilter == value ? <span className={classes.item}><b>{label}</b></span> : <span onClick={() => setActiveBaseSetFilter(value)} className={classes.item}>{label}</span>
|
|
156
|
+
)}
|
|
157
|
+
</div> */}
|
|
158
|
+
{filtersList}
|
|
159
|
+
{/* {activeSportCardsSetsFilter == "inserts_parallel" && (
|
|
160
|
+
<>
|
|
161
|
+
<div className={classes.root}>
|
|
162
|
+
<Link to={'?shopby=inserts'} className={classes.item}>Inserts</Link>
|
|
163
|
+
<Link to={'?shopby=parallel'} className={classes.item}>Parallel</Link>
|
|
164
|
+
</div>
|
|
165
|
+
</>
|
|
166
|
+
)} */}
|
|
167
|
+
</div>
|
|
126
168
|
);
|
|
127
169
|
};
|
|
128
170
|
|
|
@@ -24,7 +24,8 @@ const FilterTopBlock = props => {
|
|
|
24
24
|
onApply,
|
|
25
25
|
filterNames,
|
|
26
26
|
initialOpen,
|
|
27
|
-
originalFilterState
|
|
27
|
+
originalFilterState,
|
|
28
|
+
search
|
|
28
29
|
} = props;
|
|
29
30
|
|
|
30
31
|
const { formatMessage } = useIntl();
|
|
@@ -42,6 +43,7 @@ const FilterTopBlock = props => {
|
|
|
42
43
|
name={name}
|
|
43
44
|
filterFrontendInput={filterFrontendInput}
|
|
44
45
|
group={group}
|
|
46
|
+
search={search}
|
|
45
47
|
items={items}
|
|
46
48
|
filterNames={filterNames}
|
|
47
49
|
onApply={onApply}
|
|
@@ -20,7 +20,7 @@ const SubCategory = props => {
|
|
|
20
20
|
|
|
21
21
|
const subCategory = [];
|
|
22
22
|
|
|
23
|
-
normalizedData && normalizedData.map(({ text, path }, index) => {
|
|
23
|
+
normalizedData && normalizedData.length && normalizedData.map(({ text, path }, index) => {
|
|
24
24
|
if (index < maxSubCategory) {
|
|
25
25
|
subCategory.push(
|
|
26
26
|
<Link
|
|
@@ -173,33 +173,7 @@ export const useFilterTop = props => {
|
|
|
173
173
|
const frontendInput = new Map();
|
|
174
174
|
const itemsByGroup = new Map();
|
|
175
175
|
const customFiltersMap = [];
|
|
176
|
-
|
|
177
|
-
const sortedFilters = sortFiltersArray([...filters]);
|
|
178
|
-
|
|
179
|
-
for (const filter of sortedFilters) {
|
|
180
|
-
const { options, label: name, attribute_code: group } = filter;
|
|
181
|
-
|
|
182
|
-
// If this aggregation is not a possible filter, just back out.
|
|
183
|
-
if (possibleFilters.has(group)) {
|
|
184
|
-
const items = [];
|
|
185
|
-
|
|
186
|
-
// add filter name
|
|
187
|
-
names.set(group, name);
|
|
188
|
-
|
|
189
|
-
// add filter key permutations
|
|
190
|
-
keys.add(`${group}[filter]`);
|
|
191
|
-
|
|
192
|
-
// Add frontend input type
|
|
193
|
-
frontendInput.set(group, null);
|
|
194
|
-
// add items
|
|
195
|
-
for (const { label, value, path } of options) {
|
|
196
|
-
items.push({ title: stripHtml(label), value, path });
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
itemsByGroup.set(group, items);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
176
|
+
|
|
203
177
|
if (customFiltersData) {
|
|
204
178
|
customFiltersData.map(({ attribute_code, options }, index) => {
|
|
205
179
|
|