@riosst100/pwa-marketplace 1.4.8 → 1.4.9

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