@riosst100/pwa-marketplace 1.6.5 → 1.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/CollectibleGameSets/collectibleGameSets.js +104 -43
- package/src/components/CollectibleGameSets/collectibleGameSets.module.css +24 -1
- package/src/components/CollectibleGameSets/collectibleGameSets.shimmer.js +1 -1
- package/src/components/CustomSubCategoryPage/subCategoryPage.js +4 -2
- package/src/components/ShopBy/shopBy.js +4 -3
- package/src/components/ShopBy/shopBy.module.css +1 -1
- package/src/components/ShopBy/shopBy.shimmer.js +1 -1
- package/src/components/ShopBySets/index.js +2 -0
- package/src/components/ShopBySets/shopBySets.js +269 -0
- package/src/components/ShopBySets/shopBySets.module.css +68 -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 +1 -1
- package/src/overwrites/venia-ui/lib/components/Breadcrumbs/breadcrumbs.js +22 -3
- package/src/talons/CollectibleGameSets/useCollectibleGameSets.js +8 -5
- package/src/talons/SubCategoryPage/subCategoryPage.gql.js +4 -0
package/package.json
CHANGED
|
@@ -18,11 +18,31 @@ const CollectibleGameSets = props => {
|
|
|
18
18
|
|
|
19
19
|
const [searchQuery, setSearchQuery] = useState('');
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
const { location } = globalThis;
|
|
22
|
+
|
|
23
|
+
const query = new URLSearchParams(location.search);
|
|
24
|
+
const shopby = query.get('shopby') || null;
|
|
25
|
+
|
|
26
|
+
let defaultSort = {
|
|
23
27
|
sortText: 'All (A-Z)',
|
|
24
28
|
value: 'all'
|
|
25
|
-
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
if (shopby == "release_year") {
|
|
32
|
+
defaultSort = {
|
|
33
|
+
sortText: 'All (By Year)',
|
|
34
|
+
value: 'date'
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// if (productType == "expansion_sets") {
|
|
39
|
+
// defaultSort = {
|
|
40
|
+
// sortText: 'All (Expansion Sets)',
|
|
41
|
+
// value: 'all'
|
|
42
|
+
// };
|
|
43
|
+
// }
|
|
44
|
+
|
|
45
|
+
const sortProps = useCustomSort({ sortFromSearch: false, defaultSort: defaultSort});
|
|
26
46
|
|
|
27
47
|
const [currentSort] = sortProps;
|
|
28
48
|
|
|
@@ -37,7 +57,9 @@ const CollectibleGameSets = props => {
|
|
|
37
57
|
|
|
38
58
|
const talonProps = useCollectibleGameSets({ searchQuery, setActive, currentSort });
|
|
39
59
|
|
|
40
|
-
const { error, loading, collectibleGameSets, categoryUrlSuffix, categoryUrlKey, productType, filteredCollectibleGameSets } = talonProps;
|
|
60
|
+
const { error, loading, collectibleGameSets, categoryUrlSuffix, categoryUrlKey, productType, filteredCollectibleGameSets, availableGroups } = talonProps;
|
|
61
|
+
|
|
62
|
+
console.log(availableGroups)
|
|
41
63
|
|
|
42
64
|
if (loading && !collectibleGameSets)
|
|
43
65
|
return <CollectibleGameSetsShimmer />;
|
|
@@ -104,9 +126,9 @@ const CollectibleGameSets = props => {
|
|
|
104
126
|
setSearchQuery('')
|
|
105
127
|
}
|
|
106
128
|
|
|
107
|
-
|
|
129
|
+
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'];
|
|
108
130
|
|
|
109
|
-
|
|
131
|
+
let availableSortBy = [
|
|
110
132
|
{
|
|
111
133
|
'label': 'All (A-Z)',
|
|
112
134
|
'value': 'all'
|
|
@@ -114,26 +136,67 @@ const CollectibleGameSets = props => {
|
|
|
114
136
|
{
|
|
115
137
|
'label': 'Latest Sets',
|
|
116
138
|
'value': 'newest'
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
'label': 'By Year',
|
|
120
|
-
'value': 'date'
|
|
121
139
|
}
|
|
122
140
|
];
|
|
123
141
|
|
|
142
|
+
if (shopby == "release_year") {
|
|
143
|
+
availableSortBy = [
|
|
144
|
+
{
|
|
145
|
+
'label': 'All (By Year)',
|
|
146
|
+
'value': 'date'
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
'label': 'Latest Sets',
|
|
150
|
+
'value': 'newest'
|
|
151
|
+
}
|
|
152
|
+
];
|
|
153
|
+
|
|
154
|
+
// alpha = availableGroups;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (productType == "expansion_sets") {
|
|
158
|
+
// availableSortBy = [
|
|
159
|
+
// {
|
|
160
|
+
// 'label': 'All (Expansion Sets)',
|
|
161
|
+
// 'value': 'all'
|
|
162
|
+
// },
|
|
163
|
+
// {
|
|
164
|
+
// 'label': 'Latest Sets',
|
|
165
|
+
// 'value': 'newest'
|
|
166
|
+
// }
|
|
167
|
+
// ];
|
|
168
|
+
|
|
169
|
+
// alpha = availableGroups
|
|
170
|
+
}
|
|
171
|
+
|
|
124
172
|
let title = "All Sets";
|
|
125
|
-
if (productType == "
|
|
173
|
+
if (productType == "expansion_sets") {
|
|
126
174
|
title = "Expansion Sets";
|
|
127
175
|
} else if (productType == "artist") {
|
|
128
|
-
title = "Artist";
|
|
176
|
+
title = "By Artist";
|
|
177
|
+
} else if (shopby == "release_year") {
|
|
178
|
+
title = "By Year";
|
|
129
179
|
}
|
|
130
180
|
|
|
131
181
|
return (
|
|
132
182
|
<Fragment>
|
|
133
183
|
<StoreTitle>{title}</StoreTitle>
|
|
134
|
-
<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'>
|
|
135
185
|
{title}
|
|
136
|
-
</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>}
|
|
137
200
|
<div className='border border-gray-100 px-6'>
|
|
138
201
|
{collectibleGameSets ? (
|
|
139
202
|
<div
|
|
@@ -143,44 +206,42 @@ const CollectibleGameSets = props => {
|
|
|
143
206
|
<CustomSortBy sortProps={sortProps} availableSortMethods={availableSortBy} />
|
|
144
207
|
</div>
|
|
145
208
|
) : ''}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
<
|
|
149
|
-
<
|
|
150
|
-
<
|
|
209
|
+
<>
|
|
210
|
+
<section className='single_list-indexing-container relative m-auto pt-5'>
|
|
211
|
+
<ul className='flex gap-2 justify-center flex-wrap'>
|
|
212
|
+
<li>
|
|
213
|
+
<button
|
|
214
|
+
className={cn(
|
|
215
|
+
'rounded-md border border-solid border-gray-100 p-2 min-w-[28px]',
|
|
216
|
+
'leading-4 font-medium text-base hover_bg-gray-50'
|
|
217
|
+
)}
|
|
218
|
+
onClick={() => {
|
|
219
|
+
handleActive('all')
|
|
220
|
+
}}
|
|
221
|
+
>
|
|
222
|
+
{active == 'all' ? <b>All</b> : 'All'}
|
|
223
|
+
</button>
|
|
224
|
+
</li>
|
|
225
|
+
{alpha.map((letter, index) => (
|
|
226
|
+
<li key={index}>
|
|
151
227
|
<button
|
|
152
228
|
className={cn(
|
|
153
229
|
'rounded-md border border-solid border-gray-100 p-2 min-w-[28px]',
|
|
154
|
-
'leading-4 font-medium text-base
|
|
230
|
+
'leading-4 font-medium text-base ',
|
|
231
|
+
setsLengthArr[letter] > 0 ? 'hover_bg-gray-50' : 'bg-gray-100 text-gray-400',
|
|
155
232
|
)}
|
|
156
233
|
onClick={() => {
|
|
157
|
-
handleActive(
|
|
234
|
+
handleActive(letter)
|
|
158
235
|
}}
|
|
236
|
+
disabled={setsLengthArr[letter] > 0 ? false : true}
|
|
159
237
|
>
|
|
160
|
-
{active ==
|
|
238
|
+
{active == letter ? <b>{letter}</b> : letter}
|
|
161
239
|
</button>
|
|
162
240
|
</li>
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
'rounded-md border border-solid border-gray-100 p-2 min-w-[28px]',
|
|
168
|
-
'leading-4 font-medium text-base ',
|
|
169
|
-
setsLengthArr[letter] > 0 ? 'hover_bg-gray-50' : 'bg-gray-100 text-gray-400',
|
|
170
|
-
)}
|
|
171
|
-
onClick={() => {
|
|
172
|
-
handleActive(letter)
|
|
173
|
-
}}
|
|
174
|
-
disabled={setsLengthArr[letter] > 0 ? false : true}
|
|
175
|
-
>
|
|
176
|
-
{active == letter ? <b>{letter}</b> : letter}
|
|
177
|
-
</button>
|
|
178
|
-
</li>
|
|
179
|
-
))}
|
|
180
|
-
</ul>
|
|
181
|
-
</section>
|
|
182
|
-
</>
|
|
183
|
-
) : ''}
|
|
241
|
+
))}
|
|
242
|
+
</ul>
|
|
243
|
+
</section>
|
|
244
|
+
</>
|
|
184
245
|
<Divider className="mb-5 px-4 mt-5" />
|
|
185
246
|
<section className='singles-container'>
|
|
186
247
|
<div className={cn('singles-wrapper block -mx-4', classes.singlesWrapper)}>
|
|
@@ -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
|
|
|
@@ -15,7 +15,7 @@ const CollectibleGameSets = props => {
|
|
|
15
15
|
<h1 className='mx-auto relative block text-xl font-bold text-center pt-10 pb-4'><Shimmer width="25%" height="6vh" /></h1>
|
|
16
16
|
<div className='border border-gray-100 px-6'>
|
|
17
17
|
<center>
|
|
18
|
-
<section className='single_list-indexing-container relative m-auto
|
|
18
|
+
<section className='single_list-indexing-container relative m-auto pt-5'>
|
|
19
19
|
<Shimmer width="95%" height="6vh" />
|
|
20
20
|
</section>
|
|
21
21
|
</center>
|
|
@@ -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 ? (
|
|
@@ -83,7 +85,7 @@ const SubCategoryPage = props => {
|
|
|
83
85
|
</div>
|
|
84
86
|
) : ''}
|
|
85
87
|
<>
|
|
86
|
-
<section className='single_list-indexing-container relative m-auto
|
|
88
|
+
<section className='single_list-indexing-container relative m-auto pt-5'>
|
|
87
89
|
<ul className='flex gap-2 justify-center flex-wrap'>
|
|
88
90
|
<li>
|
|
89
91
|
<button
|
|
@@ -172,9 +172,10 @@ 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
|
-
{attributeData ?
|
|
178
|
+
{attributeData ? 'By ' + attributeData.label : 'Shop By'}
|
|
178
179
|
</h1>
|
|
179
180
|
<div className='border border-gray-100 px-6'>
|
|
180
181
|
{dataResult ? (
|
|
@@ -187,7 +188,7 @@ const ShopBy = props => {
|
|
|
187
188
|
) : ''}
|
|
188
189
|
{productType != "expansion-sets" ? (
|
|
189
190
|
<>
|
|
190
|
-
<section className='single_list-indexing-container relative m-auto
|
|
191
|
+
<section className='single_list-indexing-container relative m-auto pt-5'>
|
|
191
192
|
<ul className='flex gap-2 justify-center flex-wrap'>
|
|
192
193
|
<li>
|
|
193
194
|
<button
|
|
@@ -15,7 +15,7 @@ const ShopBy = props => {
|
|
|
15
15
|
<h1 className='mx-auto relative block text-xl font-bold text-center pt-10 pb-4'><Shimmer width="25%" height="6vh" /></h1>
|
|
16
16
|
<div className='border border-gray-100 px-6'>
|
|
17
17
|
<center>
|
|
18
|
-
<section className='single_list-indexing-container relative m-auto
|
|
18
|
+
<section className='single_list-indexing-container relative m-auto pt-5'>
|
|
19
19
|
<Shimmer width="95%" height="6vh" />
|
|
20
20
|
</section>
|
|
21
21
|
</center>
|
|
@@ -0,0 +1,269 @@
|
|
|
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 setRelases = newCollectibleGameSets.length && newCollectibleGameSets.map((setRelease, index) => {
|
|
88
|
+
const { release_type, sets } = setRelease;
|
|
89
|
+
|
|
90
|
+
const setsResult = [];
|
|
91
|
+
|
|
92
|
+
if (sets.length) {
|
|
93
|
+
sets.map((set, index) => {
|
|
94
|
+
const { set_name, option_id, set_abbreviation, release_year } = set;
|
|
95
|
+
|
|
96
|
+
const categoryUrl = resourceUrl(
|
|
97
|
+
`/games/collectible-game/${categoryUrlKey}${categoryUrlSuffix || ''}?card_set[filter]=${set_name},${option_id}`
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
setsResult.push(<li className='list-none'>
|
|
101
|
+
<Link to={categoryUrl} className="hover_bg-darkblue-900 hover_text-white w-full block text-[14px] py-[2px] px-2">
|
|
102
|
+
{set_name} <small style={{"color":"grey"}}>{set_abbreviation}</small>
|
|
103
|
+
</Link>
|
|
104
|
+
</li>)
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<>
|
|
110
|
+
{active == "all" || active == release_type ?
|
|
111
|
+
<div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>
|
|
112
|
+
<div className='singles_item_group_letter text-xl font-semibold border-b border-gray-100 pb-1 mb-2' >
|
|
113
|
+
{release_type}
|
|
114
|
+
</div>
|
|
115
|
+
<div className={cn('singles_item-list flex flex-col')}>{setsResult}</div>
|
|
116
|
+
</div> : ''}
|
|
117
|
+
</>
|
|
118
|
+
);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
const handleActive = (val) => {
|
|
122
|
+
setActive(val);
|
|
123
|
+
|
|
124
|
+
//
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
setSearchQuery('')
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
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'];
|
|
131
|
+
|
|
132
|
+
let availableSortBy = [
|
|
133
|
+
{
|
|
134
|
+
'label': 'All (A-Z)',
|
|
135
|
+
'value': 'all'
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
'label': 'Latest Sets',
|
|
139
|
+
'value': 'newest'
|
|
140
|
+
}
|
|
141
|
+
];
|
|
142
|
+
|
|
143
|
+
if (shopby == "release_year") {
|
|
144
|
+
availableSortBy = [
|
|
145
|
+
{
|
|
146
|
+
'label': 'All (By Year)',
|
|
147
|
+
'value': 'date'
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
'label': 'Latest Sets',
|
|
151
|
+
'value': 'newest'
|
|
152
|
+
}
|
|
153
|
+
];
|
|
154
|
+
|
|
155
|
+
// alpha = availableGroups;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (productType == "expansion_sets") {
|
|
159
|
+
// availableSortBy = [
|
|
160
|
+
// {
|
|
161
|
+
// 'label': 'All (Expansion Sets)',
|
|
162
|
+
// 'value': 'all'
|
|
163
|
+
// },
|
|
164
|
+
// {
|
|
165
|
+
// 'label': 'Latest Sets',
|
|
166
|
+
// 'value': 'newest'
|
|
167
|
+
// }
|
|
168
|
+
// ];
|
|
169
|
+
|
|
170
|
+
// alpha = availableGroups
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
let title = "All Sets";
|
|
174
|
+
if (productType == "expansion_sets") {
|
|
175
|
+
title = "Expansion Sets";
|
|
176
|
+
} else if (productType == "artist") {
|
|
177
|
+
title = "By Artist";
|
|
178
|
+
} else if (shopby == "release_year") {
|
|
179
|
+
title = "By Year";
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
console.log(availableGroups)
|
|
183
|
+
|
|
184
|
+
return (
|
|
185
|
+
<Fragment>
|
|
186
|
+
<StoreTitle>{title}</StoreTitle>
|
|
187
|
+
<Breadcrumbs categoryId={categoryId} customPage={shopby == "expansion_sets" ? "Expansion Sets" : (shopby == "release_year" ? "By Year" : "All Sets")} />
|
|
188
|
+
{shopby != "release_year" && productType != "expansion_sets" && <h1 className='mx-auto relative block text-xl font-bold text-center pt-10 pb-4'>
|
|
189
|
+
{title}
|
|
190
|
+
</h1>}
|
|
191
|
+
{shopby == "release_year" || productType == "expansion_sets" ? <ul className={classes.nav}>
|
|
192
|
+
{availableGroups.map((group, index) => (
|
|
193
|
+
<li key={index} className={classes.nav_item}>
|
|
194
|
+
<button
|
|
195
|
+
onClick={() => {
|
|
196
|
+
handleActive(group)
|
|
197
|
+
}}
|
|
198
|
+
>
|
|
199
|
+
{active == group ? <b>{group}</b> : group}
|
|
200
|
+
</button>
|
|
201
|
+
</li>
|
|
202
|
+
))}
|
|
203
|
+
<li className={classes.nav_item}>
|
|
204
|
+
<button
|
|
205
|
+
onClick={() => {
|
|
206
|
+
handleActive('all')
|
|
207
|
+
}}
|
|
208
|
+
>
|
|
209
|
+
{active == 'all' ? <b>All</b> : 'All'}
|
|
210
|
+
</button>
|
|
211
|
+
</li>
|
|
212
|
+
</ul> : ''}
|
|
213
|
+
<div className='border border-gray-100 px-6'>
|
|
214
|
+
{collectibleGameSets ? (
|
|
215
|
+
<div
|
|
216
|
+
className={classes.toolbar}
|
|
217
|
+
>
|
|
218
|
+
<div style={{"width":"35%"}}><ArraySearchInput active={active} searchQuery={searchQuery} placeholder="Search sets..." isOpen={true} setSearchQuery={setSearchQuery} /></div>
|
|
219
|
+
<CustomSortBy sortProps={sortProps} availableSortMethods={availableSortBy} />
|
|
220
|
+
</div>
|
|
221
|
+
) : ''}
|
|
222
|
+
{shopby == "sets" && <>
|
|
223
|
+
<section className='single_list-indexing-container relative m-auto pt-5'>
|
|
224
|
+
<ul className='flex gap-2 justify-center flex-wrap'>
|
|
225
|
+
<li>
|
|
226
|
+
<button
|
|
227
|
+
className={cn(
|
|
228
|
+
'rounded-md border border-solid border-gray-100 p-2 min-w-[28px]',
|
|
229
|
+
'leading-4 font-medium text-base hover_bg-gray-50'
|
|
230
|
+
)}
|
|
231
|
+
onClick={() => {
|
|
232
|
+
handleActive('all')
|
|
233
|
+
}}
|
|
234
|
+
>
|
|
235
|
+
{active == 'all' ? <b>All</b> : 'All'}
|
|
236
|
+
</button>
|
|
237
|
+
</li>
|
|
238
|
+
{alpha.map((letter, index) => (
|
|
239
|
+
<li key={index}>
|
|
240
|
+
<button
|
|
241
|
+
className={cn(
|
|
242
|
+
'rounded-md border border-solid border-gray-100 p-2 min-w-[28px]',
|
|
243
|
+
'leading-4 font-medium text-base ',
|
|
244
|
+
setsLengthArr[letter] > 0 ? 'hover_bg-gray-50' : 'bg-gray-100 text-gray-400',
|
|
245
|
+
)}
|
|
246
|
+
onClick={() => {
|
|
247
|
+
handleActive(letter)
|
|
248
|
+
}}
|
|
249
|
+
disabled={setsLengthArr[letter] > 0 ? false : true}
|
|
250
|
+
>
|
|
251
|
+
{active == letter ? <b>{letter}</b> : letter}
|
|
252
|
+
</button>
|
|
253
|
+
</li>
|
|
254
|
+
))}
|
|
255
|
+
</ul>
|
|
256
|
+
</section>
|
|
257
|
+
</>}
|
|
258
|
+
<Divider className="mb-5 px-4 mt-5" />
|
|
259
|
+
<section className='singles-container'>
|
|
260
|
+
<div className={cn('singles-wrapper block -mx-4', classes.singlesWrapper)}>
|
|
261
|
+
{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>)}
|
|
262
|
+
</div>
|
|
263
|
+
</section>
|
|
264
|
+
</div>
|
|
265
|
+
</Fragment>
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export default ShopBySets;
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
}
|
|
57
|
+
|
|
58
|
+
@media screen and (min-width: 768px) {
|
|
59
|
+
.singlesWrapper {
|
|
60
|
+
column-count: 2;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@media screen and (min-width: 1023px) {
|
|
65
|
+
.singlesWrapper {
|
|
66
|
+
column-count: 3;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -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
|
);
|
|
@@ -284,7 +284,7 @@ const CategoryContent = props => {
|
|
|
284
284
|
<div className={classes.contentWrapper}>
|
|
285
285
|
<div ref={sidebarRef} className={classes.sidebar}>
|
|
286
286
|
<Suspense fallback={<FilterSidebarShimmer />}>
|
|
287
|
-
{shouldRenderSidebarContent && category
|
|
287
|
+
{shouldRenderSidebarContent && category ? sidebar : null}
|
|
288
288
|
</Suspense>
|
|
289
289
|
</div>
|
|
290
290
|
<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
|
};
|
|
@@ -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,6 +92,8 @@ 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 && collectibleGameSets.length ? collectibleGameSets.map(({ release_type }) => release_type) : [];
|
|
96
|
+
|
|
95
97
|
// console.log(collectibleGameSets)
|
|
96
98
|
|
|
97
99
|
const filteredCollectibleGameSets = useMemo(() => {
|
|
@@ -115,7 +117,7 @@ export const useCollectibleGameSets = props => {
|
|
|
115
117
|
|
|
116
118
|
if (newSets && newSets.length) {
|
|
117
119
|
filteredSets.push({
|
|
118
|
-
'release_type':
|
|
120
|
+
'release_type': release_type,
|
|
119
121
|
'sets': newSets
|
|
120
122
|
})
|
|
121
123
|
}
|
|
@@ -138,6 +140,7 @@ export const useCollectibleGameSets = props => {
|
|
|
138
140
|
filteredCollectibleGameSets,
|
|
139
141
|
categoryUrlSuffix,
|
|
140
142
|
categoryUrlKey,
|
|
141
|
-
productType
|
|
143
|
+
productType,
|
|
144
|
+
availableGroups
|
|
142
145
|
};
|
|
143
146
|
};
|