@riosst100/pwa-marketplace 2.9.0 → 2.9.2
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/FilterTop/FilterBlockList/filterTopItem.js +1 -1
- package/src/components/{ShopBy/shopBy.js → ShopBy copy/shopBy.js } +1 -1
- package/src/components/ShowMore/index.js +2 -0
- package/src/components/ShowMore/shopBy.js +454 -0
- package/src/components/ShowMore/shopBy.shimmer.js +50 -0
- package/src/components/ShowMore/showMore.js +428 -0
- package/src/components/ShowMore/showMore.module.css +76 -0
- package/src/components/ShowMore/showMore.shimmer.js +50 -0
- package/src/components/SubCategory/subCategory.js +8 -2
- package/src/overwrites/peregrine/lib/talons/RootComponents/Category/categoryContent.gql.js +5 -0
- package/src/overwrites/peregrine/lib/talons/RootComponents/Category/useCategoryContent.js +53 -2
- package/src/overwrites/venia-ui/lib/RootComponents/Category/category.js +8 -1
- package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.js +1 -7
- package/src/talons/ShopBy/useShopBy.js +2 -4
- package/src/talons/ShopBy copy/useShopBy.js +280 -0
- package/src/talons/ShowMore/showMore.gql.js +98 -0
- package/src/talons/ShowMore/useShopBy.js +280 -0
- package/src/talons/ShowMore/useShowMore.js +273 -0
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
import React, { Fragment, Suspense, useMemo, useRef, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
4
|
+
import Breadcrumbs from '@magento/venia-ui/lib/components/Breadcrumbs';
|
|
5
|
+
import cn from 'classnames';
|
|
6
|
+
import { useLocation } from 'react-router-dom';
|
|
7
|
+
import { getFiltersFromSearch } from '@magento/peregrine/lib/talons/FilterModal/helpers';
|
|
8
|
+
|
|
9
|
+
import ErrorView from '@magento/venia-ui/lib/components/ErrorView';
|
|
10
|
+
import { StoreTitle, Meta } from '@magento/venia-ui/lib/components/Head';
|
|
11
|
+
import { Link } from 'react-router-dom';
|
|
12
|
+
import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
|
|
13
|
+
import defaultClasses from '@riosst100/pwa-marketplace/src/components/ShopBy/shopBy.module.css';
|
|
14
|
+
import Divider from '@riosst100/pwa-marketplace/src/components/Divider';
|
|
15
|
+
import { ShowMoreShimmer } from '@riosst100/pwa-marketplace/src/components/ShowMore';
|
|
16
|
+
import CustomSortBy from '@riosst100/pwa-marketplace/src/components/CustomSortBy';
|
|
17
|
+
import ArraySearchInput from '@riosst100/pwa-marketplace/src/components/ArraySearchInput';
|
|
18
|
+
import { useCustomSort } from '@riosst100/pwa-marketplace/src/hooks/useCustomSort';
|
|
19
|
+
import { useShowMore } from '@riosst100/pwa-marketplace/src/talons/ShowMore/useShowMore';
|
|
20
|
+
|
|
21
|
+
const FilterModal = React.lazy(() => import('@magento/venia-ui/lib/components/FilterModal'));
|
|
22
|
+
const FilterSidebar = React.lazy(() =>
|
|
23
|
+
import('@magento/venia-ui/lib/components/FilterSidebar')
|
|
24
|
+
);
|
|
25
|
+
const FilterTop = React.lazy(() =>
|
|
26
|
+
import('@riosst100/pwa-marketplace/src/components/FilterTop')
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const ShowMore = props => {
|
|
30
|
+
const {
|
|
31
|
+
categoryId,
|
|
32
|
+
shopby
|
|
33
|
+
// data,
|
|
34
|
+
// isLoading,
|
|
35
|
+
// pageControl,
|
|
36
|
+
// sortProps,
|
|
37
|
+
// pageSize
|
|
38
|
+
} = props || {};
|
|
39
|
+
// const [currentSort] = sortProps;
|
|
40
|
+
|
|
41
|
+
// const talonProps = useCategoryContent({
|
|
42
|
+
// categoryId,
|
|
43
|
+
// data,
|
|
44
|
+
// pageSize
|
|
45
|
+
// });
|
|
46
|
+
|
|
47
|
+
// const {
|
|
48
|
+
// availableSortMethods,
|
|
49
|
+
// categoryName,
|
|
50
|
+
// categoryDescription,
|
|
51
|
+
// filters,
|
|
52
|
+
// items,
|
|
53
|
+
// children,
|
|
54
|
+
// parent,
|
|
55
|
+
// totalCount,
|
|
56
|
+
// totalPagesFromData,
|
|
57
|
+
// attributesBlock,
|
|
58
|
+
// category,
|
|
59
|
+
// } = talonProps;
|
|
60
|
+
|
|
61
|
+
const [active, setActive] = useState('all')
|
|
62
|
+
const [activeTab, setActiveTab] = useState('all');
|
|
63
|
+
const [activeFilter, setActiveFilter] = useState('');
|
|
64
|
+
const [searchQuery, setSearchQuery] = useState('');
|
|
65
|
+
|
|
66
|
+
const { search } = useLocation();
|
|
67
|
+
|
|
68
|
+
const sortProps = useCustomSort({ sortFromSearch: false, defaultSort: {
|
|
69
|
+
sortText: 'All (A-Z)',
|
|
70
|
+
value: 'all'
|
|
71
|
+
}});
|
|
72
|
+
|
|
73
|
+
const [currentSort] = sortProps;
|
|
74
|
+
|
|
75
|
+
// const [sortBy, setSortBy] = useState({
|
|
76
|
+
// sortText: 'All (A-Z)',
|
|
77
|
+
// value: 'all'
|
|
78
|
+
// });
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
const classes = useStyle(defaultClasses);
|
|
82
|
+
|
|
83
|
+
const talonProps = useShowMore({ activeFilter, searchQuery, active, setActive, currentSort, categoryId, shopby });
|
|
84
|
+
|
|
85
|
+
const { error, loading, dataResult, categoryUrlSuffix, categoryUrlKey, productType, filteredAvailableGroups, availableGroups, attributeData, alpha, category, pageInfo } = talonProps;
|
|
86
|
+
|
|
87
|
+
if (loading) {
|
|
88
|
+
return <ShowMoreShimmer />;
|
|
89
|
+
} else if (error) {
|
|
90
|
+
return <ErrorView />;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const newAvailableGroups = searchQuery ? filteredAvailableGroups : availableGroups;
|
|
94
|
+
|
|
95
|
+
const splitToNChunks = (array, n) => {
|
|
96
|
+
let result = [];
|
|
97
|
+
for (let i = n; i > 0; i--) {
|
|
98
|
+
result.push(array.splice(0, Math.ceil(array.length / i)));
|
|
99
|
+
}
|
|
100
|
+
return result;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
let filterSearchArr = search ? search.split('&') : [];
|
|
104
|
+
filterSearchArr = filterSearchArr.filter(function(data) {
|
|
105
|
+
return !data.includes('show_more');
|
|
106
|
+
})
|
|
107
|
+
filterSearchArr = filterSearchArr.filter(function(data) {
|
|
108
|
+
return !data.includes('trains_roadname_country');
|
|
109
|
+
})
|
|
110
|
+
let filterSearch = filterSearchArr.join('&')
|
|
111
|
+
|
|
112
|
+
if (!filterSearch.includes('?')) {
|
|
113
|
+
filterSearch = '?'+filterSearch;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
let additionalFilter = '';
|
|
117
|
+
if (shopby == 'sc_brands') {
|
|
118
|
+
additionalFilter = '&shopby=release&active_tab=brand';
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const setRelases = newAvailableGroups && newAvailableGroups.length && newAvailableGroups.map((group, index) => {
|
|
122
|
+
const optionsResult = [];
|
|
123
|
+
|
|
124
|
+
if (active === 'all' || active === group) {
|
|
125
|
+
dataResult[group] && dataResult[group].length && dataResult[group].map((option, index) => {
|
|
126
|
+
const { count, label, value } = option;
|
|
127
|
+
|
|
128
|
+
const filter = attributeData.attribute_code + '[filter]=' + label + ',' + value;
|
|
129
|
+
const params = filterSearch ? filterSearch + '&' + filter + additionalFilter : '?' + filter + additionalFilter;
|
|
130
|
+
|
|
131
|
+
const categoryUrl = resourceUrl(
|
|
132
|
+
`/${category?.url_path}${categoryUrlSuffix || ''}${params}`
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
optionsResult.push(<li key={index} className='list-none'>
|
|
136
|
+
<Link to={categoryUrl} className="hover_bg-darkblue-900 hover_text-white w-full block text-[14px] py-[2px] px-0">
|
|
137
|
+
{label}
|
|
138
|
+
{/* <span className='text-[12px]'>({count})</span> */}
|
|
139
|
+
</Link>
|
|
140
|
+
</li>)
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
let optionsResultSplitted = [];
|
|
144
|
+
if (newAvailableGroups.length == 1 || active == group) {
|
|
145
|
+
optionsResultSplitted = splitToNChunks(optionsResult, 3);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const all = active == "all" ? (
|
|
149
|
+
newAvailableGroups.length == 1 ? (
|
|
150
|
+
optionsResultSplitted && optionsResultSplitted.length && optionsResultSplitted.map((data, index) => (
|
|
151
|
+
<div key={index} className={cn('singles_group-wrapper mb-4 px-2 inline-block', classes.singlesGroupWrapper)}>
|
|
152
|
+
{searchQuery && availableGroups.length > 1 && (index == 0 ? <div className='singles_item_group_letter text-xl font-medium border-b border-gray-100 pb-1 mb-2'>{group}</div> :
|
|
153
|
+
<div className='singles_item_group_letter text-xl font-medium pb-1 mb-2' style={{"marginTop":"35px"}}></div>)}
|
|
154
|
+
<div className={cn('singles_item-list flex flex-col')}>{data}</div>
|
|
155
|
+
</div>
|
|
156
|
+
)
|
|
157
|
+
)
|
|
158
|
+
) : (
|
|
159
|
+
<div className={cn('singles_group-wrapper mb-4 px-2 inline-block', classes.singlesGroupWrapper)}>
|
|
160
|
+
<div className='singles_item_group_letter text-xl font-medium border-b border-gray-100 pb-1 mb-2' >
|
|
161
|
+
{group}
|
|
162
|
+
</div>
|
|
163
|
+
<div className={cn('singles_item-list flex flex-col')}>{optionsResult}</div>
|
|
164
|
+
</div>
|
|
165
|
+
)
|
|
166
|
+
) : '';
|
|
167
|
+
|
|
168
|
+
return (
|
|
169
|
+
<>
|
|
170
|
+
{all}
|
|
171
|
+
{active == group ? optionsResultSplitted && optionsResultSplitted.length && optionsResultSplitted.map((optionsResult, index) =>
|
|
172
|
+
<div key={index} className={cn('singles_group-wrapper mb-4 px-2 inline-block', classes.singlesGroupWrapper)}>
|
|
173
|
+
{index == 0 ? <div className='singles_item_group_letter text-xl font-medium border-b border-gray-100 pb-1 mb-2'>{group}</div> :
|
|
174
|
+
<div className='singles_item_group_letter text-xl font-medium pb-1 mb-2' style={{"marginTop":"35px"}}></div>}
|
|
175
|
+
<div className={cn('singles_item-list flex flex-col')}>{optionsResult}</div>
|
|
176
|
+
</div>
|
|
177
|
+
)
|
|
178
|
+
: ''}
|
|
179
|
+
</>
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return null;
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
const handleActive = (val) => {
|
|
187
|
+
setActive(val);
|
|
188
|
+
setSearchQuery('')
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// let availableSortBy = [
|
|
192
|
+
// {
|
|
193
|
+
// 'label': 'All (A-Z)',
|
|
194
|
+
// 'value': 'all'
|
|
195
|
+
// }
|
|
196
|
+
// ];
|
|
197
|
+
|
|
198
|
+
let availableSortBy = [
|
|
199
|
+
{
|
|
200
|
+
'label': 'All (A-Z)',
|
|
201
|
+
'value': 'all'
|
|
202
|
+
}
|
|
203
|
+
];
|
|
204
|
+
|
|
205
|
+
// const title = attributeData ? (attributeData.attribute_code == "sc_baseball_parallel" ? "Parallel Sets" : (attributeData.attribute_code == "sc_baseball_inserts" ? "Insert Sets" : attributeData.label)) : "Shop By"
|
|
206
|
+
const title = pageInfo ? pageInfo.label : '';
|
|
207
|
+
|
|
208
|
+
let availableFilterOption = [];
|
|
209
|
+
|
|
210
|
+
if (shopby == "vehicles_make" || shopby == "vehicles_brands") {
|
|
211
|
+
availableFilterOption = [
|
|
212
|
+
{
|
|
213
|
+
'code': 'vehicles_diecast',
|
|
214
|
+
'value': 'Cars',
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
'code': 'vehicles_diecast',
|
|
218
|
+
'value': 'Formula Racing'
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
'code': 'vehicles_diecast',
|
|
222
|
+
'value': 'Motorsport'
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
'code': 'vehicles_diecast',
|
|
226
|
+
'value': 'Aircraft'
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
'code': 'vehicles_diecast',
|
|
230
|
+
'value': 'Bikes'
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
'code': 'vehicles_diecast',
|
|
234
|
+
'value': 'Military'
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
'code': 'vehicles_diecast',
|
|
238
|
+
'value': 'Transport'
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
'code': 'vehicles_diecast',
|
|
242
|
+
'value': 'Emergency Services'
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
'code': 'vehicles_diecast',
|
|
246
|
+
'value': 'Heavy Machinery'
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
'code': 'vehicles_diecast',
|
|
250
|
+
'value': 'TV/Movies'
|
|
251
|
+
}
|
|
252
|
+
];
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
if (shopby == "brands" || shopby == "product_line") {
|
|
256
|
+
if (category && category?.url_path.includes('anime-figures')) {
|
|
257
|
+
availableFilterOption = [
|
|
258
|
+
{
|
|
259
|
+
'code': 'anime_figures',
|
|
260
|
+
'value': 'Complete Figures',
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
'code': 'anime_figures',
|
|
264
|
+
'value': 'Articulated Figures'
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
'code': 'anime_figures',
|
|
268
|
+
'value': 'Statues'
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
'code': 'anime_figures',
|
|
272
|
+
'value': 'Mini-Figures'
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
'code': 'anime_figures',
|
|
276
|
+
'value': 'Capsule Toys (Gashapon)'
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
'code': 'anime_figures',
|
|
280
|
+
'value': 'Candy Toys'
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
'code': 'anime_figures',
|
|
284
|
+
'value': 'R18+'
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
'code': 'anime_figures',
|
|
288
|
+
'value': 'Model Kits'
|
|
289
|
+
}
|
|
290
|
+
];
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
const handleActiveTab = (val) => {
|
|
295
|
+
setActiveTab(val);
|
|
296
|
+
setActive('all');
|
|
297
|
+
setActiveFilter('');
|
|
298
|
+
|
|
299
|
+
setSearchQuery('')
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
const handleActiveFilter = (val) => {
|
|
303
|
+
setActiveFilter(val);
|
|
304
|
+
|
|
305
|
+
setActive('all');
|
|
306
|
+
|
|
307
|
+
setSearchQuery('')
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
const activeFilters = [];
|
|
311
|
+
|
|
312
|
+
const allActiveFilters = getFiltersFromSearch(search);
|
|
313
|
+
|
|
314
|
+
if (allActiveFilters && allActiveFilters.size > 0) {
|
|
315
|
+
allActiveFilters.forEach((value, key) => {
|
|
316
|
+
value.forEach((value) => {
|
|
317
|
+
const filterArr = value.split(',');
|
|
318
|
+
|
|
319
|
+
const label = filterArr[0];
|
|
320
|
+
const optionId = filterArr[1];
|
|
321
|
+
if (label == "Singles") {
|
|
322
|
+
isSingles = true;
|
|
323
|
+
}
|
|
324
|
+
if (key == "bricks_categories" || key == "sc_sports_categories" || key == "card_game" || key == "product_line" && urlKey == "brands" || key == "product_line" && urlKey == "franchise" || key == "franchise" && urlKey == "brands" || key == "franchise" && urlKey == "franchise" || key == "brands" && urlKey == "franchise" || key == "brands" && urlKey == "brands") {
|
|
325
|
+
activeFilters.push(
|
|
326
|
+
{
|
|
327
|
+
'label': label,
|
|
328
|
+
'code': key,
|
|
329
|
+
'option_id': optionId
|
|
330
|
+
}
|
|
331
|
+
)
|
|
332
|
+
}
|
|
333
|
+
})
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
return (
|
|
338
|
+
<Fragment>
|
|
339
|
+
<StoreTitle>{title}</StoreTitle>
|
|
340
|
+
<Breadcrumbs categoryId={categoryId} customPage={title} currentFilter={activeFilters} />
|
|
341
|
+
{category?.url_path.includes('model-railway') && <FilterTop shopby={shopby} filters={[]} category={category} children={[]} allowedFilters={category ? category.allowed_filters : []} />}
|
|
342
|
+
{/* <ShopByFilters handleActiveFilter={handleActiveFilter} activeFilter={activeFilter} category={category} /> */}
|
|
343
|
+
{availableFilterOption.length ?
|
|
344
|
+
<ul className={classes.nav}>
|
|
345
|
+
{availableFilterOption.map((filter, index) => (
|
|
346
|
+
<li className={classes.nav_item}>
|
|
347
|
+
<button
|
|
348
|
+
onClick={() => {
|
|
349
|
+
handleActiveFilter(filter.code + '|' + filter.value)
|
|
350
|
+
}}
|
|
351
|
+
>
|
|
352
|
+
{activeFilter == filter.code + '|' + filter.value ? <b>{filter.value}</b> : filter.value}
|
|
353
|
+
</button>
|
|
354
|
+
</li>
|
|
355
|
+
))}
|
|
356
|
+
<li className={classes.nav_item}>
|
|
357
|
+
<button
|
|
358
|
+
onClick={() => {
|
|
359
|
+
handleActiveFilter('')
|
|
360
|
+
}}
|
|
361
|
+
>
|
|
362
|
+
{activeFilter == '' ? <b>All</b> : 'All'}
|
|
363
|
+
</button>
|
|
364
|
+
</li>
|
|
365
|
+
</ul>
|
|
366
|
+
: ''}
|
|
367
|
+
<h1 className='mx-auto relative block text-xl font-bold text-center pt-10 pb-4'>
|
|
368
|
+
{title}
|
|
369
|
+
</h1>
|
|
370
|
+
<div className='border border-gray-100 px-6'>
|
|
371
|
+
{dataResult ? (
|
|
372
|
+
<div
|
|
373
|
+
className={classes.toolbar}
|
|
374
|
+
>
|
|
375
|
+
<div style={{"width":"35%"}}><ArraySearchInput active={active} searchQuery={searchQuery} placeholder="Search sets..." isOpen={true} setSearchQuery={setSearchQuery} /></div>
|
|
376
|
+
<CustomSortBy sortProps={sortProps} availableSortMethods={availableSortBy} />
|
|
377
|
+
</div>
|
|
378
|
+
) : ''}
|
|
379
|
+
{shopby != "vehicles_year" && shopby != "trains_gauge" && shopby != "vehicles_scale" && shopby != "lego_theme" && shopby != "lego_subtheme" && shopby != "lego_interest" && shopby != "lego_age_level" && productType != "expansion-sets" ? (
|
|
380
|
+
<>
|
|
381
|
+
<section className='single_list-indexing-container relative m-auto pt-5'>
|
|
382
|
+
<ul className='flex gap-2 justify-center flex-wrap'>
|
|
383
|
+
<li>
|
|
384
|
+
<button
|
|
385
|
+
className={cn(
|
|
386
|
+
'rounded-md border border-solid border-gray-100 p-2 min-w-[28px]',
|
|
387
|
+
'leading-4 font-medium text-base hover_bg-gray-50'
|
|
388
|
+
)}
|
|
389
|
+
onClick={() => {
|
|
390
|
+
handleActive('all')
|
|
391
|
+
}}
|
|
392
|
+
>
|
|
393
|
+
{active == 'all' ? <b>All</b> : 'All'}
|
|
394
|
+
</button>
|
|
395
|
+
</li>
|
|
396
|
+
{alpha && alpha.length && alpha.map((letter, index) => (
|
|
397
|
+
<li key={index}>
|
|
398
|
+
<button
|
|
399
|
+
className={cn(
|
|
400
|
+
'rounded-md border border-solid border-gray-100 p-2 min-w-[28px]',
|
|
401
|
+
'leading-4 font-medium text-base ',
|
|
402
|
+
availableGroups.includes(letter) > 0 ? 'hover_bg-gray-50' : 'bg-gray-100 text-gray-400',
|
|
403
|
+
)}
|
|
404
|
+
onClick={() => {
|
|
405
|
+
handleActive(letter)
|
|
406
|
+
}}
|
|
407
|
+
disabled={availableGroups.includes(letter) > 0 ? false : true}
|
|
408
|
+
>
|
|
409
|
+
{active == letter ? <b>{letter}</b> : letter}
|
|
410
|
+
</button>
|
|
411
|
+
</li>
|
|
412
|
+
))}
|
|
413
|
+
</ul>
|
|
414
|
+
</section>
|
|
415
|
+
</>
|
|
416
|
+
) : ''}
|
|
417
|
+
<Divider className="mb-5 px-4 mt-5" />
|
|
418
|
+
<section className='singles-container'>
|
|
419
|
+
<div className={cn('singles-wrapper block -mx-4', classes.singlesWrapper)}>
|
|
420
|
+
{dataResult && Object.keys(dataResult).length != 0 ? setRelases : (searchQuery ? <div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>No data found for <b>{searchQuery}</b> search query.</div> : <div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>No data found.</div>)}
|
|
421
|
+
</div>
|
|
422
|
+
</section>
|
|
423
|
+
</div>
|
|
424
|
+
</Fragment>
|
|
425
|
+
);
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
export default ShowMore;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
.toolbar {
|
|
2
|
+
composes: relative from global;
|
|
3
|
+
composes: ml-2xs from global;
|
|
4
|
+
display: flex;
|
|
5
|
+
justify-content: space-between;
|
|
6
|
+
margin-top: 20px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.nav {
|
|
10
|
+
composes: flex from global;
|
|
11
|
+
composes: flex-wrap from global;
|
|
12
|
+
margin: 50px 0 30px 0;
|
|
13
|
+
composes: gap-[10px] from global;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.nav_item {
|
|
17
|
+
composes: px-4 from global;
|
|
18
|
+
composes: py-2 from global;
|
|
19
|
+
composes: transition-colors from global;
|
|
20
|
+
composes: duration-150 from global;
|
|
21
|
+
composes: border from global;
|
|
22
|
+
composes: border-solid from global;
|
|
23
|
+
composes: leading-normal from global;
|
|
24
|
+
composes: text-base from global;
|
|
25
|
+
composes: text-colorDefault from global;
|
|
26
|
+
composes: bg-white from global;
|
|
27
|
+
composes: border-gray-100 from global;
|
|
28
|
+
border-radius: 5px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.tabs {
|
|
32
|
+
composes: flex from global;
|
|
33
|
+
composes: flex-wrap from global;
|
|
34
|
+
composes: mt-3 from global;
|
|
35
|
+
composes: gap-[10px] 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 '@riosst100/pwa-marketplace/src/components/ShowMore/showMore';
|
|
7
|
+
import cn from 'classnames';
|
|
8
|
+
import Divider from '@riosst100/pwa-marketplace/src/components/Divider';
|
|
9
|
+
|
|
10
|
+
const ShowMoreShimmer = 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-medium 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-medium 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-medium 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-medium 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-medium 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-medium 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 ShowMoreShimmer;
|
|
@@ -22,14 +22,20 @@ const SubCategory = props => {
|
|
|
22
22
|
|
|
23
23
|
normalizedData && normalizedData.length && normalizedData.map(({ text, path }, index) => {
|
|
24
24
|
if (index < maxSubCategory) {
|
|
25
|
-
|
|
25
|
+
const isActive = index == 0 ? true : false;
|
|
26
|
+
|
|
27
|
+
const item = isActive ? (
|
|
28
|
+
<span className={classes.item}><b>{text}</b></span>
|
|
29
|
+
) : (
|
|
26
30
|
<Link
|
|
27
31
|
key={index}
|
|
28
32
|
to={resourceUrl(path)}
|
|
29
33
|
>
|
|
30
34
|
<li className={classes.item}>{text}</li>
|
|
31
35
|
</Link>
|
|
32
|
-
)
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
subCategory.push(item)
|
|
33
39
|
}
|
|
34
40
|
});
|
|
35
41
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useCallback, useMemo, useRef, useState, useEffect } from 'react';
|
|
2
2
|
import { useLazyQuery, useQuery } from '@apollo/client';
|
|
3
3
|
|
|
4
4
|
import mergeOperations from '@magento/peregrine/lib/util/shallowMerge';
|
|
5
5
|
import { useEventingContext } from '@magento/peregrine/lib/context/eventing';
|
|
6
|
-
import { useLocation } from 'react-router-dom';
|
|
6
|
+
import { useLocation, useHistory } from 'react-router-dom';
|
|
7
7
|
import DEFAULT_OPERATIONS from './categoryContent.gql';
|
|
8
8
|
import {
|
|
9
9
|
getFiltersFromSearch,
|
|
@@ -177,6 +177,57 @@ export const useCategoryContent = props => {
|
|
|
177
177
|
|
|
178
178
|
const filters = [];
|
|
179
179
|
|
|
180
|
+
const history = useHistory();
|
|
181
|
+
const location = useLocation();
|
|
182
|
+
|
|
183
|
+
const setQueryParam = ({ history, location, parameter, replace, value }) => {
|
|
184
|
+
const { search } = location;
|
|
185
|
+
const queryParams = new URLSearchParams(search);
|
|
186
|
+
|
|
187
|
+
queryParams.set(parameter, value);
|
|
188
|
+
const destination = { search: queryParams.toString() };
|
|
189
|
+
|
|
190
|
+
if (replace) {
|
|
191
|
+
history.replace(destination);
|
|
192
|
+
} else {
|
|
193
|
+
history.push(destination);
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
const setDefaultSubcategoryAndTopFilter = useCallback(
|
|
198
|
+
(value, searchParam, replace = false) => {
|
|
199
|
+
// Update the query parameter.
|
|
200
|
+
setQueryParam({
|
|
201
|
+
history,
|
|
202
|
+
location,
|
|
203
|
+
parameter: searchParam,
|
|
204
|
+
replace,
|
|
205
|
+
value: value
|
|
206
|
+
});
|
|
207
|
+
},
|
|
208
|
+
[history, location]
|
|
209
|
+
);
|
|
210
|
+
|
|
211
|
+
useEffect(() => {
|
|
212
|
+
const { search } = location;
|
|
213
|
+
|
|
214
|
+
if (category && category.default_top_filter) {
|
|
215
|
+
const defaultTopFilter = category.default_top_filter;
|
|
216
|
+
|
|
217
|
+
const attrCode = defaultTopFilter.attribute_code;
|
|
218
|
+
const label = defaultTopFilter.label;
|
|
219
|
+
const value = defaultTopFilter.value;
|
|
220
|
+
|
|
221
|
+
if (!search.includes(attrCode)) {
|
|
222
|
+
setDefaultSubcategoryAndTopFilter(
|
|
223
|
+
label + ',' + value,
|
|
224
|
+
attrCode + '[filter]',
|
|
225
|
+
true
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}, [category, location, setDefaultSubcategoryAndTopFilter]);
|
|
230
|
+
|
|
180
231
|
// console.log('rawFilters')
|
|
181
232
|
// console.log(rawFilters)
|
|
182
233
|
|