@riosst100/pwa-marketplace 2.3.3 → 2.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/FilterTop/FilterBlockList/filterTopItem.js +4 -1
- package/src/components/ProductContent/index.js +1 -0
- package/src/components/ProductContent/productContent.js +240 -0
- package/src/components/SellerDetail/sellerDetail.js +1 -1
- package/src/components/SellerProducts/productContent.js +238 -0
- package/src/components/SellerProducts/sellerProducts.js +109 -46
- package/src/components/ShopBySets/shopBySets.js +2 -2
- package/src/overwrites/peregrine/lib/talons/RootComponents/Category/categoryContent.gql.js +26 -3
- package/src/overwrites/peregrine/lib/talons/RootComponents/Category/useCategory.js +3 -3
- package/src/overwrites/peregrine/lib/talons/RootComponents/Category/useCategoryContent.js +78 -6
- package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.js +6 -0
- package/src/overwrites/venia-ui/lib/components/FilterSidebar/filterSidebar.js +28 -20
- package/src/talons/CollectibleGameSets/useCollectibleGameSets.js +2 -2
- package/src/talons/ProductContent/index.js +1 -0
- package/src/talons/ProductContent/productContent.gql.js +98 -0
- package/src/talons/ProductContent/useProductContent.js +192 -0
- package/src/talons/SellerProducts/categoryFragments.gql.js +103 -0
- package/src/talons/SellerProducts/index.js +2 -0
- package/src/talons/SellerProducts/productContent.gql.js +98 -0
- package/src/talons/SellerProducts/sellerProducts.gql.js +63 -0
- package/src/talons/SellerProducts/useProductContent.js +194 -0
- package/src/talons/SellerProducts/useSellerProducts.js +264 -0
- package/src/talons/SetsData/useSetsData.js +2 -2
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ import { Link } from 'react-router-dom';
|
|
|
5
5
|
|
|
6
6
|
const FilterTopItem = props => {
|
|
7
7
|
const { setFilterBy, filterBy, filterApi, group, item, onApply, labels, activeFilters, search } = props;
|
|
8
|
-
const { removeGroup, toggleItem } = filterApi;
|
|
8
|
+
const { removeGroup, toggleItem, clear } = filterApi;
|
|
9
9
|
const { title, value } = item;
|
|
10
10
|
|
|
11
11
|
const classes = useStyle(defaultClasses, props.classes);
|
|
@@ -14,8 +14,11 @@ const FilterTopItem = props => {
|
|
|
14
14
|
|
|
15
15
|
const handleOnchange = useCallback(
|
|
16
16
|
e => {
|
|
17
|
+
filterApi.clear();
|
|
18
|
+
|
|
17
19
|
if (group != "category_uid") {
|
|
18
20
|
removeGroup({ group });
|
|
21
|
+
// clear();
|
|
19
22
|
if (e === item.value) {
|
|
20
23
|
toggleItem({ group, item });
|
|
21
24
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './productContent';
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import React, { useRef, Suspense, useState, useMemo, Fragment } from 'react';
|
|
2
|
+
import ProductItem from '@riosst100/pwa-marketplace/src/components/ProductItem';
|
|
3
|
+
import Filter from '@riosst100/pwa-marketplace/src/components/Filter';
|
|
4
|
+
import Search from '@riosst100/pwa-marketplace/src/components/Search';
|
|
5
|
+
import SortBy from '@riosst100/pwa-marketplace/src/components/SortBy';
|
|
6
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
7
|
+
import { Link } from "react-router-dom";
|
|
8
|
+
import { FilterSidebarShimmer } from '@magento/venia-ui/lib/components/FilterSidebar';
|
|
9
|
+
import { useIsInViewport } from '@magento/peregrine/lib/hooks/useIsInViewport';
|
|
10
|
+
import defaultClasses from '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/RootComponents/Category/category.module.css';
|
|
11
|
+
import { useProductContent } from '@riosst100/pwa-marketplace/src/talons/ProductContent';
|
|
12
|
+
import cn from 'classnames';
|
|
13
|
+
import ProductListTab, { ProductListTabShimmer } from '@riosst100/pwa-marketplace/src/components/ProductListTab';
|
|
14
|
+
import FilterModalOpenButton, {
|
|
15
|
+
FilterModalOpenButtonShimmer
|
|
16
|
+
} from '@magento/venia-ui/lib/components/FilterModalOpenButton';
|
|
17
|
+
import ProductSort, { ProductSortShimmer } from '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/ProductSort';
|
|
18
|
+
import SortedByContainer, {
|
|
19
|
+
SortedByContainerShimmer
|
|
20
|
+
} from '@magento/venia-ui/lib/components/SortedByContainer';
|
|
21
|
+
import Shimmer from '@magento/venia-ui/lib/components/Shimmer';
|
|
22
|
+
import { FormattedMessage } from 'react-intl';
|
|
23
|
+
import NoProductsFound from '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/RootComponents/Category/NoProductsFound';
|
|
24
|
+
import Gallery, { GalleryShimmer } from '@magento/venia-ui/lib/components/Gallery';
|
|
25
|
+
import Pagination from '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/Pagination';
|
|
26
|
+
|
|
27
|
+
const FilterSidebar = React.lazy(() =>
|
|
28
|
+
import('@magento/venia-ui/lib/components/FilterSidebar')
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const ProductContent = props => {
|
|
32
|
+
const {
|
|
33
|
+
categoryId,
|
|
34
|
+
data,
|
|
35
|
+
pageControl,
|
|
36
|
+
sortProps,
|
|
37
|
+
isLoading,
|
|
38
|
+
pageSize
|
|
39
|
+
} = props;
|
|
40
|
+
|
|
41
|
+
const [currentSort] = sortProps;
|
|
42
|
+
|
|
43
|
+
const [activeTab, setActiveTab] = useState('all');
|
|
44
|
+
const [activeLetter, setActiveLetter] = useState('all')
|
|
45
|
+
|
|
46
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
47
|
+
|
|
48
|
+
const sidebarRef = useRef(null);
|
|
49
|
+
|
|
50
|
+
const shouldRenderSidebarContent = useIsInViewport({
|
|
51
|
+
elementRef: sidebarRef
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const talonProps = useProductContent({
|
|
55
|
+
categoryId,
|
|
56
|
+
data,
|
|
57
|
+
pageSize
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const {
|
|
61
|
+
availableSortMethods,
|
|
62
|
+
filters,
|
|
63
|
+
items,
|
|
64
|
+
totalPagesFromData
|
|
65
|
+
} = talonProps;
|
|
66
|
+
|
|
67
|
+
const shouldShowFilterButtons = filters && filters.length;
|
|
68
|
+
const shouldShowFilterShimmer = filters === null;
|
|
69
|
+
|
|
70
|
+
// console.log('shouldShowFilterButtons')
|
|
71
|
+
// console.log(shouldShowFilterButtons)
|
|
72
|
+
|
|
73
|
+
// console.log('filters')
|
|
74
|
+
// console.log(filters)
|
|
75
|
+
|
|
76
|
+
const sidebar = shouldShowFilterButtons ? (
|
|
77
|
+
<FilterSidebar hideFilters={false} children={[]} filters={filters} allowedFilters={[]} />
|
|
78
|
+
) : shouldShowFilterShimmer ? (
|
|
79
|
+
<FilterSidebarShimmer />
|
|
80
|
+
) : null;
|
|
81
|
+
|
|
82
|
+
const shouldShowProductListTabShimmer = !totalPagesFromData && isLoading;
|
|
83
|
+
|
|
84
|
+
const maybeProductsTabContainer = !isLoading ? (
|
|
85
|
+
<ProductListTab filters={filters} activeTab={activeTab} setActiveTab={setActiveTab} />
|
|
86
|
+
) : shouldShowProductListTabShimmer ? (
|
|
87
|
+
<ProductListTabShimmer />
|
|
88
|
+
) : null;
|
|
89
|
+
|
|
90
|
+
const maybeFilterButtons = shouldShowFilterButtons ? (
|
|
91
|
+
<FilterModalOpenButton filters={filters} />
|
|
92
|
+
) : shouldShowFilterShimmer ? (
|
|
93
|
+
<FilterModalOpenButtonShimmer />
|
|
94
|
+
) : null;
|
|
95
|
+
|
|
96
|
+
const shouldShowSortButtons = totalPagesFromData && availableSortMethods;
|
|
97
|
+
const shouldShowSortShimmer = !totalPagesFromData && isLoading;
|
|
98
|
+
|
|
99
|
+
const maybeSortButton = shouldShowSortButtons ? (
|
|
100
|
+
<ProductSort
|
|
101
|
+
sortProps={sortProps}
|
|
102
|
+
availableSortMethods={availableSortMethods}
|
|
103
|
+
/>
|
|
104
|
+
) : shouldShowSortShimmer ? (
|
|
105
|
+
<ProductSortShimmer />
|
|
106
|
+
) : null;
|
|
107
|
+
|
|
108
|
+
const maybeSortContainer = shouldShowSortButtons ? (
|
|
109
|
+
<SortedByContainer currentSort={currentSort} />
|
|
110
|
+
) : shouldShowSortShimmer ? (
|
|
111
|
+
<SortedByContainerShimmer />
|
|
112
|
+
) : null;
|
|
113
|
+
|
|
114
|
+
const galleryItems = [];
|
|
115
|
+
|
|
116
|
+
useMemo(() => {
|
|
117
|
+
items && items.map((item, index) => {
|
|
118
|
+
if (item) {
|
|
119
|
+
let firstLetter = null;
|
|
120
|
+
|
|
121
|
+
const { custom_attributes } = item;
|
|
122
|
+
if (custom_attributes) {
|
|
123
|
+
let cardName = '';
|
|
124
|
+
custom_attributes.some((attribute, index) => {
|
|
125
|
+
const { attribute_metadata, entered_attribute_value, selected_attribute_options } = attribute
|
|
126
|
+
if (attribute_metadata.code == "card_name") {
|
|
127
|
+
cardName = selected_attribute_options.attribute_option[0].label;
|
|
128
|
+
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return false;
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
if (cardName) {
|
|
136
|
+
firstLetter = cardName.charAt(0).toUpperCase();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (activeLetter == "all" || activeLetter != "all" && firstLetter == activeLetter) {
|
|
141
|
+
return galleryItems.push(item);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}),
|
|
145
|
+
[items, activeLetter, activeTab]
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
const categoryResultsHeading =
|
|
149
|
+
galleryItems.length > 0 ? (
|
|
150
|
+
<FormattedMessage
|
|
151
|
+
id={'categoryContent.resultCount'}
|
|
152
|
+
values={{
|
|
153
|
+
count: galleryItems.length
|
|
154
|
+
}}
|
|
155
|
+
defaultMessage={'{count} Results'}
|
|
156
|
+
/>
|
|
157
|
+
) : isLoading ? (
|
|
158
|
+
<Shimmer width={5} />
|
|
159
|
+
) : null;
|
|
160
|
+
|
|
161
|
+
const content = useMemo(() => {
|
|
162
|
+
if (!totalPagesFromData && !isLoading) {
|
|
163
|
+
return <NoProductsFound categoryId={categoryId} />;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const gallery = totalPagesFromData ? (
|
|
167
|
+
<Gallery items={galleryItems} activeLetter={activeLetter} />
|
|
168
|
+
) : (
|
|
169
|
+
<GalleryShimmer items={galleryItems} />
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
const pagination = totalPagesFromData ? (
|
|
173
|
+
<Pagination pageControl={pageControl} />
|
|
174
|
+
) : null;
|
|
175
|
+
|
|
176
|
+
return (
|
|
177
|
+
<Fragment>
|
|
178
|
+
<section className={classes.gallery}>{gallery}</section>
|
|
179
|
+
<div className={classes.pagination}>{pagination}</div>
|
|
180
|
+
</Fragment>
|
|
181
|
+
);
|
|
182
|
+
}, [
|
|
183
|
+
categoryId,
|
|
184
|
+
classes.gallery,
|
|
185
|
+
classes.pagination,
|
|
186
|
+
isLoading,
|
|
187
|
+
items,
|
|
188
|
+
pageControl,
|
|
189
|
+
totalPagesFromData,
|
|
190
|
+
activeLetter
|
|
191
|
+
]);
|
|
192
|
+
|
|
193
|
+
return <><span>OK</span></>;
|
|
194
|
+
|
|
195
|
+
return (
|
|
196
|
+
<>
|
|
197
|
+
<div className='w-full mb-[30px]'>
|
|
198
|
+
<div class='flex items-end gap-[40px] px-[30px] py-0 rounded-[6px] border border-solid border-gray-100'>
|
|
199
|
+
<Link to='#' class='px-0 py-[12px] inline-flex items-center gap-[5px] relative flex-[0_0_auto]'>
|
|
200
|
+
<span class='relative w-fit font-medium text-[14px] tracking-[0] leading-[20px] whitespace-nowrap'>Action Figures</span>
|
|
201
|
+
</Link>
|
|
202
|
+
<Link to='#' class='px-0 py-[12px] inline-flex items-center gap-[5px] relative flex-[0_0_auto]'>
|
|
203
|
+
<span class='relative w-fit font-medium text-[14px] tracking-[0] leading-[20px] whitespace-nowrap'>Anime</span>
|
|
204
|
+
</Link>
|
|
205
|
+
</div>
|
|
206
|
+
</div>
|
|
207
|
+
<div className='w-full flex items-start gap-x-[30px]'>
|
|
208
|
+
<div className={classes.contentWrapper}>
|
|
209
|
+
<div ref={sidebarRef} className={classes.sidebar}>
|
|
210
|
+
<Suspense fallback={<FilterSidebarShimmer />}>
|
|
211
|
+
{shouldRenderSidebarContent ? sidebar : null}
|
|
212
|
+
</Suspense>
|
|
213
|
+
</div>
|
|
214
|
+
<div className={classes.categoryContent}>
|
|
215
|
+
<div className={cn(classes.heading)}>
|
|
216
|
+
{maybeProductsTabContainer}
|
|
217
|
+
<div className={classes.headerButtons}>
|
|
218
|
+
{maybeFilterButtons}
|
|
219
|
+
{maybeSortButton}
|
|
220
|
+
</div>
|
|
221
|
+
{maybeSortContainer}
|
|
222
|
+
</div>
|
|
223
|
+
<div className={cn(classes.heading)}>
|
|
224
|
+
<div
|
|
225
|
+
data-cy="CategoryContent-categoryInfo"
|
|
226
|
+
className={classes.categoryInfo}
|
|
227
|
+
>
|
|
228
|
+
{categoryResultsHeading}
|
|
229
|
+
</div>
|
|
230
|
+
</div>
|
|
231
|
+
{content}
|
|
232
|
+
<Suspense fallback={null}>{filtersModal}</Suspense>
|
|
233
|
+
</div>
|
|
234
|
+
</div>
|
|
235
|
+
</div>
|
|
236
|
+
</>
|
|
237
|
+
)
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export default ProductContent;
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import React, { useRef, Suspense, useState, useMemo, Fragment } from 'react';
|
|
2
|
+
import ProductItem from '@riosst100/pwa-marketplace/src/components/ProductItem';
|
|
3
|
+
import Filter from '@riosst100/pwa-marketplace/src/components/Filter';
|
|
4
|
+
import Search from '@riosst100/pwa-marketplace/src/components/Search';
|
|
5
|
+
import SortBy from '@riosst100/pwa-marketplace/src/components/SortBy';
|
|
6
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
7
|
+
import { Link } from "react-router-dom";
|
|
8
|
+
import { FilterSidebarShimmer } from '@magento/venia-ui/lib/components/FilterSidebar';
|
|
9
|
+
import { useIsInViewport } from '@magento/peregrine/lib/hooks/useIsInViewport';
|
|
10
|
+
import defaultClasses from '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/RootComponents/Category/category.module.css';
|
|
11
|
+
import { useProductContent } from '@riosst100/pwa-marketplace/src/talons/SellerProducts';
|
|
12
|
+
import cn from 'classnames';
|
|
13
|
+
import ProductListTab, { ProductListTabShimmer } from '@riosst100/pwa-marketplace/src/components/ProductListTab';
|
|
14
|
+
import FilterModalOpenButton, {
|
|
15
|
+
FilterModalOpenButtonShimmer
|
|
16
|
+
} from '@magento/venia-ui/lib/components/FilterModalOpenButton';
|
|
17
|
+
import ProductSort, { ProductSortShimmer } from '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/ProductSort';
|
|
18
|
+
import SortedByContainer, {
|
|
19
|
+
SortedByContainerShimmer
|
|
20
|
+
} from '@magento/venia-ui/lib/components/SortedByContainer';
|
|
21
|
+
import Shimmer from '@magento/venia-ui/lib/components/Shimmer';
|
|
22
|
+
import { FormattedMessage } from 'react-intl';
|
|
23
|
+
import NoProductsFound from '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/RootComponents/Category/NoProductsFound';
|
|
24
|
+
import Gallery, { GalleryShimmer } from '@magento/venia-ui/lib/components/Gallery';
|
|
25
|
+
import Pagination from '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/Pagination';
|
|
26
|
+
|
|
27
|
+
const FilterSidebar = React.lazy(() =>
|
|
28
|
+
import('@magento/venia-ui/lib/components/FilterSidebar')
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const FilterModal = React.lazy(() => import('@magento/venia-ui/lib/components/FilterModal'));
|
|
32
|
+
|
|
33
|
+
const ProductContent = props => {
|
|
34
|
+
const {
|
|
35
|
+
categoryId,
|
|
36
|
+
data,
|
|
37
|
+
pageControl,
|
|
38
|
+
sortProps,
|
|
39
|
+
isLoading,
|
|
40
|
+
pageSize
|
|
41
|
+
} = props;
|
|
42
|
+
|
|
43
|
+
const [currentSort] = sortProps;
|
|
44
|
+
|
|
45
|
+
const [activeTab, setActiveTab] = useState('all');
|
|
46
|
+
const [activeLetter, setActiveLetter] = useState('all')
|
|
47
|
+
|
|
48
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
49
|
+
|
|
50
|
+
const sidebarRef = useRef(null);
|
|
51
|
+
|
|
52
|
+
const shouldRenderSidebarContent = useIsInViewport({
|
|
53
|
+
elementRef: sidebarRef
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const talonProps = useProductContent({
|
|
57
|
+
categoryId,
|
|
58
|
+
data,
|
|
59
|
+
pageSize
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const {
|
|
63
|
+
availableSortMethods,
|
|
64
|
+
filters,
|
|
65
|
+
items,
|
|
66
|
+
totalPagesFromData
|
|
67
|
+
} = talonProps;
|
|
68
|
+
|
|
69
|
+
const shouldShowFilterButtons = filters && filters.length;
|
|
70
|
+
const shouldShowFilterShimmer = filters === null;
|
|
71
|
+
|
|
72
|
+
const sidebar = shouldShowFilterButtons ? (
|
|
73
|
+
<FilterSidebar hideFilters={false} children={[]} filters={filters} allowedFilters={[]} />
|
|
74
|
+
) : shouldShowFilterShimmer ? (
|
|
75
|
+
<FilterSidebarShimmer />
|
|
76
|
+
) : null;
|
|
77
|
+
|
|
78
|
+
const shouldShowProductListTabShimmer = !totalPagesFromData && isLoading;
|
|
79
|
+
|
|
80
|
+
const maybeProductsTabContainer = !isLoading ? (
|
|
81
|
+
<ProductListTab filters={filters} activeTab={activeTab} setActiveTab={setActiveTab} />
|
|
82
|
+
) : shouldShowProductListTabShimmer ? (
|
|
83
|
+
<ProductListTabShimmer />
|
|
84
|
+
) : null;
|
|
85
|
+
|
|
86
|
+
const maybeFilterButtons = shouldShowFilterButtons ? (
|
|
87
|
+
<FilterModalOpenButton filters={filters} />
|
|
88
|
+
) : shouldShowFilterShimmer ? (
|
|
89
|
+
<FilterModalOpenButtonShimmer />
|
|
90
|
+
) : null;
|
|
91
|
+
|
|
92
|
+
const shouldShowSortButtons = totalPagesFromData && availableSortMethods;
|
|
93
|
+
const shouldShowSortShimmer = !totalPagesFromData && isLoading;
|
|
94
|
+
|
|
95
|
+
const maybeSortButton = shouldShowSortButtons ? (
|
|
96
|
+
<ProductSort
|
|
97
|
+
sortProps={sortProps}
|
|
98
|
+
availableSortMethods={availableSortMethods}
|
|
99
|
+
/>
|
|
100
|
+
) : shouldShowSortShimmer ? (
|
|
101
|
+
<ProductSortShimmer />
|
|
102
|
+
) : null;
|
|
103
|
+
|
|
104
|
+
const maybeSortContainer = shouldShowSortButtons ? (
|
|
105
|
+
<SortedByContainer currentSort={currentSort} />
|
|
106
|
+
) : shouldShowSortShimmer ? (
|
|
107
|
+
<SortedByContainerShimmer />
|
|
108
|
+
) : null;
|
|
109
|
+
|
|
110
|
+
const filtersModal = shouldShowFilterButtons ? (
|
|
111
|
+
<FilterModal filters={filters} />
|
|
112
|
+
) : null;
|
|
113
|
+
|
|
114
|
+
const galleryItems = [];
|
|
115
|
+
|
|
116
|
+
useMemo(() => {
|
|
117
|
+
items && items.map((item, index) => {
|
|
118
|
+
if (item) {
|
|
119
|
+
let firstLetter = null;
|
|
120
|
+
|
|
121
|
+
const { custom_attributes } = item;
|
|
122
|
+
if (custom_attributes) {
|
|
123
|
+
let cardName = '';
|
|
124
|
+
custom_attributes.some((attribute, index) => {
|
|
125
|
+
const { attribute_metadata, entered_attribute_value, selected_attribute_options } = attribute
|
|
126
|
+
if (attribute_metadata.code == "card_name") {
|
|
127
|
+
cardName = selected_attribute_options.attribute_option[0].label;
|
|
128
|
+
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return false;
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
if (cardName) {
|
|
136
|
+
firstLetter = cardName.charAt(0).toUpperCase();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (activeLetter == "all" || activeLetter != "all" && firstLetter == activeLetter) {
|
|
141
|
+
return galleryItems.push(item);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}),
|
|
145
|
+
[items, activeLetter, activeTab]
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
const categoryResultsHeading =
|
|
149
|
+
galleryItems.length > 0 ? (
|
|
150
|
+
<FormattedMessage
|
|
151
|
+
id={'categoryContent.resultCount'}
|
|
152
|
+
values={{
|
|
153
|
+
count: galleryItems.length
|
|
154
|
+
}}
|
|
155
|
+
defaultMessage={'{count} Results'}
|
|
156
|
+
/>
|
|
157
|
+
) : isLoading ? (
|
|
158
|
+
<Shimmer width={5} />
|
|
159
|
+
) : null;
|
|
160
|
+
|
|
161
|
+
const content = useMemo(() => {
|
|
162
|
+
if (!totalPagesFromData && !isLoading) {
|
|
163
|
+
return <NoProductsFound categoryId={categoryId} />;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const gallery = totalPagesFromData ? (
|
|
167
|
+
<Gallery items={galleryItems} activeLetter={activeLetter} />
|
|
168
|
+
) : (
|
|
169
|
+
<GalleryShimmer items={galleryItems} />
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
const pagination = totalPagesFromData ? (
|
|
173
|
+
<Pagination pageControl={pageControl} />
|
|
174
|
+
) : null;
|
|
175
|
+
|
|
176
|
+
return (
|
|
177
|
+
<Fragment>
|
|
178
|
+
<section className={classes.gallery}>{gallery}</section>
|
|
179
|
+
<div className={classes.pagination}>{pagination}</div>
|
|
180
|
+
</Fragment>
|
|
181
|
+
);
|
|
182
|
+
}, [
|
|
183
|
+
categoryId,
|
|
184
|
+
classes.gallery,
|
|
185
|
+
classes.pagination,
|
|
186
|
+
isLoading,
|
|
187
|
+
items,
|
|
188
|
+
pageControl,
|
|
189
|
+
totalPagesFromData,
|
|
190
|
+
activeLetter
|
|
191
|
+
]);
|
|
192
|
+
|
|
193
|
+
return (
|
|
194
|
+
<>
|
|
195
|
+
<div className='w-full mb-[30px]'>
|
|
196
|
+
<div class='flex items-end gap-[40px] px-[30px] py-0 rounded-[6px] border border-solid border-gray-100'>
|
|
197
|
+
<Link to='#' class='px-0 py-[12px] inline-flex items-center gap-[5px] relative flex-[0_0_auto]'>
|
|
198
|
+
<span class='relative w-fit font-medium text-[14px] tracking-[0] leading-[20px] whitespace-nowrap'>Action Figures</span>
|
|
199
|
+
</Link>
|
|
200
|
+
<Link to='#' class='px-0 py-[12px] inline-flex items-center gap-[5px] relative flex-[0_0_auto]'>
|
|
201
|
+
<span class='relative w-fit font-medium text-[14px] tracking-[0] leading-[20px] whitespace-nowrap'>Anime</span>
|
|
202
|
+
</Link>
|
|
203
|
+
</div>
|
|
204
|
+
</div>
|
|
205
|
+
<div className='w-full flex items-start gap-x-[30px]'>
|
|
206
|
+
<div className={classes.contentWrapper}>
|
|
207
|
+
<div ref={sidebarRef} className={classes.sidebar}>
|
|
208
|
+
<Suspense fallback={<FilterSidebarShimmer />}>
|
|
209
|
+
{shouldRenderSidebarContent ? sidebar : null}
|
|
210
|
+
</Suspense>
|
|
211
|
+
</div>
|
|
212
|
+
<div className={classes.categoryContent}>
|
|
213
|
+
<div className={cn(classes.heading)}>
|
|
214
|
+
{maybeProductsTabContainer}
|
|
215
|
+
<div className={classes.headerButtons}>
|
|
216
|
+
{maybeFilterButtons}
|
|
217
|
+
{maybeSortButton}
|
|
218
|
+
</div>
|
|
219
|
+
{maybeSortContainer}
|
|
220
|
+
</div>
|
|
221
|
+
<div className={cn(classes.heading)}>
|
|
222
|
+
<div
|
|
223
|
+
data-cy="CategoryContent-categoryInfo"
|
|
224
|
+
className={classes.categoryInfo}
|
|
225
|
+
>
|
|
226
|
+
{categoryResultsHeading}
|
|
227
|
+
</div>
|
|
228
|
+
</div>
|
|
229
|
+
{content}
|
|
230
|
+
<Suspense fallback={null}>{filtersModal}</Suspense>
|
|
231
|
+
</div>
|
|
232
|
+
</div>
|
|
233
|
+
</div>
|
|
234
|
+
</>
|
|
235
|
+
)
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export default ProductContent;
|
|
@@ -1,47 +1,110 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import { shape, string } from 'prop-types';
|
|
3
|
+
import { useSellerProducts } from '@riosst100/pwa-marketplace/src/talons/SellerProducts';
|
|
4
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
5
|
+
|
|
6
|
+
import ProductContent from './productContent';
|
|
7
|
+
import defaultClasses from '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/RootComponents/Category/category.module.css';
|
|
8
|
+
import { Meta } from '@magento/venia-ui/lib/components/Head';
|
|
9
|
+
import { GET_PAGE_SIZE } from '@magento/venia-ui/lib/RootComponents/Category/category.gql';
|
|
10
|
+
import ErrorView from '@magento/venia-ui/lib/components/ErrorView';
|
|
11
|
+
import { useIntl } from 'react-intl';
|
|
12
|
+
import ShopBy from '@riosst100/pwa-marketplace/src/components/ShopBy/shopBy';
|
|
13
|
+
import SubCategoryPage from '@riosst100/pwa-marketplace/src/components/CustomSubCategoryPage/subCategoryPage';
|
|
14
|
+
import ShopBySets from '@riosst100/pwa-marketplace/src/components/ShopBySets/shopBySets';
|
|
15
|
+
import ShopByCard from '@riosst100/pwa-marketplace/src/components/ShopByCard/shopByCard';
|
|
16
|
+
import { useLocation } from 'react-router-dom';
|
|
17
|
+
import SportCardsSets from '@riosst100/pwa-marketplace/src/components/SportCardsSets/sportCardsSets';
|
|
18
|
+
import NonSportCardsSets from '@riosst100/pwa-marketplace/src/components/NonSportCardsSets/nonSportCardsSets';
|
|
19
|
+
import LegoSets from '@riosst100/pwa-marketplace/src/components/LegoSets/legoSets';
|
|
20
|
+
import TrainsSets from '@riosst100/pwa-marketplace/src/components/TrainsSets/trainsSets';
|
|
21
|
+
import SetsData from '@riosst100/pwa-marketplace/src/components/SetsData/setsData';
|
|
22
|
+
|
|
23
|
+
const MESSAGES = new Map().set(
|
|
24
|
+
'NOT_FOUND',
|
|
25
|
+
"Looks like the category you were hoping to find doesn't exist. Sorry about that."
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const SellerProducts = props => {
|
|
29
|
+
const { sellerId } = props;
|
|
30
|
+
|
|
31
|
+
const uid = null;
|
|
32
|
+
|
|
33
|
+
const { formatMessage } = useIntl();
|
|
34
|
+
|
|
35
|
+
const { location } = globalThis;
|
|
36
|
+
|
|
37
|
+
const query = new URLSearchParams(location.search);
|
|
38
|
+
const shopby = query.get('shopby') || null;
|
|
39
|
+
|
|
40
|
+
const talonProps = useSellerProducts({
|
|
41
|
+
sellerId: sellerId,
|
|
42
|
+
queries: {
|
|
43
|
+
getPageSize: GET_PAGE_SIZE
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const {
|
|
48
|
+
error,
|
|
49
|
+
loading,
|
|
50
|
+
productData,
|
|
51
|
+
pageControl,
|
|
52
|
+
sortProps,
|
|
53
|
+
pageSize,
|
|
54
|
+
categoryNotFound
|
|
55
|
+
} = talonProps;
|
|
56
|
+
|
|
57
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
58
|
+
|
|
59
|
+
if (!productData) {
|
|
60
|
+
if (error && pageControl.currentPage === 1) {
|
|
61
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
62
|
+
console.error(error);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return <ErrorView />;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (categoryNotFound) {
|
|
70
|
+
return (
|
|
71
|
+
<ErrorView
|
|
72
|
+
message={formatMessage({
|
|
73
|
+
id: 'category.notFound',
|
|
74
|
+
defaultMessage: MESSAGES.get('NOT_FOUND')
|
|
75
|
+
})}
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
10
80
|
return (
|
|
11
|
-
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
</>
|
|
44
|
-
)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export default SellerProducts;
|
|
81
|
+
<Fragment>
|
|
82
|
+
<ProductContent
|
|
83
|
+
categoryId={uid}
|
|
84
|
+
sellerId={sellerId}
|
|
85
|
+
classes={classes}
|
|
86
|
+
data={productData?.productsBySellerId}
|
|
87
|
+
shopby={shopby}
|
|
88
|
+
isLoading={loading}
|
|
89
|
+
pageControl={pageControl}
|
|
90
|
+
sortProps={sortProps}
|
|
91
|
+
pageSize={pageSize}
|
|
92
|
+
/>
|
|
93
|
+
</Fragment>
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
SellerProducts.propTypes = {
|
|
98
|
+
classes: shape({
|
|
99
|
+
gallery: string,
|
|
100
|
+
root: string,
|
|
101
|
+
title: string
|
|
102
|
+
}),
|
|
103
|
+
uid: string
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
SellerProducts.defaultProps = {
|
|
107
|
+
uid: 'Mg=='
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export default SellerProducts;
|