gatsby-core-theme 5.0.1 → 5.1.1

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,50 @@
1
+ ## [5.1.1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v5.1.0...v5.1.1) (2022-03-09)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * test ([75ad3f0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/75ad3f0c3a0d12a0355f3c632a2a209f6b19dc95))
7
+ * tracker links redirect logic ([3694cfc](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3694cfc6b208fc07f223a1ddc054f2a2b50dea1c))
8
+
9
+
10
+ * Merge branch 'tracker-links-fix' into 'master' ([7394d4d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7394d4d9d947cc0b7ab4e50e92de912687b6a4ba))
11
+
12
+ # [5.1.0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v5.0.2...v5.1.0) (2022-03-07)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * add reading time to header ([1365dc5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/1365dc5f84c0a89b37188df97dfb627f16ed058e))
18
+ * added hash with style ([828111a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/828111ac4d2a0e860556f50b09ffcdbda4ee2a41))
19
+ * toplist fixtures added links ([1912625](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/1912625a4e2053f996f39279e11bbd80b810f9ff))
20
+
21
+
22
+ ### Code Refactoring
23
+
24
+ * move calculatetimeread to processsections ([0792827](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0792827f2ec099db480586c8fd267bb19132c3fc))
25
+ * move logic to processor ([3d2c426](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3d2c426d85b938dd055beee3067d351f3de4d117))
26
+
27
+
28
+ * Merge branch 'master' of git.ilcd.rocks:team-floyd/themes/gatsby-themes ([c368a8c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c368a8c94797c05e953c43bff5ce75b477378ebf))
29
+ * Merge branch 'tm-2756-reading-time' into 'master' ([88e138d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/88e138dcef2c3535cc2b6e9b929f1c876daa4333))
30
+ * Merge branch 'tm-2762-style-sheet-hash' into 'master' ([db5c54d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/db5c54dd0df9b419ff4e8f69273203043126a71d))
31
+
32
+
33
+ ### Features
34
+
35
+ * add reading time functions ([77655bc](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/77655bc491ef43a249ff5c518f9696d5c3cbeb55))
36
+
37
+ ## [5.0.2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v5.0.1...v5.0.2) (2022-03-03)
38
+
39
+
40
+ ### Bug Fixes
41
+
42
+ * disabled lighthouse ([cb06eaf](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/cb06eaf1cd70de80cfc4eabc17bea8effde1d4d3))
43
+ * tracker link default to main if toplist custom tracker name not exist ([8f9b25f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/8f9b25f284d779f57e53edb05533feec78d71207))
44
+
45
+
46
+ * Merge branch 'master' of git.ilcd.rocks:team-floyd/themes/gatsby-themes ([591ffa4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/591ffa4a83cfc72d3dd11bb9b453b0296fe6d792))
47
+
1
48
  ## [5.0.1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v5.0.0...v5.0.1) (2022-03-02)
2
49
 
3
50
 
@@ -331,23 +331,21 @@ exports.onCreatePage = ({ page, actions }) => {
331
331
  }
332
332
  };
333
333
 
334
- exports.onCreateWebpackConfig = ({ actions, plugins, getConfig }) => {
335
- const config = getConfig();
336
- const miniCssExtractPluginIndex = config.plugins.findIndex(
337
- (plugin) => plugin.constructor.name === 'MiniCssExtractPlugin'
338
- );
339
-
340
- if (miniCssExtractPluginIndex > -1) {
341
- config.plugins.splice(miniCssExtractPluginIndex, 1);
342
- config.plugins.push(
343
- plugins.extractText({
344
- ignoreOrder: true,
345
- })
334
+ exports.onCreateWebpackConfig = ({ actions, stage, getConfig }) => {
335
+ if (stage === 'build-javascript') {
336
+ const config = getConfig();
337
+ // Get the mini-css-extract-plugin
338
+ const miniCssExtractPlugin = config.plugins.find(
339
+ (plugin) => plugin.constructor.name === 'MiniCssExtractPlugin'
346
340
  );
341
+ // Set the option here to true.
342
+ if (miniCssExtractPlugin) {
343
+ miniCssExtractPlugin.options.ignoreOrder = true;
344
+ }
345
+ // Update the config.
346
+ actions.replaceWebpackConfig(config);
347
347
  }
348
348
 
349
- actions.replaceWebpackConfig(config);
350
-
351
349
  actions.setWebpackConfig({
352
350
  resolve: {
353
351
  alias: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "5.0.1",
3
+ "version": "5.1.1",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "main": "index.js",
6
6
  "GATSBY_RECAPTCHA_SITEKEY": "6LfoyvMUAAAAAO4nl_MQnqHb4XdHxEiu5cXgIqeB",
@@ -25,5 +25,11 @@
25
25
  .headerContent {
26
26
  z-index: 1;
27
27
  padding: 2.4rem;
28
+
29
+ .readingTime {
30
+ > span {
31
+ font-weight: bold;
32
+ }
33
+ }
28
34
  }
29
35
  }
@@ -14,7 +14,7 @@ describe('header component', () => {
14
14
  expect(container.querySelectorAll('.headerContent')).toHaveLength(1);
15
15
 
16
16
  // Inner HTML
17
- expect(container.querySelectorAll('p')).toHaveLength(1);
17
+ expect(container.querySelectorAll('p')).toHaveLength(2);
18
18
  expect(container.querySelectorAll('i')).toHaveLength(1);
19
19
 
20
20
  // Testing image
@@ -72,6 +72,9 @@ function Header({ section, content = null, backgroundImage = true }) {
72
72
  section.page.template !== 'article_casino' &&
73
73
  section.page.template !== 'article_sports' &&
74
74
  section.page.template !== 'game_review' && <h1>{section.page.title}</h1>}
75
+ <p className={styles.readingTime}>
76
+ Reading Time: <span>{section.page.reading_time}</span>
77
+ </p>
75
78
  <div className={!content && styles.headerText}>{headerContent()}</div>
76
79
  </div>
77
80
  </header>
@@ -86,6 +89,7 @@ Header.propTypes = {
86
89
  path: PropTypes.string,
87
90
  updated_at: PropTypes.string,
88
91
  created_at: PropTypes.string,
92
+ reading_time: PropTypes.string,
89
93
  author: PropTypes.shape({
90
94
  name: PropTypes.string,
91
95
  profile_page_path: PropTypes.string,
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
3
3
  import Button from '~atoms/button';
4
4
  import LazyImage from '~hooks/lazy-image';
5
5
  import { prettyTracker } from '~helpers/getters';
6
+ import { generateTrackerLink } from '~helpers/generators';
6
7
  import { isMobileDevice } from '~helpers/device-detect';
7
8
  import styles from './tracker.module.scss';
8
9
 
@@ -26,7 +27,8 @@ const Tracker = ({
26
27
  let tracker = '';
27
28
  for (let i = 0; i < trackerLinks.length; i += 1) {
28
29
  const trackerLink = trackerLinks[i].toLowerCase().replace(' ', '_');
29
- if (path.includes(trackerLink)) {
30
+
31
+ if (generateTrackerLink(operator, trackerLink) === path) {
30
32
  tracker =
31
33
  operator.links[
32
34
  Object.keys(operator.links).find((key) => key.toLowerCase() === trackerLink.toLowerCase())
@@ -152,6 +152,11 @@ export function prettyTracker(operator, trackerType = 'main') {
152
152
  return null;
153
153
  }
154
154
 
155
+ // if tracker is not main, check if the tracker exists, if not use main
156
+ if (trackerType !== 'main' && operator.links[trackerType] === undefined) {
157
+ trackerType = 'main';
158
+ }
159
+
155
160
  return generateTrackerLink(operator, trackerType);
156
161
  }
157
162
 
@@ -88,3 +88,8 @@ export function removeDuplicates(list, key) {
88
88
  return filtered;
89
89
  }, []);
90
90
  }
91
+
92
+ export function removeTags(str) {
93
+ if (str === null || str === '') return '';
94
+ return str.toString().replace(/(<([^>]+)>)/gi, '');
95
+ }
@@ -12,8 +12,9 @@ import { generatePlaceholderString } from '../generators';
12
12
  // eslint-disable-next-line import/no-cycle
13
13
  import { processModule } from './modules';
14
14
  // eslint-disable-next-line import/no-cycle
15
- import { clonePageForCards, groupBy } from './common';
15
+ import { clonePageForCards, groupBy, removeTags } from './common';
16
16
  import { prepareSportsData, addSportsDataToPage, addExtraFieldsToShowcaseEvents } from './sports';
17
+ import { zeroPadding } from '../schedule';
17
18
 
18
19
  const previewMode = process.env.GATSBY_PREVIEW_MODE || false;
19
20
  const postSectionsMap = {
@@ -74,7 +75,10 @@ export function transform(response) {
74
75
  return transformed;
75
76
  }
76
77
 
77
- export function processSections(sections, skipPost = false) {
78
+ export function processSections(sections, skipPost = false, page) {
79
+ let minutes = 0;
80
+ let seconds = 0;
81
+
78
82
  Object.keys(sections).forEach((sectionKey) => {
79
83
  if (skipPost && sectionKey.includes('post_main')) {
80
84
  return;
@@ -93,9 +97,32 @@ export function processSections(sections, skipPost = false) {
93
97
  menus,
94
98
  previewMode
95
99
  );
100
+
101
+ // calculate reading time
102
+ if (module.name === 'content') {
103
+ const nrOfWords = removeTags(module.value).split(' ').length / 250;
104
+ const minPerModule = Math.floor(nrOfWords);
105
+ const secPerModule = Math.floor((nrOfWords % 1) * 60);
106
+
107
+ minutes += minPerModule;
108
+ seconds += secPerModule;
109
+ }
96
110
  });
97
111
  }
98
112
  });
113
+ // transform seconds to minutes as last step
114
+ if (seconds > 60) {
115
+ const mins = Math.floor(seconds / 60);
116
+ const decimalSeconds = seconds % 60;
117
+
118
+ minutes += mins;
119
+ seconds = decimalSeconds;
120
+ }
121
+
122
+ if (page) {
123
+ page.reading_time = `${zeroPadding(minutes, 2)}:${zeroPadding(seconds, 2)}`;
124
+ }
125
+
99
126
  return sections;
100
127
  }
101
128
 
@@ -290,7 +317,7 @@ export default {
290
317
  });
291
318
 
292
319
  transformedPages[market][pageType][index] = Object.assign(page, {
293
- sections: processSections(page.sections),
320
+ sections: processSections(page.sections, false, page),
294
321
  });
295
322
  }
296
323
  });
@@ -441,6 +441,10 @@ export const singleToplistData = {
441
441
  rating: '4',
442
442
  review_link: '/slotum',
443
443
  selling_points: ['200% Bonus', 'Nice design'],
444
+ links: {
445
+ main: 'https://media.dunderaffiliates.com/redirect.aspx?pid=630524&bid=1477',
446
+ 'PPC Fallback': 'https://media.dunderaffiliates.com/redirect.aspx?pid=740444&bid=1803',
447
+ },
444
448
  one_liners: {
445
449
  main: {
446
450
  one_liner: '90% Bonus + 50 free spins',
@@ -467,6 +471,10 @@ export const singleToplistData = {
467
471
  rating: '4',
468
472
  review_link: '/rizk',
469
473
  selling_points: ['100% Bonus', 'User-friendly', 'Welcome bonus', 'Nice design'],
474
+ links: {
475
+ main: 'https://media.dunderaffiliates.com/redirect.aspx?pid=630524&bid=1477',
476
+ 'PPC Fallback': 'https://media.dunderaffiliates.com/redirect.aspx?pid=740444&bid=1803',
477
+ },
470
478
  one_liners: {
471
479
  main: {
472
480
  one_liner: '100% Bonus + 50 free spins',
@@ -493,6 +501,10 @@ export const singleToplistData = {
493
501
  rating: '3',
494
502
  review_link: '/casoola',
495
503
  selling_points: ['25 free spins', 'Loyalty scheme'],
504
+ links: {
505
+ main: 'https://media.dunderaffiliates.com/redirect.aspx?pid=630524&bid=1477',
506
+ 'PPC Fallback': 'https://media.dunderaffiliates.com/redirect.aspx?pid=740444&bid=1803',
507
+ },
496
508
  one_liners: {
497
509
  main: {
498
510
  one_liner: '80% Bonus + 25 free spins',
@@ -514,6 +526,10 @@ export const singleToplistData = {
514
526
  rating: '3',
515
527
  review_link: '/bet365',
516
528
  selling_points: ['Loyalty programme', 'Wager-free free spins'],
529
+ links: {
530
+ main: 'https://media.dunderaffiliates.com/redirect.aspx?pid=630524&bid=1477',
531
+ 'PPC Fallback': 'https://media.dunderaffiliates.com/redirect.aspx?pid=740444&bid=1803',
532
+ },
517
533
  one_liners: {
518
534
  main: {
519
535
  one_liner: 'Up to £100 New Player Bonus!',
@@ -533,6 +549,10 @@ export const singleToplistData = {
533
549
  bonus: {
534
550
  deposit_methods: [],
535
551
  },
552
+ links: {
553
+ main: 'https://media.dunderaffiliates.com/redirect.aspx?pid=630524&bid=1477',
554
+ 'PPC Fallback': 'https://media.dunderaffiliates.com/redirect.aspx?pid=740444&bid=1803',
555
+ },
536
556
  short_name: 'captain-spins',
537
557
  logo_url: 'captain-spins-logopng07b24ceb59-original.png',
538
558
  rating: '4',
@@ -557,6 +577,10 @@ export const singleToplistData = {
557
577
  bonus: {
558
578
  deposit_methods: [],
559
579
  },
580
+ links: {
581
+ main: 'https://media.dunderaffiliates.com/redirect.aspx?pid=630524&bid=1477',
582
+ 'PPC Fallback': 'https://media.dunderaffiliates.com/redirect.aspx?pid=740444&bid=1803',
583
+ },
560
584
  short_name: 'casino-gods',
561
585
  logo_url: 'casino-gods-logopng3bfc0d51-original.png',
562
586
  rating: '3',
@@ -581,6 +605,10 @@ export const singleToplistData = {
581
605
  bonus: {
582
606
  deposit_methods: [],
583
607
  },
608
+ links: {
609
+ main: 'https://media.dunderaffiliates.com/redirect.aspx?pid=630524&bid=1477',
610
+ 'PPC Fallback': 'https://media.dunderaffiliates.com/redirect.aspx?pid=740444&bid=1803',
611
+ },
584
612
  short_name: 'jinni-lotto',
585
613
  logo_url: 'jinnilotto-logopng464964d6b0-original.png',
586
614
  rating: '4',
@@ -605,6 +633,10 @@ export const singleToplistData = {
605
633
  bonus: {
606
634
  deposit_methods: [],
607
635
  },
636
+ links: {
637
+ main: 'https://media.dunderaffiliates.com/redirect.aspx?pid=630524&bid=1477',
638
+ 'PPC Fallback': 'https://media.dunderaffiliates.com/redirect.aspx?pid=740444&bid=1803',
639
+ },
608
640
  short_name: 'betfair',
609
641
  logo_url: '5aedeb23bb-original.png',
610
642
  rating: '5',
@@ -629,6 +661,10 @@ export const singleToplistData = {
629
661
  bonus: {
630
662
  deposit_methods: [],
631
663
  },
664
+ links: {
665
+ main: 'https://media.dunderaffiliates.com/redirect.aspx?pid=630524&bid=1477',
666
+ 'PPC Fallback': 'https://media.dunderaffiliates.com/redirect.aspx?pid=740444&bid=1803',
667
+ },
632
668
  short_name: 'casoola',
633
669
  logo_url: 'casoola-logopng381ab5c04f-original.png',
634
670
  rating: '3',
@@ -653,6 +689,10 @@ export const singleToplistData = {
653
689
  bonus: {
654
690
  deposit_methods: [],
655
691
  },
692
+ links: {
693
+ main: 'https://media.dunderaffiliates.com/redirect.aspx?pid=630524&bid=1477',
694
+ 'PPC Fallback': 'https://media.dunderaffiliates.com/redirect.aspx?pid=740444&bid=1803',
695
+ },
656
696
  short_name: 'bet365',
657
697
  logo_url: 'image-63.png',
658
698
  rating: '3',
@@ -677,6 +717,10 @@ export const singleToplistData = {
677
717
  bonus: {
678
718
  deposit_methods: [],
679
719
  },
720
+ links: {
721
+ main: 'https://media.dunderaffiliates.com/redirect.aspx?pid=630524&bid=1477',
722
+ 'PPC Fallback': 'https://media.dunderaffiliates.com/redirect.aspx?pid=740444&bid=1803',
723
+ },
680
724
  short_name: 'captain-spins',
681
725
  logo_url: 'captain-spins-logopng07b24ceb59-original.png',
682
726
  rating: '4',
@@ -701,6 +745,10 @@ export const singleToplistData = {
701
745
  bonus: {
702
746
  deposit_methods: [],
703
747
  },
748
+ links: {
749
+ main: 'https://media.dunderaffiliates.com/redirect.aspx?pid=630524&bid=1477',
750
+ 'PPC Fallback': 'https://media.dunderaffiliates.com/redirect.aspx?pid=740444&bid=1803',
751
+ },
704
752
  short_name: 'slotum',
705
753
  logo_url: 'slotum-casino-logo-transparentpng6b10407566-original.png',
706
754
  rating: '4',
@@ -725,6 +773,10 @@ export const singleToplistData = {
725
773
  bonus: {
726
774
  deposit_methods: [],
727
775
  },
776
+ links: {
777
+ main: 'https://media.dunderaffiliates.com/redirect.aspx?pid=630524&bid=1477',
778
+ 'PPC Fallback': 'https://media.dunderaffiliates.com/redirect.aspx?pid=740444&bid=1803',
779
+ },
728
780
  short_name: 'casoola',
729
781
  logo_url: 'casoola-logopng381ab5c04f-original.png',
730
782
  rating: '3',