@riosst100/pwa-marketplace 1.6.6 → 1.6.8
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 +20 -7
- package/src/components/CollectibleGameSets/collectibleGameSets.module.css +24 -1
- package/src/components/CustomSubCategoryPage/subCategoryPage.js +3 -1
- package/src/components/ShopBy/shopBy.js +2 -1
- package/src/components/ShopBy/shopBy.module.css +1 -1
- package/src/components/ShopBySets/index.js +2 -0
- package/src/components/ShopBySets/shopBySets.js +291 -0
- package/src/components/ShopBySets/shopBySets.module.css +76 -0
- package/src/components/ShopBySets/shopBySets.shimmer.js +50 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/category.js +6 -3
- package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.js +2 -4
- package/src/overwrites/venia-ui/lib/components/Breadcrumbs/breadcrumbs.js +22 -3
- package/src/overwrites/venia-ui/lib/components/FilterSidebar/filterSidebar.js +3 -3
- package/src/talons/CollectibleGameSets/useCollectibleGameSets.js +4 -4
- package/src/talons/SubCategoryPage/subCategoryPage.gql.js +4 -0
package/package.json
CHANGED
|
@@ -35,7 +35,7 @@ const CollectibleGameSets = props => {
|
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
// if (productType == "
|
|
38
|
+
// if (productType == "expansion_sets") {
|
|
39
39
|
// defaultSort = {
|
|
40
40
|
// sortText: 'All (Expansion Sets)',
|
|
41
41
|
// value: 'all'
|
|
@@ -151,10 +151,10 @@ const CollectibleGameSets = props => {
|
|
|
151
151
|
}
|
|
152
152
|
];
|
|
153
153
|
|
|
154
|
-
alpha = availableGroups;
|
|
154
|
+
// alpha = availableGroups;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
if (productType == "
|
|
157
|
+
if (productType == "expansion_sets") {
|
|
158
158
|
// availableSortBy = [
|
|
159
159
|
// {
|
|
160
160
|
// 'label': 'All (Expansion Sets)',
|
|
@@ -166,11 +166,11 @@ const CollectibleGameSets = props => {
|
|
|
166
166
|
// }
|
|
167
167
|
// ];
|
|
168
168
|
|
|
169
|
-
alpha = availableGroups
|
|
169
|
+
// alpha = availableGroups
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
let title = "All Sets";
|
|
173
|
-
if (productType == "
|
|
173
|
+
if (productType == "expansion_sets") {
|
|
174
174
|
title = "Expansion Sets";
|
|
175
175
|
} else if (productType == "artist") {
|
|
176
176
|
title = "By Artist";
|
|
@@ -181,9 +181,22 @@ const CollectibleGameSets = props => {
|
|
|
181
181
|
return (
|
|
182
182
|
<Fragment>
|
|
183
183
|
<StoreTitle>{title}</StoreTitle>
|
|
184
|
-
<h1 className='mx-auto relative block text-xl font-bold text-center pt-10 pb-4'>
|
|
184
|
+
{shopby != "release_year" && productType != "expansion_sets" && <h1 className='mx-auto relative block text-xl font-bold text-center pt-10 pb-4'>
|
|
185
185
|
{title}
|
|
186
|
-
</h1>
|
|
186
|
+
</h1>}
|
|
187
|
+
{shopby == "release_year" || productType == "expansion_sets" && <ul className={classes.nav}>
|
|
188
|
+
{availableGroups.map((group, index) => (
|
|
189
|
+
<li key={index} className={classes.nav_item}>
|
|
190
|
+
<button
|
|
191
|
+
onClick={() => {
|
|
192
|
+
handleActive(group)
|
|
193
|
+
}}
|
|
194
|
+
>
|
|
195
|
+
{active == group ? <b>{group}</b> : group}
|
|
196
|
+
</button>
|
|
197
|
+
</li>
|
|
198
|
+
))}
|
|
199
|
+
</ul>}
|
|
187
200
|
<div className='border border-gray-100 px-6'>
|
|
188
201
|
{collectibleGameSets ? (
|
|
189
202
|
<div
|
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
.nav {
|
|
2
|
+
composes: flex from global;
|
|
3
|
+
composes: flex-wrap from global;
|
|
4
|
+
composes: mt-3 from global;
|
|
5
|
+
composes: gap-[10px] from global;
|
|
6
|
+
margin-bottom: 10px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.nav_item {
|
|
10
|
+
composes: px-4 from global;
|
|
11
|
+
composes: py-2 from global;
|
|
12
|
+
composes: transition-colors from global;
|
|
13
|
+
composes: duration-150 from global;
|
|
14
|
+
composes: border from global;
|
|
15
|
+
composes: border-solid from global;
|
|
16
|
+
composes: leading-normal from global;
|
|
17
|
+
composes: text-base from global;
|
|
18
|
+
composes: text-colorDefault from global;
|
|
19
|
+
composes: bg-white from global;
|
|
20
|
+
composes: border-gray-100 from global;
|
|
21
|
+
border-radius: 5px;
|
|
22
|
+
}
|
|
23
|
+
|
|
1
24
|
.toolbar {
|
|
2
25
|
composes: relative from global;
|
|
3
26
|
composes: ml-2xs from global;
|
|
@@ -10,7 +33,7 @@
|
|
|
10
33
|
composes: flex from global;
|
|
11
34
|
composes: flex-wrap from global;
|
|
12
35
|
composes: mt-3 from global;
|
|
13
|
-
composes: gap-[
|
|
36
|
+
composes: gap-[10px] from global;
|
|
14
37
|
margin-bottom: 30px;
|
|
15
38
|
}
|
|
16
39
|
|
|
@@ -11,6 +11,7 @@ import { ShopByShimmer } from '@riosst100/pwa-marketplace/src/components/ShopBy'
|
|
|
11
11
|
import CustomSortBy from '@riosst100/pwa-marketplace/src/components/CustomSortBy';
|
|
12
12
|
import ArraySearchInput from '@riosst100/pwa-marketplace/src/components/ArraySearchInput';
|
|
13
13
|
import { useSubCategoryPage } from '@riosst100/pwa-marketplace/src/talons/SubCategoryPage/useSubCategoryPage';
|
|
14
|
+
import Breadcrumbs from '@magento/venia-ui/lib/components/Breadcrumbs';
|
|
14
15
|
|
|
15
16
|
const SubCategoryPage = props => {
|
|
16
17
|
const { categoryId } = props;
|
|
@@ -71,8 +72,9 @@ const SubCategoryPage = props => {
|
|
|
71
72
|
return (
|
|
72
73
|
<Fragment>
|
|
73
74
|
<StoreTitle>{category ? category.name : 'Shop By'}</StoreTitle>
|
|
75
|
+
<Breadcrumbs categoryId={categoryId} customPage={category ? 'All ' + category.parent[0].name : ''} />
|
|
74
76
|
<h1 className='mx-auto relative block text-xl font-bold text-center pt-10 pb-4'>
|
|
75
|
-
{category ? category.name : '
|
|
77
|
+
{category ? 'All ' + category.parent[0].name : ''}
|
|
76
78
|
</h1>
|
|
77
79
|
<div className='border border-gray-100 px-6'>
|
|
78
80
|
{dataResult ? (
|
|
@@ -172,7 +172,8 @@ const ShopBy = props => {
|
|
|
172
172
|
|
|
173
173
|
return (
|
|
174
174
|
<Fragment>
|
|
175
|
-
<StoreTitle>{attributeData ?
|
|
175
|
+
<StoreTitle>{attributeData ? 'By ' + attributeData.label : 'Shop By'}</StoreTitle>
|
|
176
|
+
<Breadcrumbs categoryId={categoryId} customPage={'By ' + attributeData.label} />
|
|
176
177
|
<h1 className='mx-auto relative block text-xl font-bold text-center pt-10 pb-4'>
|
|
177
178
|
{attributeData ? 'By ' + attributeData.label : 'Shop By'}
|
|
178
179
|
</h1>
|
|
@@ -0,0 +1,291 @@
|
|
|
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 { useCollectibleGameSets } from '@riosst100/pwa-marketplace/src/talons/CollectibleGameSets/useCollectibleGameSets';
|
|
5
|
+
import { Link } from 'react-router-dom';
|
|
6
|
+
import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
|
|
7
|
+
import defaultClasses from './shopBySets.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 { ShopBySetsShimmer } from '@riosst100/pwa-marketplace/src/components/ShopBySets';
|
|
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 ShopBySets = props => {
|
|
18
|
+
const { categoryId } = props
|
|
19
|
+
|
|
20
|
+
const [active, setActive] = useState('all');
|
|
21
|
+
|
|
22
|
+
const [searchQuery, setSearchQuery] = useState('');
|
|
23
|
+
|
|
24
|
+
const { location } = globalThis;
|
|
25
|
+
|
|
26
|
+
const query = new URLSearchParams(location.search);
|
|
27
|
+
const shopby = query.get('shopby') || null;
|
|
28
|
+
|
|
29
|
+
let defaultSort = {
|
|
30
|
+
sortText: 'All (A-Z)',
|
|
31
|
+
value: 'all'
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
if (shopby == "release_year") {
|
|
35
|
+
defaultSort = {
|
|
36
|
+
sortText: 'All (By Year)',
|
|
37
|
+
value: 'date'
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// if (productType == "expansion_sets") {
|
|
42
|
+
// defaultSort = {
|
|
43
|
+
// sortText: 'All (Expansion Sets)',
|
|
44
|
+
// value: 'all'
|
|
45
|
+
// };
|
|
46
|
+
// }
|
|
47
|
+
|
|
48
|
+
const sortProps = useCustomSort({ sortFromSearch: false, defaultSort: defaultSort});
|
|
49
|
+
|
|
50
|
+
const [currentSort] = sortProps;
|
|
51
|
+
|
|
52
|
+
// const [sortBy, setSortBy] = useState({
|
|
53
|
+
// sortText: 'All (A-Z)',
|
|
54
|
+
// value: 'all'
|
|
55
|
+
// });
|
|
56
|
+
|
|
57
|
+
// console.log(currentSort)
|
|
58
|
+
|
|
59
|
+
const classes = useStyle(defaultClasses);
|
|
60
|
+
|
|
61
|
+
const talonProps = useCollectibleGameSets({ searchQuery, setActive, currentSort, shopby });
|
|
62
|
+
|
|
63
|
+
const { error, loading, collectibleGameSets, categoryUrlSuffix, categoryUrlKey, productType, filteredCollectibleGameSets, availableGroups } = talonProps;
|
|
64
|
+
|
|
65
|
+
if (loading && !collectibleGameSets)
|
|
66
|
+
return <ShopBySetsShimmer />;
|
|
67
|
+
if (error && !collectibleGameSets) return <ErrorView />;
|
|
68
|
+
|
|
69
|
+
if (!collectibleGameSets && !loading && !error) {
|
|
70
|
+
return <ShopBySetsShimmer />;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const setsLengthArr = [];
|
|
74
|
+
|
|
75
|
+
const newCollectibleGameSets = searchQuery ? filteredCollectibleGameSets : collectibleGameSets;
|
|
76
|
+
|
|
77
|
+
// useEffect(() => {
|
|
78
|
+
if (collectibleGameSets && collectibleGameSets.length) {
|
|
79
|
+
collectibleGameSets.map((setRelease, index) => {
|
|
80
|
+
const { release_type, sets } = setRelease;
|
|
81
|
+
|
|
82
|
+
setsLengthArr[release_type] = sets.length
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
// }, [collectibleGameSets])
|
|
86
|
+
|
|
87
|
+
const splitToNChunks = (array, n) => {
|
|
88
|
+
let result = [];
|
|
89
|
+
for (let i = n; i > 0; i--) {
|
|
90
|
+
result.push(array.splice(0, Math.ceil(array.length / i)));
|
|
91
|
+
}
|
|
92
|
+
return result;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const setRelases = newCollectibleGameSets.length && newCollectibleGameSets.map((setRelease, index) => {
|
|
96
|
+
const { release_type, sets } = setRelease;
|
|
97
|
+
|
|
98
|
+
const setsResult = [];
|
|
99
|
+
|
|
100
|
+
if (sets.length) {
|
|
101
|
+
sets.map((set, index) => {
|
|
102
|
+
const { set_name, option_id, set_abbreviation, release_year } = set;
|
|
103
|
+
|
|
104
|
+
const categoryUrl = resourceUrl(
|
|
105
|
+
`/games/collectible-game/${categoryUrlKey}${categoryUrlSuffix || ''}?card_set[filter]=${set_name},${option_id}`
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
setsResult.push(<li className='list-none'>
|
|
109
|
+
<Link to={categoryUrl} className="hover_bg-darkblue-900 hover_text-white w-full block text-[14px] py-[2px] px-2">
|
|
110
|
+
{set_name} <small style={{"color":"grey"}}>{set_abbreviation}</small>
|
|
111
|
+
</Link>
|
|
112
|
+
</li>)
|
|
113
|
+
})
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// console.log('setsResult: '+setsResult.length);
|
|
117
|
+
let setsResultSplitted = [];
|
|
118
|
+
if (active == release_type) {
|
|
119
|
+
setsResultSplitted = splitToNChunks(setsResult, 3);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
<>
|
|
124
|
+
{active == "all" ?
|
|
125
|
+
<div className={cn('singles_group-wrapper mb-4 px-2 inline-block', classes.singlesGroupWrapper)}>
|
|
126
|
+
<div className='singles_item_group_letter text-xl font-semibold border-b border-gray-100 pb-1 mb-2' >
|
|
127
|
+
{release_type}
|
|
128
|
+
</div>
|
|
129
|
+
<div className={cn('singles_item-list flex flex-col')}>{setsResult}</div>
|
|
130
|
+
</div> : ''}
|
|
131
|
+
{active == release_type ? setsResultSplitted && setsResultSplitted.length && setsResultSplitted.map((setsResult, index) =>
|
|
132
|
+
<div key={index} className={cn('singles_group-wrapper mb-4 px-2 inline-block', classes.singlesGroupWrapper)}>
|
|
133
|
+
{index == 0 ? <div className='singles_item_group_letter text-xl font-semibold border-b border-gray-100 pb-1 mb-2'>{release_type}</div> :
|
|
134
|
+
<div className='singles_item_group_letter text-xl font-semibold pb-1 mb-2' style={{"marginTop":"35px"}}></div>}
|
|
135
|
+
<div className={cn('singles_item-list flex flex-col')}>{setsResult}</div>
|
|
136
|
+
</div>
|
|
137
|
+
)
|
|
138
|
+
: ''}
|
|
139
|
+
</>
|
|
140
|
+
);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
const handleActive = (val) => {
|
|
144
|
+
setActive(val);
|
|
145
|
+
|
|
146
|
+
//
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
setSearchQuery('')
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
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'];
|
|
153
|
+
|
|
154
|
+
let availableSortBy = [
|
|
155
|
+
{
|
|
156
|
+
'label': 'All (A-Z)',
|
|
157
|
+
'value': 'all'
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
'label': 'Latest Sets',
|
|
161
|
+
'value': 'newest'
|
|
162
|
+
}
|
|
163
|
+
];
|
|
164
|
+
|
|
165
|
+
if (shopby == "release_year") {
|
|
166
|
+
availableSortBy = [
|
|
167
|
+
{
|
|
168
|
+
'label': 'All (By Year)',
|
|
169
|
+
'value': 'date'
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
'label': 'Latest Sets',
|
|
173
|
+
'value': 'newest'
|
|
174
|
+
}
|
|
175
|
+
];
|
|
176
|
+
|
|
177
|
+
// alpha = availableGroups;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (productType == "expansion_sets") {
|
|
181
|
+
// availableSortBy = [
|
|
182
|
+
// {
|
|
183
|
+
// 'label': 'All (Expansion Sets)',
|
|
184
|
+
// 'value': 'all'
|
|
185
|
+
// },
|
|
186
|
+
// {
|
|
187
|
+
// 'label': 'Latest Sets',
|
|
188
|
+
// 'value': 'newest'
|
|
189
|
+
// }
|
|
190
|
+
// ];
|
|
191
|
+
|
|
192
|
+
// alpha = availableGroups
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
let title = "All Sets";
|
|
196
|
+
if (productType == "expansion_sets") {
|
|
197
|
+
title = "Expansion Sets";
|
|
198
|
+
} else if (productType == "artist") {
|
|
199
|
+
title = "By Artist";
|
|
200
|
+
} else if (shopby == "release_year") {
|
|
201
|
+
title = "By Year";
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
console.log(availableGroups)
|
|
205
|
+
|
|
206
|
+
return (
|
|
207
|
+
<Fragment>
|
|
208
|
+
<StoreTitle>{title}</StoreTitle>
|
|
209
|
+
<Breadcrumbs categoryId={categoryId} customPage={shopby == "expansion_sets" ? "Expansion Sets" : (shopby == "release_year" ? "By Year" : "All Sets")} />
|
|
210
|
+
{shopby != "release_year" && productType != "expansion_sets" && <h1 className='mx-auto relative block text-xl font-bold text-center pt-10 pb-4'>
|
|
211
|
+
{title}
|
|
212
|
+
</h1>}
|
|
213
|
+
{shopby == "release_year" || productType == "expansion_sets" ? <ul className={classes.nav}>
|
|
214
|
+
{availableGroups.map((group, index) => (
|
|
215
|
+
<li key={index} className={classes.nav_item}>
|
|
216
|
+
<button
|
|
217
|
+
onClick={() => {
|
|
218
|
+
handleActive(group)
|
|
219
|
+
}}
|
|
220
|
+
>
|
|
221
|
+
{active == group ? <b>{group}</b> : group}
|
|
222
|
+
</button>
|
|
223
|
+
</li>
|
|
224
|
+
))}
|
|
225
|
+
<li className={classes.nav_item}>
|
|
226
|
+
<button
|
|
227
|
+
onClick={() => {
|
|
228
|
+
handleActive('all')
|
|
229
|
+
}}
|
|
230
|
+
>
|
|
231
|
+
{active == 'all' ? <b>All</b> : 'All'}
|
|
232
|
+
</button>
|
|
233
|
+
</li>
|
|
234
|
+
</ul> : ''}
|
|
235
|
+
<div className='border border-gray-100 px-6'>
|
|
236
|
+
{collectibleGameSets ? (
|
|
237
|
+
<div
|
|
238
|
+
className={classes.toolbar}
|
|
239
|
+
>
|
|
240
|
+
<div style={{"width":"35%"}}><ArraySearchInput active={active} searchQuery={searchQuery} placeholder="Search sets..." isOpen={true} setSearchQuery={setSearchQuery} /></div>
|
|
241
|
+
<CustomSortBy sortProps={sortProps} availableSortMethods={availableSortBy} />
|
|
242
|
+
</div>
|
|
243
|
+
) : ''}
|
|
244
|
+
{shopby == "sets" && <>
|
|
245
|
+
<section className='single_list-indexing-container relative m-auto pt-5'>
|
|
246
|
+
<ul className='flex gap-2 justify-center flex-wrap'>
|
|
247
|
+
<li>
|
|
248
|
+
<button
|
|
249
|
+
className={cn(
|
|
250
|
+
'rounded-md border border-solid border-gray-100 p-2 min-w-[28px]',
|
|
251
|
+
'leading-4 font-medium text-base hover_bg-gray-50'
|
|
252
|
+
)}
|
|
253
|
+
onClick={() => {
|
|
254
|
+
handleActive('all')
|
|
255
|
+
}}
|
|
256
|
+
>
|
|
257
|
+
{active == 'all' ? <b>All</b> : 'All'}
|
|
258
|
+
</button>
|
|
259
|
+
</li>
|
|
260
|
+
{alpha.map((letter, index) => (
|
|
261
|
+
<li key={index}>
|
|
262
|
+
<button
|
|
263
|
+
className={cn(
|
|
264
|
+
'rounded-md border border-solid border-gray-100 p-2 min-w-[28px]',
|
|
265
|
+
'leading-4 font-medium text-base ',
|
|
266
|
+
setsLengthArr[letter] > 0 ? 'hover_bg-gray-50' : 'bg-gray-100 text-gray-400',
|
|
267
|
+
)}
|
|
268
|
+
onClick={() => {
|
|
269
|
+
handleActive(letter)
|
|
270
|
+
}}
|
|
271
|
+
disabled={setsLengthArr[letter] > 0 ? false : true}
|
|
272
|
+
>
|
|
273
|
+
{active == letter ? <b>{letter}</b> : letter}
|
|
274
|
+
</button>
|
|
275
|
+
</li>
|
|
276
|
+
))}
|
|
277
|
+
</ul>
|
|
278
|
+
</section>
|
|
279
|
+
</>}
|
|
280
|
+
<Divider className="mb-5 px-4 mt-5" />
|
|
281
|
+
<section className='singles-container'>
|
|
282
|
+
<div className={cn('singles-wrapper block -mx-4', classes.singlesWrapper)}>
|
|
283
|
+
{newCollectibleGameSets && newCollectibleGameSets.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>)}
|
|
284
|
+
</div>
|
|
285
|
+
</section>
|
|
286
|
+
</div>
|
|
287
|
+
</Fragment>
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
export default ShopBySets;
|
|
@@ -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 './shopBySets.module.css';
|
|
7
|
+
import cn from 'classnames';
|
|
8
|
+
import Divider from '@riosst100/pwa-marketplace/src/components/Divider';
|
|
9
|
+
|
|
10
|
+
const ShopBySets = 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 ShopBySets;
|
|
@@ -11,6 +11,7 @@ import ErrorView from '@magento/venia-ui/lib/components/ErrorView';
|
|
|
11
11
|
import { useIntl } from 'react-intl';
|
|
12
12
|
import ShopBy from '@riosst100/pwa-marketplace/src/components/ShopBy/shopBy';
|
|
13
13
|
import SubCategoryPage from '@riosst100/pwa-marketplace/src/components/CustomSubCategoryPage/subCategoryPage';
|
|
14
|
+
import ShopBySets from '@riosst100/pwa-marketplace/src/components/ShopBySets/shopBySets';
|
|
14
15
|
|
|
15
16
|
const MESSAGES = new Map().set(
|
|
16
17
|
'NOT_FOUND',
|
|
@@ -66,7 +67,6 @@ const Category = props => {
|
|
|
66
67
|
/>
|
|
67
68
|
);
|
|
68
69
|
}
|
|
69
|
-
console.log(categoryData)
|
|
70
70
|
|
|
71
71
|
return (
|
|
72
72
|
<Fragment>
|
|
@@ -76,7 +76,10 @@ const Category = props => {
|
|
|
76
76
|
categoryId={uid}
|
|
77
77
|
isLoading={loading} />
|
|
78
78
|
) : (
|
|
79
|
-
shopby ?
|
|
79
|
+
shopby == "sets" || shopby == "expansion_sets" || shopby == "release_year" ? <ShopBySets
|
|
80
|
+
categoryId={uid}
|
|
81
|
+
shopby={shopby}
|
|
82
|
+
isLoading={loading} /> : (shopby ? (
|
|
80
83
|
<ShopBy
|
|
81
84
|
categoryId={uid}
|
|
82
85
|
shopby={shopby}
|
|
@@ -91,7 +94,7 @@ const Category = props => {
|
|
|
91
94
|
sortProps={sortProps}
|
|
92
95
|
pageSize={pageSize}
|
|
93
96
|
/>
|
|
94
|
-
)
|
|
97
|
+
))
|
|
95
98
|
)}
|
|
96
99
|
</Fragment>
|
|
97
100
|
);
|
|
@@ -115,8 +115,6 @@ const CategoryContent = props => {
|
|
|
115
115
|
[items, activeLetter]
|
|
116
116
|
});
|
|
117
117
|
|
|
118
|
-
console.log(galleryItems)
|
|
119
|
-
|
|
120
118
|
const sidebarRef = useRef(null);
|
|
121
119
|
const classes = useStyle(defaultClasses, props.classes);
|
|
122
120
|
const shouldRenderSidebarContent = useIsInViewport({
|
|
@@ -141,7 +139,7 @@ const CategoryContent = props => {
|
|
|
141
139
|
) : null;
|
|
142
140
|
|
|
143
141
|
const sidebar = shouldShowFilterButtons ? (
|
|
144
|
-
<FilterSidebar children={children} filters={filters} allowedFilters={category ? category.allowed_filters : []} />
|
|
142
|
+
<FilterSidebar hideFilters={category && category.hide_filters ? true : false} children={children} filters={filters} allowedFilters={category ? category.allowed_filters : []} />
|
|
145
143
|
) : shouldShowFilterShimmer ? (
|
|
146
144
|
<FilterSidebarShimmer />
|
|
147
145
|
) : null;
|
|
@@ -284,7 +282,7 @@ const CategoryContent = props => {
|
|
|
284
282
|
<div className={classes.contentWrapper}>
|
|
285
283
|
<div ref={sidebarRef} className={classes.sidebar}>
|
|
286
284
|
<Suspense fallback={<FilterSidebarShimmer />}>
|
|
287
|
-
{shouldRenderSidebarContent && category
|
|
285
|
+
{shouldRenderSidebarContent && category ? sidebar : null}
|
|
288
286
|
</Suspense>
|
|
289
287
|
</div>
|
|
290
288
|
<div className={classes.categoryContent}>
|
|
@@ -22,7 +22,7 @@ import { useLocation } from 'react-router-dom';
|
|
|
22
22
|
const Breadcrumbs = props => {
|
|
23
23
|
const classes = useStyle(defaultClasses, props.classes);
|
|
24
24
|
|
|
25
|
-
const { categoryId, currentProduct, currentFilter } = props;
|
|
25
|
+
const { categoryId, currentProduct, customPage, currentFilter } = props;
|
|
26
26
|
|
|
27
27
|
const talonProps = useBreadcrumbs({ categoryId });
|
|
28
28
|
|
|
@@ -85,7 +85,18 @@ const Breadcrumbs = props => {
|
|
|
85
85
|
</Link>
|
|
86
86
|
)
|
|
87
87
|
) : (
|
|
88
|
-
|
|
88
|
+
customPage ? (
|
|
89
|
+
filterBreadcrumbsElement.push(
|
|
90
|
+
<Link
|
|
91
|
+
key={index}
|
|
92
|
+
className={classes.link}
|
|
93
|
+
to={resourceUrl(currentCategoryPath)}
|
|
94
|
+
onClick={handleClick}
|
|
95
|
+
>
|
|
96
|
+
{filter.label}
|
|
97
|
+
</Link>
|
|
98
|
+
)
|
|
99
|
+
) : filterBreadcrumbsElement.push(
|
|
89
100
|
<span key={index}>
|
|
90
101
|
<span className={classes.divider}>{DELIMITER}</span>
|
|
91
102
|
<span className={cn(classes.currentCategory, 'text-blue-700 font-medium')}>{filter.label}</span>
|
|
@@ -97,7 +108,7 @@ const Breadcrumbs = props => {
|
|
|
97
108
|
// If we have a "currentProduct" it means we're on a PDP so we want the last
|
|
98
109
|
// category text to be a link. If we don't have a "currentProduct" we're on
|
|
99
110
|
// a category page so it should be regular text.
|
|
100
|
-
const currentCategoryLink = currentProduct || currentFilter && currentFilter.length ? (
|
|
111
|
+
const currentCategoryLink = customPage || currentProduct || currentFilter && currentFilter.length ? (
|
|
101
112
|
<Link
|
|
102
113
|
className={classes.link}
|
|
103
114
|
to={'/'+resourceUrl(currentCategoryPath)}
|
|
@@ -115,6 +126,13 @@ const Breadcrumbs = props => {
|
|
|
115
126
|
<span className={classes.text}>{currentProduct}</span>
|
|
116
127
|
</Fragment>
|
|
117
128
|
) : null;
|
|
129
|
+
|
|
130
|
+
const customPageNode = customPage ? (
|
|
131
|
+
<Fragment>
|
|
132
|
+
<span className={classes.divider}>{DELIMITER}</span>
|
|
133
|
+
<span className={classes.text}>{customPage}</span>
|
|
134
|
+
</Fragment>
|
|
135
|
+
) : null;
|
|
118
136
|
|
|
119
137
|
return (
|
|
120
138
|
<div className={classes.root} aria-live="polite" aria-busy="false">
|
|
@@ -126,6 +144,7 @@ const Breadcrumbs = props => {
|
|
|
126
144
|
{currentCategoryLink}
|
|
127
145
|
{filterBreadcrumbsElement}
|
|
128
146
|
{currentProductNode}
|
|
147
|
+
{customPageNode}
|
|
129
148
|
</div>
|
|
130
149
|
);
|
|
131
150
|
};
|
|
@@ -21,7 +21,7 @@ const SCROLL_OFFSET = 150;
|
|
|
21
21
|
* @param {Object} props.filters - filters to display
|
|
22
22
|
*/
|
|
23
23
|
const FilterSidebar = props => {
|
|
24
|
-
const { filters, filterCountToOpen, allowedFilters } = props;
|
|
24
|
+
const { filters, filterCountToOpen, allowedFilters, hideFilters } = props;
|
|
25
25
|
const talonProps = useFilterSidebar({ filters });
|
|
26
26
|
const {
|
|
27
27
|
filterApi,
|
|
@@ -154,14 +154,14 @@ const FilterSidebar = props => {
|
|
|
154
154
|
<Filter size={15} className='text-gray-900' />
|
|
155
155
|
</h2>
|
|
156
156
|
</div>
|
|
157
|
+
{hideFilters ? <ul className={classes.blocks}>No filters available.</ul> : <>
|
|
157
158
|
<CurrentFilters
|
|
158
159
|
filterApi={filterApi}
|
|
159
160
|
filterNames={filterNames}
|
|
160
161
|
filterState={filterState}
|
|
161
162
|
onRemove={handleApplyFilter}
|
|
162
163
|
/>
|
|
163
|
-
|
|
164
|
-
<ul className={classes.blocks}>{filtersList}</ul>
|
|
164
|
+
<ul className={classes.blocks}>{filtersList}</ul></>}
|
|
165
165
|
</div>
|
|
166
166
|
</aside>
|
|
167
167
|
);
|
|
@@ -8,7 +8,7 @@ import DEFAULT_OPERATIONS from './collectibleGameSets.gql';
|
|
|
8
8
|
|
|
9
9
|
export const useCollectibleGameSets = props => {
|
|
10
10
|
|
|
11
|
-
const { searchQuery, setActive, currentSort } = props
|
|
11
|
+
const { searchQuery, setActive, currentSort, shopby } = props
|
|
12
12
|
|
|
13
13
|
const { value: sortby } = currentSort
|
|
14
14
|
|
|
@@ -31,8 +31,8 @@ export const useCollectibleGameSets = props => {
|
|
|
31
31
|
|
|
32
32
|
const pathnameArr = pathname.split('/');
|
|
33
33
|
|
|
34
|
-
const categoryUrlKey = pathnameArr[pathnameArr.length -
|
|
35
|
-
const productType =
|
|
34
|
+
const categoryUrlKey = pathnameArr[pathnameArr.length - 1].replace('.html','');
|
|
35
|
+
const productType = shopby;
|
|
36
36
|
|
|
37
37
|
const categoryUrlSuffix = storeConfigData?.storeConfig?.category_url_suffix;
|
|
38
38
|
|
|
@@ -92,7 +92,7 @@ export const useCollectibleGameSets = props => {
|
|
|
92
92
|
return sortby != "all" ? sortbyData && sortbyData.length ? sortbyData.sort((a, b) => b.release_type.toLowerCase().localeCompare(a.release_type.toLowerCase())) : sortbyData : collectibleGameSets.slice().sort((a, b) => a.release_type.toLowerCase().localeCompare(b.release_type.toLowerCase()));
|
|
93
93
|
}, [data, sortby]);
|
|
94
94
|
|
|
95
|
-
const availableGroups = collectibleGameSets.map(({ release_type }) => release_type);
|
|
95
|
+
const availableGroups = collectibleGameSets && collectibleGameSets.length ? collectibleGameSets.map(({ release_type }) => release_type) : [];
|
|
96
96
|
|
|
97
97
|
// console.log(collectibleGameSets)
|
|
98
98
|
|