@riosst100/pwa-marketplace 1.9.5 → 1.9.6
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/ShopByBrands/index.js +2 -0
- package/src/components/ShopByBrands/legoSets.shimmer.js +50 -0
- package/src/components/ShopByBrands/shopByBrands.js +327 -0
- package/src/components/ShopByBrands/shopByBrands.module.css +76 -0
- package/src/components/ShopByBrands/shopByBrands.shimmer.js +50 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/category.js +5 -2
- package/src/overwrites/venia-ui/lib/components/MegaMenu/customSubmenuColumn.js +1 -1
- package/src/overwrites/venia-ui/lib/components/MegaMenu/shopByColumn.js +1 -1
- package/src/overwrites/venia-ui/lib/components/MegaMenu/submenu.module.css +2 -2
- package/src/overwrites/venia-ui/lib/components/MegaMenu/submenuColumn.js +1 -1
- package/src/overwrites/venia-ui/lib/components/MegaMenu/submenuColumn.module.css +1 -1
- package/src/talons/ShopByBrands/shopByBrands.gql.js +59 -0
- package/src/talons/ShopByBrands/shopByBrands.js +59 -0
- package/src/talons/ShopByBrands/useShopByBrands.js +218 -0
package/package.json
CHANGED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { shape, string } from 'prop-types';
|
|
3
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
4
|
+
|
|
5
|
+
import Shimmer from '@magento/venia-ui/lib/components/Shimmer';
|
|
6
|
+
import defaultClasses from './legoSets.module.css';
|
|
7
|
+
import cn from 'classnames';
|
|
8
|
+
import Divider from '@riosst100/pwa-marketplace/src/components/Divider';
|
|
9
|
+
|
|
10
|
+
const ShopByBrands = props => {
|
|
11
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<>
|
|
15
|
+
<h1 className='mx-auto relative block text-xl font-bold text-center pt-10 pb-4'><Shimmer width="25%" height="6vh" /></h1>
|
|
16
|
+
<div className='border border-gray-100 px-6'>
|
|
17
|
+
<center>
|
|
18
|
+
<section className='single_list-indexing-container relative m-auto pt-5'>
|
|
19
|
+
<Shimmer width="95%" height="6vh" />
|
|
20
|
+
</section>
|
|
21
|
+
</center>
|
|
22
|
+
<Divider className="mb-5 px-4" />
|
|
23
|
+
<section className='singles-container'>
|
|
24
|
+
<div className={cn('singles-wrapper block -mx-4', classes.singlesWrapper)}>
|
|
25
|
+
<div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>
|
|
26
|
+
<div className='singles_item_group_letter text-xl font-semibold border-b border-gray-100 pb-1 mb-2' ><Shimmer width="95%" height="100vh" /></div>
|
|
27
|
+
</div>
|
|
28
|
+
<div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>
|
|
29
|
+
<div className='singles_item_group_letter text-xl font-semibold border-b border-gray-100 pb-1 mb-2' ><Shimmer width="95%" height="100vh" /></div>
|
|
30
|
+
</div>
|
|
31
|
+
<div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>
|
|
32
|
+
<div className='singles_item_group_letter text-xl font-semibold border-b border-gray-100 pb-1 mb-2' ><Shimmer width="95%" height="100vh" /></div>
|
|
33
|
+
</div>
|
|
34
|
+
<div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>
|
|
35
|
+
<div className='singles_item_group_letter text-xl font-semibold border-b border-gray-100 pb-1 mb-2' ><Shimmer width="95%" height="100vh" /></div>
|
|
36
|
+
</div>
|
|
37
|
+
<div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>
|
|
38
|
+
<div className='singles_item_group_letter text-xl font-semibold border-b border-gray-100 pb-1 mb-2' ><Shimmer width="95%" height="100vh" /></div>
|
|
39
|
+
</div>
|
|
40
|
+
<div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>
|
|
41
|
+
<div className='singles_item_group_letter text-xl font-semibold border-b border-gray-100 pb-1 mb-2' ><Shimmer width="95%" height="100vh" /></div>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</section>
|
|
45
|
+
</div>
|
|
46
|
+
</>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default ShopByBrands;
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import React, { Fragment, useEffect, useMemo, useState } 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 { useShopByBrands } from '@riosst100/pwa-marketplace/src/talons/ShopByBrands/useShopByBrands';
|
|
5
|
+
import { Link } from 'react-router-dom';
|
|
6
|
+
import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
|
|
7
|
+
import defaultClasses from './shopByBrands.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 { ShopByBrandsShimmer } from '@riosst100/pwa-marketplace/src/components/ShopByBrands';
|
|
12
|
+
import CustomSortBy from '@riosst100/pwa-marketplace/src/components/CustomSortBy';
|
|
13
|
+
import ArraySearchInput from '@riosst100/pwa-marketplace/src/components/ArraySearchInput';
|
|
14
|
+
import { useCustomSort } from '@riosst100/pwa-marketplace/src/hooks/useCustomSort';
|
|
15
|
+
import Breadcrumbs from '@magento/venia-ui/lib/components/Breadcrumbs';
|
|
16
|
+
|
|
17
|
+
const ShopByBrands = props => {
|
|
18
|
+
const { categoryId } = props
|
|
19
|
+
|
|
20
|
+
const { location } = globalThis;
|
|
21
|
+
|
|
22
|
+
const query = new URLSearchParams(location.search);
|
|
23
|
+
|
|
24
|
+
const [active, setActive] = useState('all');
|
|
25
|
+
const [activeTab, setActiveTab] = useState('all');
|
|
26
|
+
const [activeFilter, setActiveFilter] = useState('');
|
|
27
|
+
const [searchQuery, setSearchQuery] = useState('');
|
|
28
|
+
|
|
29
|
+
const shopby = query.get('shopby') || null;
|
|
30
|
+
const setType = query.get('set_type') || null;
|
|
31
|
+
|
|
32
|
+
let defaultSort = {
|
|
33
|
+
sortText: 'All (A-Z)',
|
|
34
|
+
value: 'all'
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
if (shopby == "release_year") {
|
|
38
|
+
defaultSort = {
|
|
39
|
+
sortText: 'All (By Year)',
|
|
40
|
+
value: 'date'
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// if (productType == "expansion_sets") {
|
|
45
|
+
// defaultSort = {
|
|
46
|
+
// sortText: 'All (Expansion Sets)',
|
|
47
|
+
// value: 'all'
|
|
48
|
+
// };
|
|
49
|
+
// }
|
|
50
|
+
|
|
51
|
+
// Sorting
|
|
52
|
+
const sortProps = useCustomSort({ sortFromSearch: false, defaultSort: defaultSort});
|
|
53
|
+
const [currentSort] = sortProps;
|
|
54
|
+
// const [sortBy, setSortBy] = useState({
|
|
55
|
+
// sortText: 'All (A-Z)',
|
|
56
|
+
// value: 'all'
|
|
57
|
+
// });
|
|
58
|
+
|
|
59
|
+
// let availableSortBy = [
|
|
60
|
+
// {
|
|
61
|
+
// 'label': 'All (A-Z)',
|
|
62
|
+
// 'value': 'all'
|
|
63
|
+
// },
|
|
64
|
+
// {
|
|
65
|
+
// 'label': 'By Year',
|
|
66
|
+
// 'value': 'newest'
|
|
67
|
+
// }
|
|
68
|
+
// ];
|
|
69
|
+
|
|
70
|
+
const classes = useStyle(defaultClasses);
|
|
71
|
+
|
|
72
|
+
const talonProps = useShopByBrands({ activeFilter, searchQuery, setActive, currentSort, shopby, setType, categoryId, activeTab });
|
|
73
|
+
|
|
74
|
+
const { error, loading, shopByBrands, categoryUrlSuffix, categoryUrlKey, productType, filteredShopByBrands, availableGroups, category } = talonProps;
|
|
75
|
+
|
|
76
|
+
if (loading && !shopByBrands)
|
|
77
|
+
return <ShopByBrandsShimmer />;
|
|
78
|
+
if (error && !shopByBrands) return <ErrorView />;
|
|
79
|
+
|
|
80
|
+
if (!shopByBrands && !loading && !error) {
|
|
81
|
+
return <ShopByBrandsShimmer />;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const setsLengthArr = [];
|
|
85
|
+
|
|
86
|
+
const newShopByBrands = searchQuery ? filteredShopByBrands : shopByBrands;
|
|
87
|
+
|
|
88
|
+
// useEffect(() => {
|
|
89
|
+
if (shopByBrands && shopByBrands.length) {
|
|
90
|
+
shopByBrands.map((setRelease, index) => {
|
|
91
|
+
const { group, sets } = setRelease;
|
|
92
|
+
|
|
93
|
+
setsLengthArr[group] = sets.length
|
|
94
|
+
})
|
|
95
|
+
}
|
|
96
|
+
// }, [shopByBrands])
|
|
97
|
+
|
|
98
|
+
const splitToNChunks = (array, n) => {
|
|
99
|
+
let result = [];
|
|
100
|
+
for (let i = n; i > 0; i--) {
|
|
101
|
+
result.push(array.splice(0, Math.ceil(array.length / i)));
|
|
102
|
+
}
|
|
103
|
+
return result;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
let allSetsTitle = "Sets";
|
|
107
|
+
let attributeCode = "lego_set_name";
|
|
108
|
+
let byYearTitle = "By Year";
|
|
109
|
+
// if (shopby == "singles") {
|
|
110
|
+
// attributeCode = "lego_set_name";
|
|
111
|
+
// // allSetsTitle = "Singles";
|
|
112
|
+
// byYearTitle = "By Year";
|
|
113
|
+
// }
|
|
114
|
+
|
|
115
|
+
const setRelases = newShopByBrands && newShopByBrands.length && newShopByBrands.map((setRelease, index) => {
|
|
116
|
+
const { group, sets } = setRelease;
|
|
117
|
+
|
|
118
|
+
const setsResult = [];
|
|
119
|
+
|
|
120
|
+
if (sets.length) {
|
|
121
|
+
sets.map((set, index) => {
|
|
122
|
+
const { set_name, option_id, release_year } = set;
|
|
123
|
+
|
|
124
|
+
const categoryUrl = resourceUrl(
|
|
125
|
+
`/${category?.url_path}${categoryUrlSuffix || ''}?${attributeCode}[filter]=${set_name},${option_id}`
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
setsResult.push(<li className='list-none'>
|
|
129
|
+
<Link to={categoryUrl} className="hover_bg-darkblue-900 hover_text-white w-full block text-[14px] py-[2px] px-2">
|
|
130
|
+
{set_name}
|
|
131
|
+
</Link>
|
|
132
|
+
</li>)
|
|
133
|
+
})
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
let setsResultSplitted = [];
|
|
137
|
+
if (active == group || newShopByBrands.length == 1) {
|
|
138
|
+
setsResultSplitted = splitToNChunks(setsResult, 3);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return (
|
|
142
|
+
<>
|
|
143
|
+
{active == "all" && newShopByBrands.length > 1 ?
|
|
144
|
+
<div className={cn('singles_group-wrapper mb-4 px-2 inline-block', classes.singlesGroupWrapper)}>
|
|
145
|
+
<div className='singles_item_group_letter text-xl font-semibold border-b border-gray-100 pb-1 mb-2' >
|
|
146
|
+
{group}
|
|
147
|
+
</div>
|
|
148
|
+
<div className={cn('singles_item-list flex flex-col')}>{setsResult}</div>
|
|
149
|
+
</div> : ''}
|
|
150
|
+
{active == group || newShopByBrands.length == 1 ? setsResultSplitted && setsResultSplitted.length && setsResultSplitted.map((setsResult, index) =>
|
|
151
|
+
<div key={index} className={cn('singles_group-wrapper mb-4 px-2 inline-block', classes.singlesGroupWrapper)}>
|
|
152
|
+
{index == 0 ? <div className='singles_item_group_letter text-xl font-semibold border-b border-gray-100 pb-1 mb-2'>{group}</div> :
|
|
153
|
+
<div className='singles_item_group_letter text-xl font-semibold pb-1 mb-2' style={{"marginTop":"35px"}}></div>}
|
|
154
|
+
<div className={cn('singles_item-list flex flex-col')}>{setsResult}</div>
|
|
155
|
+
</div>
|
|
156
|
+
)
|
|
157
|
+
: ''}
|
|
158
|
+
</>
|
|
159
|
+
);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
const handleActive = (val) => {
|
|
163
|
+
setActive(val);
|
|
164
|
+
|
|
165
|
+
setSearchQuery('')
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const handleActiveTab = (val) => {
|
|
169
|
+
setActiveTab(val);
|
|
170
|
+
setActive('all');
|
|
171
|
+
setActiveFilter('');
|
|
172
|
+
|
|
173
|
+
setSearchQuery('')
|
|
174
|
+
}
|
|
175
|
+
const handleSearchQuery = (val) => {
|
|
176
|
+
setSearchQuery(val)
|
|
177
|
+
setActive('all')
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
let alpha = ['#', 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];
|
|
181
|
+
|
|
182
|
+
let title = "Sets";
|
|
183
|
+
if (activeTab == "year") {
|
|
184
|
+
title = "Sets | By Year";
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const availableFilters = [
|
|
188
|
+
'Theme',
|
|
189
|
+
'Sub-Theme',
|
|
190
|
+
'Interest',
|
|
191
|
+
'Age Level'
|
|
192
|
+
];
|
|
193
|
+
|
|
194
|
+
const handleActiveFilter = (val) => {
|
|
195
|
+
setActiveFilter(val);
|
|
196
|
+
|
|
197
|
+
setActive('all');
|
|
198
|
+
|
|
199
|
+
setSearchQuery('')
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return (
|
|
203
|
+
<Fragment>
|
|
204
|
+
<StoreTitle>{title}</StoreTitle>
|
|
205
|
+
<Breadcrumbs categoryId={categoryId} customPage={shopby == "singles" ? "Mini-Figures" : title} />
|
|
206
|
+
<ul className={classes.nav}>
|
|
207
|
+
<li className={classes.nav_item}>
|
|
208
|
+
<button
|
|
209
|
+
onClick={() => {
|
|
210
|
+
handleActiveTab('year')
|
|
211
|
+
}}
|
|
212
|
+
>
|
|
213
|
+
{activeTab == 'year' ? <b>{byYearTitle}</b> : byYearTitle}
|
|
214
|
+
</button>
|
|
215
|
+
</li>
|
|
216
|
+
<li className={classes.nav_item}>
|
|
217
|
+
<button
|
|
218
|
+
onClick={() => {
|
|
219
|
+
handleActiveTab('all')
|
|
220
|
+
}}
|
|
221
|
+
>
|
|
222
|
+
{activeTab == 'all' ? <b>{allSetsTitle}</b> : allSetsTitle}
|
|
223
|
+
</button>
|
|
224
|
+
</li>
|
|
225
|
+
</ul>
|
|
226
|
+
{shopby == "lego_set_name" && activeTab == "all" ? <><ul className={classes.nav}>
|
|
227
|
+
{availableFilters.map((group, index) => (
|
|
228
|
+
<li key={index} className={classes.nav_item}>
|
|
229
|
+
<button
|
|
230
|
+
onClick={() => {
|
|
231
|
+
handleActiveFilter(group)
|
|
232
|
+
}}
|
|
233
|
+
>
|
|
234
|
+
{activeFilter == group ? <b>{group}</b> : group}
|
|
235
|
+
</button>
|
|
236
|
+
</li>
|
|
237
|
+
))}<li className={classes.nav_item}>
|
|
238
|
+
<button
|
|
239
|
+
onClick={() => {
|
|
240
|
+
handleActiveFilter('')
|
|
241
|
+
}}
|
|
242
|
+
>
|
|
243
|
+
{!activeFilter ? <b>A-Z</b> : 'A-Z'}
|
|
244
|
+
</button>
|
|
245
|
+
</li></ul>
|
|
246
|
+
|
|
247
|
+
</> : ''}
|
|
248
|
+
<h1 className='mx-auto relative block text-xl font-bold text-center pt-10 pb-4'>
|
|
249
|
+
{title}
|
|
250
|
+
</h1>
|
|
251
|
+
{activeTab == "year" && availableGroups ? <ul className={classes.nav}>
|
|
252
|
+
{availableGroups.map((group, index) => (
|
|
253
|
+
<li key={index} className={classes.nav_item}>
|
|
254
|
+
<button
|
|
255
|
+
onClick={() => {
|
|
256
|
+
handleActive(group)
|
|
257
|
+
}}
|
|
258
|
+
>
|
|
259
|
+
{active == group ? <b>{group}</b> : group}
|
|
260
|
+
</button>
|
|
261
|
+
</li>
|
|
262
|
+
))}
|
|
263
|
+
<li className={classes.nav_item}>
|
|
264
|
+
<button
|
|
265
|
+
onClick={() => {
|
|
266
|
+
handleActive('all')
|
|
267
|
+
}}
|
|
268
|
+
>
|
|
269
|
+
{active == 'all' ? <b>All</b> : 'All'}
|
|
270
|
+
</button>
|
|
271
|
+
</li>
|
|
272
|
+
</ul> : ''}
|
|
273
|
+
<div className='border border-gray-100 px-6'>
|
|
274
|
+
{shopByBrands ? (
|
|
275
|
+
<div
|
|
276
|
+
className={classes.toolbar}
|
|
277
|
+
>
|
|
278
|
+
<div style={{"width":"35%"}}><ArraySearchInput active={active} searchQuery={searchQuery} placeholder="Search sets..." isOpen={true} setSearchQuery={handleSearchQuery} /></div>
|
|
279
|
+
{/* <CustomSortBy sortProps={sortProps} availableSortMethods={availableSortBy} /> */}
|
|
280
|
+
</div>
|
|
281
|
+
) : ''}
|
|
282
|
+
<section className='single_list-indexing-container relative m-auto pt-5'>
|
|
283
|
+
{!activeFilter && activeTab != "year" && <ul className='flex gap-2 justify-center flex-wrap'>
|
|
284
|
+
<li>
|
|
285
|
+
<button
|
|
286
|
+
className={cn(
|
|
287
|
+
'rounded-md border border-solid border-gray-100 p-2 min-w-[28px]',
|
|
288
|
+
'leading-4 font-medium text-base hover_bg-gray-50'
|
|
289
|
+
)}
|
|
290
|
+
onClick={() => {
|
|
291
|
+
handleActive('all')
|
|
292
|
+
}}
|
|
293
|
+
>
|
|
294
|
+
{active == 'all' ? <b>All</b> : 'All'}
|
|
295
|
+
</button>
|
|
296
|
+
</li>
|
|
297
|
+
{alpha.map((letter, index) => (
|
|
298
|
+
<li key={index}>
|
|
299
|
+
<button
|
|
300
|
+
className={cn(
|
|
301
|
+
'rounded-md border border-solid border-gray-100 p-2 min-w-[28px]',
|
|
302
|
+
'leading-4 font-medium text-base ',
|
|
303
|
+
setsLengthArr[letter] > 0 ? 'hover_bg-gray-50' : 'bg-gray-100 text-gray-400',
|
|
304
|
+
)}
|
|
305
|
+
onClick={() => {
|
|
306
|
+
handleActive(letter)
|
|
307
|
+
}}
|
|
308
|
+
disabled={setsLengthArr[letter] > 0 ? false : true}
|
|
309
|
+
>
|
|
310
|
+
{active == letter ? <b>{letter}</b> : letter}
|
|
311
|
+
</button>
|
|
312
|
+
</li>
|
|
313
|
+
))}
|
|
314
|
+
</ul>}
|
|
315
|
+
</section>
|
|
316
|
+
<Divider className="mb-5 px-4 mt-5" />
|
|
317
|
+
<section className='singles-container'>
|
|
318
|
+
<div className={cn('singles-wrapper block -mx-4', classes.singlesWrapper)}>
|
|
319
|
+
{newShopByBrands && newShopByBrands.length ? setRelases : (searchQuery ? <div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>No sets found for <b>{searchQuery}</b> search query.</div> : <div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>No sets found.</div>)}
|
|
320
|
+
</div>
|
|
321
|
+
</section>
|
|
322
|
+
</div>
|
|
323
|
+
</Fragment>
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
export default ShopByBrands;
|
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
}
|
|
22
|
+
|
|
23
|
+
.toolbar {
|
|
24
|
+
composes: relative from global;
|
|
25
|
+
composes: ml-2xs from global;
|
|
26
|
+
display: flex;
|
|
27
|
+
justify-content: space-between;
|
|
28
|
+
margin-top: 20px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.tabs {
|
|
32
|
+
composes: flex from global;
|
|
33
|
+
composes: flex-wrap from global;
|
|
34
|
+
composes: mt-3 from global;
|
|
35
|
+
composes: gap-[15px] from global;
|
|
36
|
+
margin-bottom: 30px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.tabs_item {
|
|
40
|
+
composes: px-4 from global;
|
|
41
|
+
composes: py-2 from global;
|
|
42
|
+
composes: transition-colors from global;
|
|
43
|
+
composes: duration-150 from global;
|
|
44
|
+
composes: border from global;
|
|
45
|
+
composes: border-solid from global;
|
|
46
|
+
composes: leading-normal from global;
|
|
47
|
+
composes: text-base from global;
|
|
48
|
+
composes: text-colorDefault from global;
|
|
49
|
+
composes: bg-white from global;
|
|
50
|
+
composes: border-gray-100 from global;
|
|
51
|
+
border-radius: 5px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.singlesWrapper {
|
|
55
|
+
column-count: 1;
|
|
56
|
+
display: flex;
|
|
57
|
+
width: 100%;
|
|
58
|
+
flex-wrap: wrap;
|
|
59
|
+
flex-direction: row;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.singlesGroupWrapper {
|
|
63
|
+
width: 100%;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@media screen and (min-width: 768px) {
|
|
67
|
+
.singlesGroupWrapper {
|
|
68
|
+
width: 50%;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@media screen and (min-width: 1023px) {
|
|
73
|
+
.singlesGroupWrapper {
|
|
74
|
+
width: 33.33%;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { shape, string } from 'prop-types';
|
|
3
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
4
|
+
|
|
5
|
+
import Shimmer from '@magento/venia-ui/lib/components/Shimmer';
|
|
6
|
+
import defaultClasses from './shopByBrands.module.css';
|
|
7
|
+
import cn from 'classnames';
|
|
8
|
+
import Divider from '@riosst100/pwa-marketplace/src/components/Divider';
|
|
9
|
+
|
|
10
|
+
const ShopByBrands = props => {
|
|
11
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<>
|
|
15
|
+
<h1 className='mx-auto relative block text-xl font-bold text-center pt-10 pb-4'><Shimmer width="25%" height="6vh" /></h1>
|
|
16
|
+
<div className='border border-gray-100 px-6'>
|
|
17
|
+
<center>
|
|
18
|
+
<section className='single_list-indexing-container relative m-auto pt-5'>
|
|
19
|
+
<Shimmer width="95%" height="6vh" />
|
|
20
|
+
</section>
|
|
21
|
+
</center>
|
|
22
|
+
<Divider className="mb-5 px-4" />
|
|
23
|
+
<section className='singles-container'>
|
|
24
|
+
<div className={cn('singles-wrapper block -mx-4', classes.singlesWrapper)}>
|
|
25
|
+
<div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>
|
|
26
|
+
<div className='singles_item_group_letter text-xl font-semibold border-b border-gray-100 pb-1 mb-2' ><Shimmer width="95%" height="100vh" /></div>
|
|
27
|
+
</div>
|
|
28
|
+
<div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>
|
|
29
|
+
<div className='singles_item_group_letter text-xl font-semibold border-b border-gray-100 pb-1 mb-2' ><Shimmer width="95%" height="100vh" /></div>
|
|
30
|
+
</div>
|
|
31
|
+
<div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>
|
|
32
|
+
<div className='singles_item_group_letter text-xl font-semibold border-b border-gray-100 pb-1 mb-2' ><Shimmer width="95%" height="100vh" /></div>
|
|
33
|
+
</div>
|
|
34
|
+
<div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>
|
|
35
|
+
<div className='singles_item_group_letter text-xl font-semibold border-b border-gray-100 pb-1 mb-2' ><Shimmer width="95%" height="100vh" /></div>
|
|
36
|
+
</div>
|
|
37
|
+
<div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>
|
|
38
|
+
<div className='singles_item_group_letter text-xl font-semibold border-b border-gray-100 pb-1 mb-2' ><Shimmer width="95%" height="100vh" /></div>
|
|
39
|
+
</div>
|
|
40
|
+
<div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>
|
|
41
|
+
<div className='singles_item_group_letter text-xl font-semibold border-b border-gray-100 pb-1 mb-2' ><Shimmer width="95%" height="100vh" /></div>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</section>
|
|
45
|
+
</div>
|
|
46
|
+
</>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default ShopByBrands;
|
|
@@ -17,7 +17,7 @@ import SportCardsSets from '@riosst100/pwa-marketplace/src/components/SportCards
|
|
|
17
17
|
import NonSportCardsSets from '@riosst100/pwa-marketplace/src/components/NonSportCardsSets/nonSportCardsSets';
|
|
18
18
|
import LegoSets from '@riosst100/pwa-marketplace/src/components/LegoSets/legoSets';
|
|
19
19
|
import TrainsSets from '@riosst100/pwa-marketplace/src/components/TrainsSets/trainsSets';
|
|
20
|
-
import
|
|
20
|
+
import ShopByBrands from '@riosst100/pwa-marketplace/src/components/ShopByBrands/shopByBrands';
|
|
21
21
|
|
|
22
22
|
const MESSAGES = new Map().set(
|
|
23
23
|
'NOT_FOUND',
|
|
@@ -88,7 +88,10 @@ const Category = props => {
|
|
|
88
88
|
categoryId={uid}
|
|
89
89
|
isLoading={loading} />
|
|
90
90
|
) : (
|
|
91
|
-
shopby == "
|
|
91
|
+
shopby == "all_brands" ? <ShopByBrands
|
|
92
|
+
categoryId={uid}
|
|
93
|
+
shopby={shopby}
|
|
94
|
+
isLoading={loading} /> : shopby == "singles" || shopby == "lego_set_name" && parentCategoryUrlKey == "lego" ? <LegoSets
|
|
92
95
|
categoryId={uid}
|
|
93
96
|
shopby={shopby}
|
|
94
97
|
isLoading={loading} /> : shopby && parentCategoryUrlKey == "non-sports-cards" ? <NonSportCardsSets
|
|
@@ -30,7 +30,7 @@ const CustomSubmenuColumn = props => {
|
|
|
30
30
|
);
|
|
31
31
|
|
|
32
32
|
return (
|
|
33
|
-
<li key={index} className={cn(classes.submenuChildItem, 'mt-
|
|
33
|
+
<li key={index} className={cn(classes.submenuChildItem, 'mt-1')}>
|
|
34
34
|
<Link
|
|
35
35
|
className={classes.link}
|
|
36
36
|
data-cy="MegaMenu-CustomSubmenuColumn-link"
|
|
@@ -51,7 +51,7 @@ const ShopByColumn = props => {
|
|
|
51
51
|
;
|
|
52
52
|
|
|
53
53
|
return (
|
|
54
|
-
<li key={index} className={cn(classes.submenuChildItem, 'mt-
|
|
54
|
+
<li key={index} className={cn(classes.submenuChildItem, 'mt-0')}>
|
|
55
55
|
<Link
|
|
56
56
|
{...keyboardProps}
|
|
57
57
|
// className={isActive ? classes.linkActive : classes.link}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
composes: bg-white from global;
|
|
4
4
|
composes: left-0 from global;
|
|
5
5
|
composes: px-3 from global;
|
|
6
|
-
composes: py-
|
|
6
|
+
composes: py-1 from global;
|
|
7
7
|
composes: right-0 from global;
|
|
8
8
|
top: 130px;
|
|
9
9
|
box-shadow: 0 3px rgb(var(--venia-global-color-gray-100));
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
|
|
42
42
|
.submenuItems {
|
|
43
43
|
composes: grid from global;
|
|
44
|
-
composes: grid-cols-6 from global;
|
|
44
|
+
composes: grid-cols-6 pb-2 from global;
|
|
45
45
|
/* composes: justify-between from global; */
|
|
46
46
|
/* composes: ml-auto from global; */
|
|
47
47
|
/* composes: mr-auto from global; */
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
|
|
3
|
+
export const GET_STORE_CONFIG_DATA = gql`
|
|
4
|
+
query getStoreConfigData {
|
|
5
|
+
# eslint-disable-next-line @graphql-eslint/require-id-when-available
|
|
6
|
+
storeConfig {
|
|
7
|
+
store_code
|
|
8
|
+
product_url_suffix
|
|
9
|
+
category_url_suffix
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
export const GET_LEGO_SETS_QUERY = gql`
|
|
15
|
+
query getShopByBrands($categoryUrlKey: String!, $activeTab: String, $filters: ProductAttributeFilterInput!, $shopby: String, $activeFilter: String) {
|
|
16
|
+
shopByBrands(categoryUrlKey: $categoryUrlKey, activeTab: $activeTab, filters: $filters, shopby: $shopby, activeFilter: $activeFilter) {
|
|
17
|
+
group
|
|
18
|
+
sets {
|
|
19
|
+
set_name
|
|
20
|
+
option_id
|
|
21
|
+
release_year
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
export const GET_CATEGORY_CONTENT = gql`
|
|
28
|
+
query getCategoryData($id: String!) {
|
|
29
|
+
categories(filters: { category_uid: { in: [$id] } }) {
|
|
30
|
+
# eslint-disable-next-line @graphql-eslint/require-id-when-available
|
|
31
|
+
items {
|
|
32
|
+
uid
|
|
33
|
+
name
|
|
34
|
+
url_key
|
|
35
|
+
url_path
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
export const GET_FILTER_INPUTS = gql`
|
|
42
|
+
query GetFilterInputsForCategory {
|
|
43
|
+
__type(name: "ProductAttributeFilterInput") {
|
|
44
|
+
inputFields {
|
|
45
|
+
name
|
|
46
|
+
type {
|
|
47
|
+
name
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
export default {
|
|
55
|
+
getStoreConfigData: GET_STORE_CONFIG_DATA,
|
|
56
|
+
getShopByBrandsQuery: GET_LEGO_SETS_QUERY,
|
|
57
|
+
getCategoryContentQuery: GET_CATEGORY_CONTENT,
|
|
58
|
+
getFilterInputsQuery: GET_FILTER_INPUTS,
|
|
59
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
|
|
3
|
+
export const GET_STORE_CONFIG_DATA = gql`
|
|
4
|
+
query getStoreConfigData {
|
|
5
|
+
# eslint-disable-next-line @graphql-eslint/require-id-when-available
|
|
6
|
+
storeConfig {
|
|
7
|
+
store_code
|
|
8
|
+
product_url_suffix
|
|
9
|
+
category_url_suffix
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
export const GET_LEGO_SETS_QUERY = gql`
|
|
15
|
+
query getShopByBrands($categoryUrlKey: String!, $activeTab: String, $filters: ProductAttributeFilterInput!, $shopby: String, $activeFilter: String) {
|
|
16
|
+
shopByBrands(categoryUrlKey: $categoryUrlKey, activeTab: $activeTab, filters: $filters, shopby: $shopby, activeFilter: $activeFilter) {
|
|
17
|
+
group
|
|
18
|
+
sets {
|
|
19
|
+
set_name
|
|
20
|
+
option_id
|
|
21
|
+
release_year
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
export const GET_CATEGORY_CONTENT = gql`
|
|
28
|
+
query getCategoryData($id: String!) {
|
|
29
|
+
categories(filters: { category_uid: { in: [$id] } }) {
|
|
30
|
+
# eslint-disable-next-line @graphql-eslint/require-id-when-available
|
|
31
|
+
items {
|
|
32
|
+
uid
|
|
33
|
+
name
|
|
34
|
+
url_key
|
|
35
|
+
url_path
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
export const GET_FILTER_INPUTS = gql`
|
|
42
|
+
query GetFilterInputsForCategory {
|
|
43
|
+
__type(name: "ProductAttributeFilterInput") {
|
|
44
|
+
inputFields {
|
|
45
|
+
name
|
|
46
|
+
type {
|
|
47
|
+
name
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
export default {
|
|
55
|
+
getStoreConfigData: GET_STORE_CONFIG_DATA,
|
|
56
|
+
getShopByBrandsQuery: GET_LEGO_SETS_QUERY,
|
|
57
|
+
getCategoryContentQuery: GET_CATEGORY_CONTENT,
|
|
58
|
+
getFilterInputsQuery: GET_FILTER_INPUTS,
|
|
59
|
+
};
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { useQuery, useLazyQuery } from '@apollo/client';
|
|
2
|
+
import { useEffect, useMemo } from 'react';
|
|
3
|
+
import { useLocation } from 'react-router-dom';
|
|
4
|
+
import { useAppContext } from '@magento/peregrine/lib/context/app';
|
|
5
|
+
|
|
6
|
+
import mergeOperations from '@magento/peregrine/lib/util/shallowMerge';
|
|
7
|
+
import DEFAULT_OPERATIONS from './shopByBrands.gql';
|
|
8
|
+
import { getFilterInput, getFiltersFromSearch } from '@magento/peregrine/lib/talons/FilterModal/helpers';
|
|
9
|
+
|
|
10
|
+
export const useShopByBrands = props => {
|
|
11
|
+
|
|
12
|
+
const { searchQuery, setActive, currentSort, shopby, setType, categoryId, activeTab, activeFilter } = props
|
|
13
|
+
|
|
14
|
+
const { value: sortby } = currentSort
|
|
15
|
+
|
|
16
|
+
const operations = mergeOperations(DEFAULT_OPERATIONS, null);
|
|
17
|
+
const { getStoreConfigData, getShopByBrandsQuery, getCategoryContentQuery, getFilterInputsQuery } = operations;
|
|
18
|
+
const { pathname, search } = useLocation();
|
|
19
|
+
const [runQuery, queryResponse] = useLazyQuery(getShopByBrandsQuery, {
|
|
20
|
+
fetchPolicy: 'cache-and-network',
|
|
21
|
+
nextFetchPolicy: 'cache-first'
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const pathnameArr = pathname.split('/');
|
|
25
|
+
|
|
26
|
+
const categoryUrlKey = pathnameArr[pathnameArr.length - 1].replace('.html','');
|
|
27
|
+
const parentCategoryUrlKey = pathnameArr[pathnameArr.length - 2].replace('.html','');
|
|
28
|
+
const productType = shopby;
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
// const { error, loading, data } = useQuery(getShopByBrandsQuery, {
|
|
33
|
+
// fetchPolicy: 'cache-and-network',
|
|
34
|
+
// nextFetchPolicy: 'cache-first',
|
|
35
|
+
// skip: !storeConfigData,
|
|
36
|
+
// variables: {
|
|
37
|
+
// categoryUrlKey: categoryUrlKey,
|
|
38
|
+
// setType: setType
|
|
39
|
+
// }
|
|
40
|
+
// });
|
|
41
|
+
const { data: introspectionData } = useQuery(getFilterInputsQuery);
|
|
42
|
+
|
|
43
|
+
const filterTypeMap = useMemo(() => {
|
|
44
|
+
const typeMap = new Map();
|
|
45
|
+
if (introspectionData) {
|
|
46
|
+
introspectionData.__type.inputFields.forEach(({ name, type }) => {
|
|
47
|
+
typeMap.set(name, type.name);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return typeMap;
|
|
51
|
+
}, [introspectionData]);
|
|
52
|
+
const filters = getFiltersFromSearch(search);
|
|
53
|
+
|
|
54
|
+
// Construct the filter arg object.
|
|
55
|
+
const newFilters = {};
|
|
56
|
+
filters.forEach((values, key) => {
|
|
57
|
+
newFilters[key] = getFilterInput(values, filterTypeMap.get(key));
|
|
58
|
+
|
|
59
|
+
if (key == "sc_baseball_release") {
|
|
60
|
+
for(let item of values) {
|
|
61
|
+
if(item) {
|
|
62
|
+
// console.log(item.split(',')[0])
|
|
63
|
+
const data = search.split('&');
|
|
64
|
+
data.pop();
|
|
65
|
+
activeFilters.push(
|
|
66
|
+
{
|
|
67
|
+
'label': item.split(',')[0],
|
|
68
|
+
'path': data
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
// console.log("MASUK")
|
|
78
|
+
|
|
79
|
+
// if (queryResponse.data) {
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
// Use the category uid for the current category page regardless of the
|
|
84
|
+
// applied filters. Follow-up in PWA-404.
|
|
85
|
+
// newFilters['category_uid'] = { eq: id };
|
|
86
|
+
|
|
87
|
+
runQuery({
|
|
88
|
+
variables: {
|
|
89
|
+
filters: newFilters,
|
|
90
|
+
categoryUrlKey: categoryUrlKey,
|
|
91
|
+
activeTab: activeTab,
|
|
92
|
+
shopby: shopby,
|
|
93
|
+
activeFilter: activeFilter
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
// }
|
|
97
|
+
}, [
|
|
98
|
+
runQuery,
|
|
99
|
+
activeTab,
|
|
100
|
+
activeFilter
|
|
101
|
+
// queryResponse
|
|
102
|
+
// filterTypeMap,
|
|
103
|
+
// search,
|
|
104
|
+
// newFilters,
|
|
105
|
+
// shopby,
|
|
106
|
+
// categoryUrlKey
|
|
107
|
+
]);
|
|
108
|
+
|
|
109
|
+
const { data: storeConfigData } = useQuery(getStoreConfigData, {
|
|
110
|
+
fetchPolicy: 'cache-and-network',
|
|
111
|
+
nextFetchPolicy: 'cache-first'
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
const categoryUrlSuffix = storeConfigData?.storeConfig?.category_url_suffix;
|
|
115
|
+
|
|
116
|
+
// { data: queryResponse, error, loading }
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
// console.log(data)
|
|
121
|
+
|
|
122
|
+
// const isBackgroundLoading = !!data && loading;
|
|
123
|
+
|
|
124
|
+
const availableLeagues = [];
|
|
125
|
+
|
|
126
|
+
// console.log(queryResponse.data)
|
|
127
|
+
|
|
128
|
+
const shopByBrands = useMemo(() => {
|
|
129
|
+
if (!queryResponse) {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// console.log(data)
|
|
134
|
+
|
|
135
|
+
const shopByBrands = queryResponse?.data?.shopByBrands;
|
|
136
|
+
if (!shopByBrands) {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return shopByBrands.slice().sort((a, b) =>a.group.toLowerCase().localeCompare(b.group.toLowerCase()));
|
|
141
|
+
}, [queryResponse]);
|
|
142
|
+
|
|
143
|
+
const availableGroups = shopByBrands && shopByBrands.length ? shopByBrands.map(({ group }) => group) : [];
|
|
144
|
+
|
|
145
|
+
// const availableLeagues = shopByBrands && shopByBrands.length ? shopByBrands.map(({ sets }) => shopByBrands.map(({ sc_league }) => sc_league)) : [];
|
|
146
|
+
// console.log(availableLeagues)
|
|
147
|
+
// sc_league
|
|
148
|
+
|
|
149
|
+
const filteredShopByBrands = useMemo(() => {
|
|
150
|
+
if (!shopByBrands) {
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const filteredSets = [];
|
|
155
|
+
|
|
156
|
+
if (searchQuery) {
|
|
157
|
+
|
|
158
|
+
// useEffect(() => {
|
|
159
|
+
// setActive('all')
|
|
160
|
+
// }, [active]);
|
|
161
|
+
|
|
162
|
+
shopByBrands.map(({ group, sets }, index) => {
|
|
163
|
+
const newSets = sets.filter(function(set) {
|
|
164
|
+
return set.set_name.search(new RegExp(searchQuery, "i")) != -1 || group.search(new RegExp(searchQuery, "i")) != -1;
|
|
165
|
+
// return set.set_name.includes(searchQuery);
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
if (newSets && newSets.length) {
|
|
169
|
+
filteredSets.push({
|
|
170
|
+
'group': group,
|
|
171
|
+
'sets': newSets
|
|
172
|
+
})
|
|
173
|
+
}
|
|
174
|
+
})
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return searchQuery ? filteredSets : shopByBrands;
|
|
178
|
+
}, [shopByBrands, searchQuery]);
|
|
179
|
+
|
|
180
|
+
// useEffect(() => {
|
|
181
|
+
// setPageLoading(isBackgroundLoading);
|
|
182
|
+
// }, [isBackgroundLoading, setPageLoading]);
|
|
183
|
+
|
|
184
|
+
const { data: categoryData, loading: categoryLoading } = useQuery(
|
|
185
|
+
getCategoryContentQuery,
|
|
186
|
+
{
|
|
187
|
+
fetchPolicy: 'cache-and-network',
|
|
188
|
+
nextFetchPolicy: 'cache-first',
|
|
189
|
+
skip: !categoryId,
|
|
190
|
+
variables: {
|
|
191
|
+
id: categoryId
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
);
|
|
195
|
+
|
|
196
|
+
const category =
|
|
197
|
+
categoryData && categoryData.categories.items.length
|
|
198
|
+
? categoryData.categories.items[0]
|
|
199
|
+
: null;
|
|
200
|
+
|
|
201
|
+
const error = queryResponse?.error;
|
|
202
|
+
const loading = queryResponse?.loading;
|
|
203
|
+
|
|
204
|
+
// console.log(shopByBrands)
|
|
205
|
+
|
|
206
|
+
return {
|
|
207
|
+
error,
|
|
208
|
+
loading,
|
|
209
|
+
shopByBrands,
|
|
210
|
+
filteredShopByBrands,
|
|
211
|
+
categoryUrlSuffix,
|
|
212
|
+
categoryUrlKey,
|
|
213
|
+
productType,
|
|
214
|
+
availableGroups,
|
|
215
|
+
category,
|
|
216
|
+
// availableLeagues
|
|
217
|
+
};
|
|
218
|
+
};
|