gatsby-core-theme 18.0.15 → 18.0.17

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,22 @@
1
+ ## [18.0.17](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v18.0.16...v18.0.17) (2023-02-28)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * event cards ([896f1a6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/896f1a6035d132603495698a7632810ef161179b))
7
+
8
+ ## [18.0.16](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v18.0.15...v18.0.16) (2023-02-27)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * author box bio read more ([e78e5a1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e78e5a1247c8103b500d7ba65dd05057e9a60fd5))
14
+ * cards v2 module fix ([2741e2a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/2741e2abc2a642d91d233f515ced055d9558a21a))
15
+
16
+
17
+ * Merge branch 'tm-3338-author-box-fix' into 'master' ([cf8a813](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/cf8a813b3e8892d2accb4d0218cba4661571fcd2))
18
+ * Merge branch 'master' of git.ilcd.rocks:team-floyd/themes/gatsby-themes ([494c66c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/494c66c081c357c1ce73423fcfe32207676b1510))
19
+
1
20
  ## [18.0.15](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v18.0.14...v18.0.15) (2023-02-21)
2
21
 
3
22
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "18.0.15",
3
+ "version": "18.0.17",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "main": "index.js",
6
6
  "GATSBY_RECAPTCHA_SITEKEY": "6LfoyvMUAAAAAO4nl_MQnqHb4XdHxEiu5cXgIqeB",
@@ -8,7 +8,7 @@ import { FaLinkedin } from '@react-icons/all-files/fa/FaLinkedin';
8
8
  import { FaArrowRight } from '@react-icons/all-files/fa/FaArrowRight';
9
9
  import { FaClock } from '@react-icons/all-files/fa/FaClock';
10
10
  import PropTypes from 'prop-types';
11
- import { translate, imagePrettyUrl, getAltText } from '~helpers/getters';
11
+ import { translate, imagePrettyUrl, getAltText, textWordsLimit } from '~helpers/getters';
12
12
  import styles from './author-box.module.scss';
13
13
  import LazyImage from '~hooks/lazy-image';
14
14
  import Link from '~hooks/link';
@@ -120,7 +120,7 @@ export default function AuthorBox({
120
120
  dangerouslySetInnerHTML={{
121
121
  __html:
122
122
  author.biography.split(' ').length > 30 && isReadMore
123
- ? `${author.biography.split(' ').slice(0, 30).join(' ')} <span class='${
123
+ ? `${textWordsLimit(author.biography, 30)} <span class='${
124
124
  styles.contReadText
125
125
  }'>...${translate(translations, 'cont_read', 'continue reading')}</span>`
126
126
  : author.biography,
@@ -37,6 +37,7 @@ export const topListPickKeys = [
37
37
  ];
38
38
 
39
39
  export const pickRelationKeys = {
40
+ event: ['event'],
40
41
  tournament: ['tournaments'],
41
42
  operator: [
42
43
  'standardised_logo_url_object',
@@ -98,6 +98,17 @@ export function filterInactiveOperators(items) {
98
98
  });
99
99
  }
100
100
 
101
+ export function filterEvents(pages) {
102
+ const pagesFiltered = [];
103
+ pages.forEach((page) => {
104
+ if (page.relation && page.relation.event) {
105
+ pagesFiltered.push(page);
106
+ }
107
+ });
108
+
109
+ return pagesFiltered;
110
+ }
111
+
101
112
  export function filterOperators(pages, selectedProviders, selectedTypes) {
102
113
  const pagesFiltered = [];
103
114
  if (!selectedTypes && !selectedProviders) {
@@ -142,7 +153,9 @@ export function processCardsV2(module, pagesCloned, pagesMappedById, pageId) {
142
153
  pagesMappedById[page_id] && module.items.push(pagesMappedById[page_id]);
143
154
  });
144
155
 
145
- module.items = filterInactiveOperators(module.items);
156
+ if (cardType === 'operator') {
157
+ module.items = filterInactiveOperators(module.items);
158
+ }
146
159
  } else if (cardSelector === 'use_filters') {
147
160
  let pagesList = [];
148
161
 
@@ -206,6 +219,9 @@ export function processCardsV2(module, pagesCloned, pagesMappedById, pageId) {
206
219
  moduleSelectedTypes
207
220
  );
208
221
  break;
222
+ case 'event':
223
+ finalizedFilteredPages = filterEvents(filteredPages);
224
+ break;
209
225
  default:
210
226
  finalizedFilteredPages = filteredPages;
211
227
  }
@@ -3,6 +3,7 @@ import {
3
3
  filterPages,
4
4
  processCardsV2,
5
5
  filterGames,
6
+ filterEvents,
6
7
  filterOperators,
7
8
  processBonus,
8
9
  processTopListModule,
@@ -105,6 +106,15 @@ describe('Modules Helper', () => {
105
106
  });
106
107
  });
107
108
 
109
+ test('filterEvents function', () => {
110
+ const pages = getPageDataList(3);
111
+ pages[0].relation = { event: 'test' };
112
+
113
+ const filteredPages = filterEvents(pages);
114
+ expect(filteredPages).toHaveLength(1);
115
+ expect(filteredPages[0].relation.event).toEqual('test');
116
+ });
117
+
108
118
  test('filterPages function', () => {
109
119
  const pages = getPageDataList(3);
110
120
  pages[0].author_id = 1;