@riosst100/pwa-marketplace 1.4.9 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@riosst100/pwa-marketplace",
3
3
  "author": "riosst100@gmail.com",
4
- "version": "1.4.9",
4
+ "version": "1.5.0",
5
5
  "main": "src/index.js",
6
6
  "pwa-studio": {
7
7
  "targets": {
@@ -10,7 +10,7 @@ import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
10
10
  const CollectibleGameSets = props => {
11
11
  const talonProps = useCollectibleGameSets();
12
12
 
13
- const { error, loading, collectibleGameSets, categoryUrlSuffix, categoryUrlKey } = talonProps;
13
+ const { error, loading, collectibleGameSets, categoryUrlSuffix, categoryUrlKey, productType } = talonProps;
14
14
 
15
15
  if (loading && !collectibleGameSets)
16
16
  return '';
@@ -30,14 +30,18 @@ const CollectibleGameSets = props => {
30
30
  );
31
31
  }
32
32
 
33
+ const setsLengthArr = [];
34
+
33
35
  const setRelases = collectibleGameSets.map((setRelease, index) => {
34
36
  const { release_type, sets } = setRelease;
35
37
 
36
38
  const setsResult = [];
37
39
 
40
+ setsLengthArr[release_type] = sets.length
41
+
38
42
  if (sets.length) {
39
43
  sets.map((set, index) => {
40
- const { set_name, option_id } = set;
44
+ const { set_name, option_id, set_abbreviation } = set;
41
45
 
42
46
  const categoryUrl = resourceUrl(
43
47
  `/games/collectible-game/${categoryUrlKey}${categoryUrlSuffix || ''}?card_set[filter]=${set_name},${option_id}`
@@ -45,7 +49,7 @@ const CollectibleGameSets = props => {
45
49
 
46
50
  setsResult.push(
47
51
  <li>
48
- <Link to={categoryUrl}>{set_name}</Link>
52
+ <Link to={categoryUrl}>{set_name} <small style={{"color":"grey"}}>{set_abbreviation}</small></Link>
49
53
  </li>
50
54
  );
51
55
  });
@@ -53,7 +57,7 @@ const CollectibleGameSets = props => {
53
57
 
54
58
  return (
55
59
  <>
56
- <div>
60
+ <div id={"#tab_list_"+release_type.toLowerCase()}>
57
61
  <div className='text-[16px] pb-2'><b>{release_type}</b></div>
58
62
  <hr />
59
63
  <ul className='pt-2'>{setsResult}</ul>
@@ -62,11 +66,23 @@ const CollectibleGameSets = props => {
62
66
  );
63
67
  });
64
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'];
65
70
 
66
71
  return (
67
72
  <Fragment>
68
- <StoreTitle>Magic: The Gathering | Sets & Expansions</StoreTitle>
69
- <div className='text-[20px] pb-4 pt-5'><b>Sets & Expansions</b></div>
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
+ ) : ''}
70
86
  <div className='flex flex-wrap gap-[30px]'>{setRelases}</div>
71
87
  </Fragment>
72
88
  );
@@ -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(
@@ -12,8 +12,8 @@ export const GET_STORE_CONFIG_DATA = gql`
12
12
  `;
13
13
 
14
14
  export const GET_COLLECTIBLE_GAME_QUERY = gql`
15
- query getCollectibleGameSets($categoryUrlKey: String!) {
16
- collectibleGameSets(categoryUrlKey: $categoryUrlKey) {
15
+ query getCollectibleGameSets($categoryUrlKey: String!, $productType: String) {
16
+ collectibleGameSets(categoryUrlKey: $categoryUrlKey, productType: $productType) {
17
17
  release_type
18
18
  sets {
19
19
  set_name
@@ -26,18 +26,17 @@ export const useCollectibleGameSets = props => {
26
26
  const pathnameArr = pathname.split('/');
27
27
 
28
28
  const categoryUrlKey = pathnameArr[pathnameArr.length - 2];
29
-
30
- const slug = pathname.split('/').pop();
31
- const productUrlSuffix = storeConfigData?.storeConfig?.product_url_suffix;
29
+ const productType = pathnameArr[pathnameArr.length - 1];
30
+
32
31
  const categoryUrlSuffix = storeConfigData?.storeConfig?.category_url_suffix;
33
- // const categoryUrlKey = productUrlSuffix ? slug.replace(productUrlSuffix, '') : slug;
34
32
 
35
33
  const { error, loading, data } = useQuery(getCollectibleGameQuery, {
36
34
  fetchPolicy: 'cache-and-network',
37
35
  nextFetchPolicy: 'cache-first',
38
36
  skip: !storeConfigData,
39
37
  variables: {
40
- categoryUrlKey
38
+ categoryUrlKey: categoryUrlKey,
39
+ productType: productType
41
40
  }
42
41
  });
43
42
 
@@ -67,6 +66,7 @@ export const useCollectibleGameSets = props => {
67
66
  loading,
68
67
  collectibleGameSets,
69
68
  categoryUrlSuffix,
70
- categoryUrlKey
69
+ categoryUrlKey,
70
+ productType
71
71
  };
72
72
  };