gatsby-core-theme 6.1.7 → 6.1.8
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 +21 -0
- package/package.json +1 -1
- package/src/components/molecules/module/index.js +11 -5
- package/src/helpers/getters.js +29 -5
- package/src/helpers/getters.test.js +25 -0
- package/src/helpers/processor/index.js +6 -1
- package/src/helpers/processor/modules.js +12 -3
- package/tests/factories/pagesMappedById/index.js +117 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
## [6.1.8](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v6.1.7...v6.1.8) (2022-04-26)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add operator related to the page as the first item in the comparison table automatically ([1fed78a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/1fed78afc28bb072420556896dd350bb7351b69d))
|
|
7
|
+
* add unit testing ([a0d4f03](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a0d4f0352553280e80ce08e3b8c533c78ffb6dfc))
|
|
8
|
+
* change map to find ([756e648](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/756e6481ef95b7b080c0e0c1fdbcc0c0caabd8fb))
|
|
9
|
+
* cleanup code ([c3f76aa](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c3f76aa2866fa0011e8323c2a61e5ec5d815006e))
|
|
10
|
+
* include module introduction on all modules ([d9e0d01](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d9e0d016503f0afee00cfe1724db48179b77020d))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Code Refactoring
|
|
14
|
+
|
|
15
|
+
* add condition for null module ([369fa6e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/369fa6ec03b789a08542092c1355ab835d07cd14))
|
|
16
|
+
* fix typo ([e3248a3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e3248a306a12f6a27112ab9515ffb2484590ffe5))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
* Merge branch 'tm-2823-removing-review' into 'master' ([5a1301c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/5a1301c75bcad1b055918d024358f93295c3e1a6))
|
|
20
|
+
* Merge branch 'tm-2689-add-paragraph' into 'master' ([2cf135d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/2cf135dd4619e1a1698aacdeb08a85c10ce70be2))
|
|
21
|
+
|
|
1
22
|
## [6.1.7](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v6.1.6...v6.1.7) (2022-04-19)
|
|
2
23
|
|
|
3
24
|
|
package/package.json
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable react/no-danger */
|
|
1
2
|
/* eslint-disable react/prop-types */
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import PropTypes from 'prop-types';
|
|
@@ -10,13 +11,15 @@ import { prettyTracker } from '~helpers/getters';
|
|
|
10
11
|
|
|
11
12
|
const Modules = ({ module, page, pageContext }) => {
|
|
12
13
|
const GetModuleComponent = (moduleItem) => {
|
|
13
|
-
|
|
14
|
+
const { items, name } = moduleItem || {};
|
|
15
|
+
|
|
16
|
+
switch (name) {
|
|
14
17
|
case 'content':
|
|
15
18
|
return loadable(() => import('~molecules/content'));
|
|
16
19
|
case 'top_list':
|
|
17
20
|
return loadable(() => import('~organisms/toplist'));
|
|
18
21
|
case 'archive':
|
|
19
|
-
if (!
|
|
22
|
+
if (!items || items.length === 0) return null;
|
|
20
23
|
return loadable(() => import('~organisms/archive'));
|
|
21
24
|
case 'counter':
|
|
22
25
|
return loadable(() => import('~molecules/counter'));
|
|
@@ -28,14 +31,14 @@ const Modules = ({ module, page, pageContext }) => {
|
|
|
28
31
|
case 'accordion':
|
|
29
32
|
return loadable(() => import('~organisms/accordion'));
|
|
30
33
|
case 'anchor':
|
|
31
|
-
if (
|
|
34
|
+
if (items && items.length > 0) {
|
|
32
35
|
return loadable(() => import('~organisms/anchor'));
|
|
33
36
|
}
|
|
34
37
|
return null;
|
|
35
38
|
case 'carousel':
|
|
36
39
|
if (
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
items.length > 0 && // has items
|
|
41
|
+
items.filter((item) => item.image === null).length === 0 // not filled with null items
|
|
39
42
|
) {
|
|
40
43
|
return loadable(() => import('~organisms/carousel'));
|
|
41
44
|
}
|
|
@@ -79,6 +82,9 @@ const Modules = ({ module, page, pageContext }) => {
|
|
|
79
82
|
} ${styles.module} ${module?.style && styles[module.style]} module`}
|
|
80
83
|
>
|
|
81
84
|
<ModuleTitle module={module} />
|
|
85
|
+
{module.module_introduction && (
|
|
86
|
+
<div dangerouslySetInnerHTML={{ __html: module?.module_introduction }} />
|
|
87
|
+
)}
|
|
82
88
|
<ModuleComponent module={module} page={page} pageContext={pageContext} {...extraProps} />
|
|
83
89
|
</div>
|
|
84
90
|
)
|
package/src/helpers/getters.js
CHANGED
|
@@ -31,8 +31,8 @@ export function getExtraField(extraFields, key, defaultValue) {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export function getSection(shortCode, pageContext) {
|
|
34
|
-
const page = pageContext
|
|
35
|
-
const marketSections = pageContext
|
|
34
|
+
const page = pageContext && pageContext.page;
|
|
35
|
+
const marketSections = pageContext && pageContext.marketSections;
|
|
36
36
|
// eslint-disable-next-line
|
|
37
37
|
if (!page || !page.hasOwnProperty('sections') || !page.sections.hasOwnProperty(shortCode)) {
|
|
38
38
|
return null;
|
|
@@ -91,7 +91,7 @@ export function image(filename, width, height, fit = 'cover') {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
export function getImageFilename(src) {
|
|
94
|
-
const srcArr = src
|
|
94
|
+
const srcArr = src && src.substring(src.lastIndexOf('/') + 1).split('.');
|
|
95
95
|
if (!srcArr.length) {
|
|
96
96
|
return '';
|
|
97
97
|
}
|
|
@@ -321,7 +321,7 @@ export function copyrightText() {
|
|
|
321
321
|
}
|
|
322
322
|
|
|
323
323
|
export function getFirstModuleByName(section, moduleName) {
|
|
324
|
-
if (section && section.modules && section.modules[0]
|
|
324
|
+
if (section && section.modules && section.modules[0].name === moduleName) {
|
|
325
325
|
return section.modules[0];
|
|
326
326
|
}
|
|
327
327
|
return null;
|
|
@@ -329,7 +329,7 @@ export function getFirstModuleByName(section, moduleName) {
|
|
|
329
329
|
|
|
330
330
|
export function translate(translations, key, defaultValue = '') {
|
|
331
331
|
// eslint-disable-next-line
|
|
332
|
-
if (translations
|
|
332
|
+
if (translations && translations.hasOwnProperty(key)) {
|
|
333
333
|
return translations[key];
|
|
334
334
|
}
|
|
335
335
|
return defaultValue;
|
|
@@ -338,3 +338,27 @@ export function translate(translations, key, defaultValue = '') {
|
|
|
338
338
|
export function getAws(imageName) {
|
|
339
339
|
return `https://assets-srv.s3.eu-west-1.amazonaws.com/${imageName}`;
|
|
340
340
|
}
|
|
341
|
+
|
|
342
|
+
// This part of the code, help us to add operator related to the page as the first item in the comparison table automatically
|
|
343
|
+
// example: if we are on the operator review page(Rizk) that should be first in the comparison table
|
|
344
|
+
// First, we check if we have that item in the array, if that item is in the array, we check its position
|
|
345
|
+
// If the item isn't in the array we will add it automatically
|
|
346
|
+
export function shiftFirstOperator(pageId, module, pagesMappedById) {
|
|
347
|
+
let index = null;
|
|
348
|
+
// check if exist that element in array
|
|
349
|
+
const checkIfExistElement = module.items.find((item, i) => {
|
|
350
|
+
if (item.id === pageId) {
|
|
351
|
+
index = i;
|
|
352
|
+
if (index > 0) {
|
|
353
|
+
// eslint-disable-next-line no-nested-ternary
|
|
354
|
+
module.items.sort((x, y) => (x.id === pageId ? -1 : y.id === pageId ? 1 : 0));
|
|
355
|
+
}
|
|
356
|
+
return true;
|
|
357
|
+
}
|
|
358
|
+
return false;
|
|
359
|
+
});
|
|
360
|
+
if (!checkIfExistElement) {
|
|
361
|
+
// eslint-disable-next-line no-unused-expressions
|
|
362
|
+
pagesMappedById[pageId] && module.items.unshift(pagesMappedById[pageId]);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as Getters from './getters';
|
|
2
|
+
import pagesMappedById from '../../tests/factories/pagesMappedById';
|
|
2
3
|
|
|
3
4
|
describe('Getters Helper', () => {
|
|
4
5
|
const { location } = window;
|
|
@@ -228,4 +229,28 @@ describe('Getters Helper', () => {
|
|
|
228
229
|
expect(Getters.translate(object, 'hello')).toEqual('world');
|
|
229
230
|
expect(Getters.translate(object, 'foo', 'bar')).toEqual('bar');
|
|
230
231
|
});
|
|
232
|
+
|
|
233
|
+
const module = {
|
|
234
|
+
items: [
|
|
235
|
+
{
|
|
236
|
+
id: 12300,
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
id: 13212,
|
|
240
|
+
},
|
|
241
|
+
],
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
test('add the operator item', () => {
|
|
245
|
+
Getters.shiftFirstOperator(11607, module, pagesMappedById);
|
|
246
|
+
expect(module.items[0].id).toBe(11607);
|
|
247
|
+
});
|
|
248
|
+
test('move opeartor first postion', () => {
|
|
249
|
+
Getters.shiftFirstOperator(13212, module, pagesMappedById);
|
|
250
|
+
expect(module.items[0].id).toBe(13212);
|
|
251
|
+
});
|
|
252
|
+
test('check when we have the operator in first postion', () => {
|
|
253
|
+
Getters.shiftFirstOperator(13212, module, pagesMappedById);
|
|
254
|
+
expect(module.items[0].id).toBe(13212);
|
|
255
|
+
});
|
|
231
256
|
});
|
|
@@ -78,6 +78,10 @@ export function transform(response) {
|
|
|
78
78
|
const savedModules = {};
|
|
79
79
|
export function processSections(sections, skipPost = false, page) {
|
|
80
80
|
const siteName = page && page.siteInfo && page.siteInfo.site_name;
|
|
81
|
+
|
|
82
|
+
// pagedId we will use it just on operator review pages
|
|
83
|
+
const pageId = page && page.type === 'operator' ? page.id : null;
|
|
84
|
+
|
|
81
85
|
let minutes = 0;
|
|
82
86
|
let seconds = 0;
|
|
83
87
|
|
|
@@ -100,7 +104,8 @@ export function processSections(sections, skipPost = false, page) {
|
|
|
100
104
|
relations,
|
|
101
105
|
pagesMappedById,
|
|
102
106
|
menus,
|
|
103
|
-
previewMode
|
|
107
|
+
previewMode,
|
|
108
|
+
pageId
|
|
104
109
|
);
|
|
105
110
|
|
|
106
111
|
if (shouldSavePrefilled(module, siteName)) {
|
|
@@ -5,6 +5,7 @@ import { clonePageForCards, groupBy, removeDuplicates } from './common';
|
|
|
5
5
|
import settings from '../../constants/settings';
|
|
6
6
|
import ModuleValue from '../../constants/module-value';
|
|
7
7
|
import { topListPickKeys } from '../../constants/pick-keys';
|
|
8
|
+
import { shiftFirstOperator } from '../getters';
|
|
8
9
|
|
|
9
10
|
const pagesGroupedByTemplateId = [];
|
|
10
11
|
|
|
@@ -105,16 +106,18 @@ export function filterOperators(pages, selectedProviders, selectedTypes) {
|
|
|
105
106
|
return pagesFiltered;
|
|
106
107
|
}
|
|
107
108
|
|
|
108
|
-
export function processCardsV2(module, pagesCloned, pagesMappedById) {
|
|
109
|
+
export function processCardsV2(module, pagesCloned, pagesMappedById, pageId) {
|
|
109
110
|
const pageType = module.cards_page_type;
|
|
110
111
|
const pageTemplateId = module.cards_page_type_id;
|
|
111
112
|
const sortType = module.cards_selector_filters_sort_by;
|
|
112
113
|
const cardSelector = module.cards_selector;
|
|
114
|
+
const styleName = module.style;
|
|
113
115
|
const moduleSelectedProviders =
|
|
114
116
|
module.cards_selector_filters && module.cards_selector_filters.providers;
|
|
115
117
|
const moduleSelectedCategories =
|
|
116
118
|
module.cards_selector_filters && module.cards_selector_filters.categories;
|
|
117
119
|
const moduleSelectedTypes = module.cards_selector_filters && module.cards_selector_filters.types;
|
|
120
|
+
|
|
118
121
|
module.items = [];
|
|
119
122
|
|
|
120
123
|
if (cardSelector === 'select_manually') {
|
|
@@ -204,6 +207,11 @@ export function processCardsV2(module, pagesCloned, pagesMappedById) {
|
|
|
204
207
|
}
|
|
205
208
|
}
|
|
206
209
|
}
|
|
210
|
+
|
|
211
|
+
if (styleName === 'comparison_table' && pageId !== null) {
|
|
212
|
+
shiftFirstOperator(pageId, module, pagesMappedById);
|
|
213
|
+
}
|
|
214
|
+
|
|
207
215
|
// modify page so it doesn't have too much data
|
|
208
216
|
module.items = module.items.map((item) => clonePageForCards(cloneDeep(item), module.style));
|
|
209
217
|
}
|
|
@@ -249,12 +257,13 @@ export function processModule(
|
|
|
249
257
|
relations,
|
|
250
258
|
pagesMappedById,
|
|
251
259
|
menus,
|
|
252
|
-
previewMode
|
|
260
|
+
previewMode,
|
|
261
|
+
pageId
|
|
253
262
|
) {
|
|
254
263
|
if (module.name === 'cards') {
|
|
255
264
|
processCardsModule(module, pages, pagesCloned, pagesMappedById);
|
|
256
265
|
} else if (module.name === 'cards_v2') {
|
|
257
|
-
processCardsV2(module, pagesCloned, pagesMappedById);
|
|
266
|
+
processCardsV2(module, pagesCloned, pagesMappedById, pageId);
|
|
258
267
|
} else if (module.name === 'bonus') {
|
|
259
268
|
processBonus(module, relations);
|
|
260
269
|
} else if (module.name === 'archive' && previewMode) {
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
11607: {
|
|
3
|
+
id: 11607,
|
|
4
|
+
market_id: 7,
|
|
5
|
+
updated_at: '2021-10-28',
|
|
6
|
+
created_at: '2020-02-14 14:12:45',
|
|
7
|
+
template_id: 11,
|
|
8
|
+
page_hreflang_group_id: null,
|
|
9
|
+
page_hreflang_combined: 0,
|
|
10
|
+
relation_id: 3148,
|
|
11
|
+
relation_type: 'game',
|
|
12
|
+
market: 'no_no',
|
|
13
|
+
region_code: null,
|
|
14
|
+
crawler_location_market: null,
|
|
15
|
+
author: {
|
|
16
|
+
name: 'Ida Moen Olsen',
|
|
17
|
+
profile_page_path: 'om-oss/ida-moen-olsen',
|
|
18
|
+
image_asset_id: 64615,
|
|
19
|
+
image_alt: null,
|
|
20
|
+
site_id: 2,
|
|
21
|
+
country_id: null,
|
|
22
|
+
language_id: null,
|
|
23
|
+
twitter_profile: null,
|
|
24
|
+
facebook_profile: null,
|
|
25
|
+
linkedin_profile: null,
|
|
26
|
+
instagram_profile: null,
|
|
27
|
+
personal_website: null,
|
|
28
|
+
email_address: null,
|
|
29
|
+
author_title: null,
|
|
30
|
+
additional_url: null,
|
|
31
|
+
image: 'ida-moen-olsen.webp',
|
|
32
|
+
image_object: [],
|
|
33
|
+
country: null,
|
|
34
|
+
language: null,
|
|
35
|
+
},
|
|
36
|
+
reviewer: null,
|
|
37
|
+
hard_coded_breadcrumbs: 0,
|
|
38
|
+
breadcrumb_ids: [174],
|
|
39
|
+
categories: [],
|
|
40
|
+
author_id: 47,
|
|
41
|
+
reviewer_id: null,
|
|
42
|
+
style_id: null,
|
|
43
|
+
language: 'no',
|
|
44
|
+
description: null,
|
|
45
|
+
meta_title: "Caishen's Arrival - Norske Spilleautomater",
|
|
46
|
+
meta_robots: null,
|
|
47
|
+
robot_options: {
|
|
48
|
+
page_index: 1,
|
|
49
|
+
links_followed: 1,
|
|
50
|
+
images_index: 1,
|
|
51
|
+
show_snippet: 1,
|
|
52
|
+
},
|
|
53
|
+
meta_description:
|
|
54
|
+
'Caishens Arrival er en asiatisk inspirert automat med gratisspinn og en massiv multiplikator på x 35,000. Du kan spille automaten gratis her',
|
|
55
|
+
page_custom_hreflangs: null,
|
|
56
|
+
title: "Caishen's Arrival",
|
|
57
|
+
vanity_label: null,
|
|
58
|
+
path: 'caishens-arrival-spilleautomater',
|
|
59
|
+
type: 'game',
|
|
60
|
+
template: 'game_review',
|
|
61
|
+
banner: '5af66017a898b7a5d6349b9396c1c680.jpeg',
|
|
62
|
+
featured_image: '5af66017a898b7a5d6349b9396c1c680.jpeg',
|
|
63
|
+
canonical_url: null,
|
|
64
|
+
canonical_url_page_id: null,
|
|
65
|
+
status: 'active',
|
|
66
|
+
page_group_id: null,
|
|
67
|
+
page_group_combined: 0,
|
|
68
|
+
page_group_custom_items: null,
|
|
69
|
+
sections: {
|
|
70
|
+
main: [],
|
|
71
|
+
header: [],
|
|
72
|
+
navigation: null,
|
|
73
|
+
footer: null,
|
|
74
|
+
post_main_games: null,
|
|
75
|
+
},
|
|
76
|
+
featured_image_object: {
|
|
77
|
+
width: '400',
|
|
78
|
+
height: '250',
|
|
79
|
+
url: 'https://assets-srv.s3.eu-west-1.amazonaws.com/5af66017a898b7a5d6349b9396c1c680.jpeg',
|
|
80
|
+
filename: '5af66017a898b7a5d6349b9396c1c680.jpeg',
|
|
81
|
+
},
|
|
82
|
+
relation: {
|
|
83
|
+
id: 3148,
|
|
84
|
+
name: "Caishen's Arrival",
|
|
85
|
+
short_name: 'caishens_arrival',
|
|
86
|
+
first_rating: '2',
|
|
87
|
+
second_rating: '4',
|
|
88
|
+
third_rating: '4',
|
|
89
|
+
fourth_rating: '2',
|
|
90
|
+
average_rating: '',
|
|
91
|
+
volatility: 2,
|
|
92
|
+
iframe: '',
|
|
93
|
+
freespins: 1,
|
|
94
|
+
rtp: 95.74,
|
|
95
|
+
launch_date: '2019-10-16',
|
|
96
|
+
number_of_reels: 5,
|
|
97
|
+
winning_lines: 25,
|
|
98
|
+
jackpots: 0,
|
|
99
|
+
vegas: 0,
|
|
100
|
+
fruit: 0,
|
|
101
|
+
wilds: 0,
|
|
102
|
+
sticky_wilds: 0,
|
|
103
|
+
respins: 0,
|
|
104
|
+
mega_ways: 0,
|
|
105
|
+
bonus_rounds: 0,
|
|
106
|
+
recommended: 0,
|
|
107
|
+
exclusive: 0,
|
|
108
|
+
new: 0,
|
|
109
|
+
hot: 0,
|
|
110
|
+
game_provider: [],
|
|
111
|
+
markets: [],
|
|
112
|
+
enabled: true,
|
|
113
|
+
game_categories: [],
|
|
114
|
+
game_screenshots: [],
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
};
|