@riosst100/pwa-marketplace 1.4.8 → 1.5.0
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 +48 -7
- package/src/components/FilterTop/CustomFilters/customFilters.js +0 -12
- package/src/intercept.js +1 -1
- package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.js +1 -1
- package/src/talons/CollectibleGameSets/collectibleGameSets.gql.js +11 -6
- package/src/talons/CollectibleGameSets/useCollectibleGameSets.js +12 -5
package/package.json
CHANGED
|
@@ -4,11 +4,13 @@ import { useSeller } from '@riosst100/pwa-marketplace/src/talons/Seller/useSelle
|
|
|
4
4
|
import ErrorView from '@magento/venia-ui/lib/components/ErrorView';
|
|
5
5
|
import { StoreTitle, Meta } from '@magento/venia-ui/lib/components/Head';
|
|
6
6
|
import { useCollectibleGameSets } from '@riosst100/pwa-marketplace/src/talons/CollectibleGameSets/useCollectibleGameSets';
|
|
7
|
+
import { Link } from 'react-router-dom';
|
|
8
|
+
import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
|
|
7
9
|
|
|
8
10
|
const CollectibleGameSets = props => {
|
|
9
11
|
const talonProps = useCollectibleGameSets();
|
|
10
12
|
|
|
11
|
-
const { error, loading, collectibleGameSets } = talonProps;
|
|
13
|
+
const { error, loading, collectibleGameSets, categoryUrlSuffix, categoryUrlKey, productType } = talonProps;
|
|
12
14
|
|
|
13
15
|
if (loading && !collectibleGameSets)
|
|
14
16
|
return '';
|
|
@@ -28,21 +30,60 @@ const CollectibleGameSets = props => {
|
|
|
28
30
|
);
|
|
29
31
|
}
|
|
30
32
|
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
+
const setsLengthArr = [];
|
|
34
|
+
|
|
35
|
+
const setRelases = collectibleGameSets.map((setRelease, index) => {
|
|
36
|
+
const { release_type, sets } = setRelease;
|
|
37
|
+
|
|
38
|
+
const setsResult = [];
|
|
39
|
+
|
|
40
|
+
setsLengthArr[release_type] = sets.length
|
|
41
|
+
|
|
42
|
+
if (sets.length) {
|
|
43
|
+
sets.map((set, index) => {
|
|
44
|
+
const { set_name, option_id, set_abbreviation } = set;
|
|
45
|
+
|
|
46
|
+
const categoryUrl = resourceUrl(
|
|
47
|
+
`/games/collectible-game/${categoryUrlKey}${categoryUrlSuffix || ''}?card_set[filter]=${set_name},${option_id}`
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
setsResult.push(
|
|
51
|
+
<li>
|
|
52
|
+
<Link to={categoryUrl}>{set_name} <small style={{"color":"grey"}}>{set_abbreviation}</small></Link>
|
|
53
|
+
</li>
|
|
54
|
+
);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
33
58
|
return (
|
|
34
59
|
<>
|
|
35
|
-
<div
|
|
60
|
+
<div id={"#tab_list_"+release_type.toLowerCase()}>
|
|
61
|
+
<div className='text-[16px] pb-2'><b>{release_type}</b></div>
|
|
62
|
+
<hr />
|
|
63
|
+
<ul className='pt-2'>{setsResult}</ul>
|
|
64
|
+
</div>
|
|
36
65
|
</>
|
|
37
66
|
);
|
|
38
67
|
});
|
|
39
68
|
|
|
69
|
+
const 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'];
|
|
40
70
|
|
|
41
71
|
return (
|
|
42
72
|
<Fragment>
|
|
43
|
-
<StoreTitle>Magic: The Gathering | Sets & Expansions</StoreTitle>
|
|
44
|
-
<
|
|
45
|
-
|
|
73
|
+
<StoreTitle>{"Magic: The Gathering" + " | " + (productType == "sealed-products" ? "Sets & Expansions" : "Singles Sets")}</StoreTitle>
|
|
74
|
+
<div className='text-[20px] pb-4 pt-5'><b>{productType == "sealed-products" ? "Sets & Expansions" : "Singles Sets"}</b></div>
|
|
75
|
+
{productType != "sealed-products" ? (
|
|
76
|
+
<>
|
|
77
|
+
<div className='flex flex-wrap mb-3'>
|
|
78
|
+
{alpha.map((val, index) =>
|
|
79
|
+
setsLengthArr[val] > 0 ? (
|
|
80
|
+
<a className="py-2 px-3 font-bold mr-1 border" href={"#tab_list_"+val.toLowerCase()}>{val}</a>
|
|
81
|
+
) : (<span className="py-2 px-3 font-bold mr-1 border" style={{"color":"grey"}}>{val}</span>)
|
|
82
|
+
)}
|
|
83
|
+
</div>
|
|
84
|
+
</>
|
|
85
|
+
) : ''}
|
|
86
|
+
<div className='flex flex-wrap gap-[30px]'>{setRelases}</div>
|
|
46
87
|
</Fragment>
|
|
47
88
|
);
|
|
48
89
|
};
|
|
@@ -18,15 +18,8 @@ const CustomFilters = props => {
|
|
|
18
18
|
|
|
19
19
|
const { customFiltersData, categoryUrlSuffix, search, pathname } = talonProps;
|
|
20
20
|
|
|
21
|
-
// console.log(category.url_path)
|
|
22
|
-
// console.log(categoryUrlSuffix)
|
|
23
|
-
|
|
24
21
|
const params = search ? JSON.parse('{"' + decodeURI(search).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g,'":"') + '"}') : {};
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
// console.log(params)
|
|
29
|
-
|
|
30
23
|
// create elements and params at the same time for efficiency
|
|
31
24
|
const filterElements = useMemo(() => {
|
|
32
25
|
const elements = [];
|
|
@@ -56,11 +49,6 @@ const CustomFilters = props => {
|
|
|
56
49
|
}
|
|
57
50
|
|
|
58
51
|
const finalParams = params ? Object.keys(params).map(key => `${key}=${params[key]}`).join('&') : '';
|
|
59
|
-
|
|
60
|
-
// console.log(params)
|
|
61
|
-
|
|
62
|
-
// console.log(finalParams);
|
|
63
|
-
|
|
64
52
|
const path = pathname + finalParams;
|
|
65
53
|
|
|
66
54
|
items.push(
|
package/src/intercept.js
CHANGED
|
@@ -99,7 +99,7 @@ module.exports = targets => {
|
|
|
99
99
|
{
|
|
100
100
|
exact: true,
|
|
101
101
|
name: "CollectibleGameSetsPage",
|
|
102
|
-
pattern: "/games/collectible-game/:urlKey
|
|
102
|
+
pattern: "/games/collectible-game/:urlKey/:productType",
|
|
103
103
|
path: require.resolve("./components/CollectibleGameSetsPage/index.js"),
|
|
104
104
|
authed: false,
|
|
105
105
|
},
|
|
@@ -186,7 +186,7 @@ const CategoryContent = props => {
|
|
|
186
186
|
</h1>
|
|
187
187
|
{categoryDescriptionElement}
|
|
188
188
|
</div>
|
|
189
|
-
<SubCategory filters={filters} children={children} />
|
|
189
|
+
{/* <SubCategory filters={filters} children={children} /> */}
|
|
190
190
|
<FilterTop filters={filters} category={category} />
|
|
191
191
|
{/* <AttributesBlock category={category} attributesBlock={attributesBlock} /> */}
|
|
192
192
|
{/* <section className='category_brand-slider my-5'>
|
|
@@ -6,17 +6,22 @@ export const GET_STORE_CONFIG_DATA = gql`
|
|
|
6
6
|
storeConfig {
|
|
7
7
|
store_code
|
|
8
8
|
product_url_suffix
|
|
9
|
+
category_url_suffix
|
|
9
10
|
}
|
|
10
11
|
}
|
|
11
12
|
`;
|
|
12
13
|
|
|
13
14
|
export const GET_COLLECTIBLE_GAME_QUERY = gql`
|
|
14
|
-
query getCollectibleGameSets($categoryUrlKey: String
|
|
15
|
-
collectibleGameSets(categoryUrlKey: $categoryUrlKey) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
query getCollectibleGameSets($categoryUrlKey: String!, $productType: String) {
|
|
16
|
+
collectibleGameSets(categoryUrlKey: $categoryUrlKey, productType: $productType) {
|
|
17
|
+
release_type
|
|
18
|
+
sets {
|
|
19
|
+
set_name
|
|
20
|
+
option_id
|
|
21
|
+
set_abbreviation
|
|
22
|
+
release_date
|
|
23
|
+
release_number
|
|
24
|
+
}
|
|
20
25
|
}
|
|
21
26
|
}
|
|
22
27
|
`;
|
|
@@ -23,16 +23,20 @@ export const useCollectibleGameSets = props => {
|
|
|
23
23
|
nextFetchPolicy: 'cache-first'
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
const categoryUrlKey =
|
|
26
|
+
const pathnameArr = pathname.split('/');
|
|
27
|
+
|
|
28
|
+
const categoryUrlKey = pathnameArr[pathnameArr.length - 2];
|
|
29
|
+
const productType = pathnameArr[pathnameArr.length - 1];
|
|
30
|
+
|
|
31
|
+
const categoryUrlSuffix = storeConfigData?.storeConfig?.category_url_suffix;
|
|
29
32
|
|
|
30
33
|
const { error, loading, data } = useQuery(getCollectibleGameQuery, {
|
|
31
34
|
fetchPolicy: 'cache-and-network',
|
|
32
35
|
nextFetchPolicy: 'cache-first',
|
|
33
36
|
skip: !storeConfigData,
|
|
34
37
|
variables: {
|
|
35
|
-
categoryUrlKey
|
|
38
|
+
categoryUrlKey: categoryUrlKey,
|
|
39
|
+
productType: productType
|
|
36
40
|
}
|
|
37
41
|
});
|
|
38
42
|
|
|
@@ -60,6 +64,9 @@ export const useCollectibleGameSets = props => {
|
|
|
60
64
|
return {
|
|
61
65
|
error,
|
|
62
66
|
loading,
|
|
63
|
-
collectibleGameSets
|
|
67
|
+
collectibleGameSets,
|
|
68
|
+
categoryUrlSuffix,
|
|
69
|
+
categoryUrlKey,
|
|
70
|
+
productType
|
|
64
71
|
};
|
|
65
72
|
};
|