gatsby-core-theme 28.0.2 → 28.0.4

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/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ ## [28.0.4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v28.0.3...v28.0.4) (2023-08-28)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * issearchPath helper ([d7d0d52](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d7d0d52c08a9b65b31759a1d6343b69ce014b67b))
7
+
8
+ ## [28.0.3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v28.0.2...v28.0.3) (2023-08-28)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * added translations ([cc10ed3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/cc10ed37d43e4efa1b269c6c87ea77e639af16bb))
14
+ * archive buttons translations ([5929177](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/59291770f76274c090fef607f60da1d196473f44))
15
+ * update search module ([d91edad](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d91edadb13dde8da16bb03e701a21fb9ffc343ce))
16
+
17
+
18
+ * Merge branch 'tm-3533-enable-search-for-multiple-market' into 'master' ([8e97e7f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/8e97e7fa1357c4ba9baa3a65744b038ef6729e06))
19
+ * Merge branch 'tm-3642-pagination-translations' into 'master' ([7664773](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/76647734b8de7da16bb1a2b91bfc4d8ef19db18c))
20
+
1
21
  ## [28.0.2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v28.0.1...v28.0.2) (2023-08-24)
2
22
 
3
23
 
package/gatsby-node.mjs CHANGED
@@ -7,8 +7,8 @@
7
7
  import loadash from 'lodash/index.js';
8
8
  import chalk from 'chalk';
9
9
  import fs from 'fs';
10
- import { dirname } from "path"
11
- import { fileURLToPath } from "url"
10
+ import { dirname } from 'path';
11
+ import { fileURLToPath } from 'url';
12
12
  import { getData, getLocalData } from './src/helpers/api.mjs';
13
13
 
14
14
  import { generateTrackerLink } from './src/helpers/generators.mjs';
@@ -17,8 +17,7 @@ import { pickAuthorsPageKeys } from './src/constants/pick-keys.mjs';
17
17
  import { translate } from './src/helpers/getters.mjs';
18
18
  import { groupBy } from './src/helpers/processor/common.mjs';
19
19
 
20
-
21
- const __dirname = dirname(fileURLToPath(import.meta.url))
20
+ const __dirname = dirname(fileURLToPath(import.meta.url));
22
21
  const { cloneDeep, chunk, pick } = loadash;
23
22
 
24
23
  const isPreview = process.env.GATSBY_PREVIEW_MODE === 'true';
@@ -85,7 +84,11 @@ function createArchivePage(pageObject, marketSections, prefilledModules, createP
85
84
  page.path = pageObject.path;
86
85
  break;
87
86
  default:
88
- page.path = `${pageObject.path}/page/${archive.currentPage}`;
87
+ page.path = `${pageObject.path}/${translate(
88
+ translations,
89
+ 'archive_page_path',
90
+ 'page'
91
+ )}/${archive.currentPage}`;
89
92
  page.meta_title += translate(
90
93
  translations,
91
94
  'archive_title_suffix',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "28.0.2",
3
+ "version": "28.0.4",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -1,9 +1,10 @@
1
- import React, { useEffect } from 'react';
1
+ import React, { useEffect, useContext } from 'react';
2
2
  import PropTypes from 'prop-types';
3
-
3
+ import { translate } from '~helpers/getters';
4
4
  import Link from '~hooks/link';
5
5
  import styles from './pagination.module.scss';
6
6
  import keygen from '~helpers/keygen';
7
+ import { Context } from '~context/MainProvider';
7
8
 
8
9
  const Pagination = ({
9
10
  currentPage = 1,
@@ -16,10 +17,12 @@ const Pagination = ({
16
17
  anchorLabel,
17
18
  }) => {
18
19
  const numOfItemsEachSide = Math.ceil(numOfItems / 2);
19
-
20
+ const { translations } = useContext(Context) || {};
20
21
  function getPagePath(index) {
21
22
  return (
22
- (index === 1 ? pagePath : `${pagePath}/page/${index}`) +
23
+ (index === 1
24
+ ? pagePath
25
+ : `${pagePath}/${translate(translations, 'archive_page_path', 'page')}/${index}`) +
23
26
  (anchorLabel ? `#${anchorLabel}` : '')
24
27
  );
25
28
  }
@@ -59,8 +62,12 @@ const Pagination = ({
59
62
  {/* previous button */}
60
63
  {currentPage !== 1 && (
61
64
  <li>
62
- <Link to={getPagePath(currentPage - 1)} className="pagination-gtm">
63
- {previousText}
65
+ <Link
66
+ to={getPagePath(currentPage - 1)}
67
+ className="pagination-gtm"
68
+ aria-label={translate(translations, 'archive_previous_button', previousText)}
69
+ >
70
+ {translate(translations, 'archive_previous_button', previousText)}
64
71
  </Link>
65
72
  </li>
66
73
  )}
@@ -87,8 +94,12 @@ const Pagination = ({
87
94
  {/* next button */}
88
95
  {currentPage < totalPages && (
89
96
  <li>
90
- <Link to={getPagePath(currentPage + 1)} className="pagination-gtm">
91
- {nextText}
97
+ <Link
98
+ to={getPagePath(currentPage + 1)}
99
+ className="pagination-gtm"
100
+ aria-label={translate(translations, 'archive_next_button', nextText)}
101
+ >
102
+ {translate(translations, 'archive_next_button', nextText)}
92
103
  </Link>
93
104
  </li>
94
105
  )}
@@ -25,7 +25,9 @@ const PaginationWithMidPoints = ({
25
25
  const total = Number(totalPages);
26
26
  function getPagePath(index) {
27
27
  return (
28
- (index === 1 ? pagePath : `${pagePath}/page/${index}`) +
28
+ (index === 1
29
+ ? pagePath
30
+ : `${pagePath}/${translate(translations, 'archive_page_path', 'page')}/${index}`) +
29
31
  (anchorLabel ? `#${anchorLabel}` : '')
30
32
  );
31
33
  }
@@ -47,7 +49,7 @@ const PaginationWithMidPoints = ({
47
49
  <Link
48
50
  to={getPagePath(1)}
49
51
  className={`${styles.button || ''} ${styles.isActive || ''} pagination-gtm`}
50
- aria-label="Go to First Page"
52
+ aria-label={translate(translations, 'archive_go_to_first_page', 'Go to first page')}
51
53
  >
52
54
  {firstComp}
53
55
  </Link>
@@ -61,7 +63,7 @@ const PaginationWithMidPoints = ({
61
63
  <Link
62
64
  to={getPagePath(current - 1)}
63
65
  className={`${styles.button || ''} ${styles.isActive || ''} pagination-gtm`}
64
- aria-label="Previous Button"
66
+ aria-label={translate(translations, 'archive_previous_button', 'Previous Button')}
65
67
  >
66
68
  {previousComp}
67
69
  </Link>
@@ -145,7 +147,7 @@ const PaginationWithMidPoints = ({
145
147
  <Link
146
148
  to={getPagePath(current + 1)}
147
149
  className={`${styles.button || ''} ${styles.isActive || ''} pagination-gtm`}
148
- aria-label="Next Button"
150
+ aria-label={translate(translations, 'archive_next_button', 'Next Button')}
149
151
  >
150
152
  {nextComp}
151
153
  </Link>
@@ -159,7 +161,7 @@ const PaginationWithMidPoints = ({
159
161
  <Link
160
162
  to={getPagePath(total)}
161
163
  className={`${styles.button || ''} ${styles.isActive || ''} pagination-gtm`}
162
- aria-label="Go to Last"
164
+ aria-label={translate(translations, 'archive_go_to_last_page', 'Go to Last')}
163
165
  >
164
166
  {lastComp}
165
167
  </Link>
@@ -179,6 +181,7 @@ PaginationWithMidPoints.propTypes = {
179
181
  previousComp: PropTypes.oneOfType([PropTypes.element, PropTypes.any]),
180
182
  firstComp: PropTypes.oneOfType([PropTypes.element, PropTypes.any]),
181
183
  lastComp: PropTypes.oneOfType([PropTypes.element, PropTypes.any]),
184
+ anchorLabel: PropTypes.string,
182
185
  };
183
186
 
184
187
  export default PaginationWithMidPoints;
@@ -81,19 +81,19 @@ const Search = ({
81
81
  const types = getChildrenTypes();
82
82
  let filteredResults = [];
83
83
 
84
- searchResultsRef.current.forEach((object) => {
85
- if (object.relation && object.relation.market === pageContext.page?.market) {
86
- filteredResults = [
87
- ...filteredResults,
88
- ...searchResultsRef.current.filter(filterByKey('id', object.id)),
89
- ];
90
- }
91
- });
92
-
93
84
  types.forEach((type) => {
94
85
  filteredResults = [
95
86
  ...filteredResults,
96
- ...searchResultsRef.current.filter(filterByKey('type', type)),
87
+ ...searchResultsRef.current.filter((object) => {
88
+ if (
89
+ object.relation &&
90
+ object.relation.market === pageContext.page?.market &&
91
+ object.type === type
92
+ ) {
93
+ return true;
94
+ }
95
+ return false;
96
+ }),
97
97
  ];
98
98
  });
99
99
 
@@ -7,9 +7,10 @@ import { translate } from '~helpers/getters';
7
7
 
8
8
  const SearchContent = ({ page }) => {
9
9
  const Search = loadable(() => import('~molecules/search'));
10
-
10
+ const searchURLPageName = page.path;
11
11
  return (
12
12
  <Search
13
+ searchURLPageName={searchURLPageName}
13
14
  page={page}
14
15
  pageSearchOptions={{
15
16
  useArchive: true,
@@ -1,7 +1,7 @@
1
1
  // eslint-disable-next-line import/prefer-default-export
2
2
  export const isSearchPath = (allMarkets, pagePath) => {
3
3
  if (!allMarkets) {
4
- return [];
4
+ return false;
5
5
  }
6
6
 
7
7
  const marketKeys = Object.keys(allMarkets);
@@ -39,7 +39,7 @@ describe('isSearchPath', () => {
39
39
 
40
40
  const result = isSearchPath(allMarkets);
41
41
 
42
- expect(result).toEqual([]);
42
+ expect(result).toEqual(false);
43
43
  });
44
44
 
45
45
  it('should return false if pagePath is null or empty', () => {